4 Replies Latest reply: Jul 2, 2013 10:11 AM by user7202399 RSS

    creation of sequence in etext template

    user1044141
      Hi All,
      I am creating a custom etext template for a invoice payment which will be forwarded to bank.
      The file will be generated for each invoice payment made one at a time.
      So, I have a requirement where in need to generate a sequence number in of the fields of the extext template. When the first file is send to bank, the sequence should be 1, for the second run the sequence should display 2 and so on.

      Here we cannot use the <RESET AT LEVEL> as RECORD or LEVEL as we need to control the sequence outside the etext template and in the database. So, I believe we should use PERIODIC_SEQUENCE that controls the value in database level.

      My question is how to achieve the relation between the database value and the etext template value.

      ex:
      <DEFINE SEQUENCE> allrecordsequence
      <RESET AT LEVEL> PERIODIC_SEQUENCE
      <INCREMENT BASIS> /outboundtransaction/paymentsequence[sequencename=allrecordsequence]/lastvalue + 1
      <END DEFINE SEQUENCE> allrecordsequence

      In the etext template

      sequence(allrecordsequence)

      The value in the etext template is always generation as 1, as the database record paymentsequence/lastvalue is null.

      Here is the user guide notes:

      Reset at Level

      The reset at level subcommand defines where the sequence resets its starting number. It is a mandatory subcommand. For example, to number the payments in a batch, define the reset at level as Batch. To continue numbering across batches, define the reset level as RequestHeader.

      In some cases the sequence is reset outside the template. For example, a periodic sequence may be defined to reset by date. In these cases, the PERIODIC_SEQUENCE keyword is used for the reset at level. The system saves the last sequence number used for a payment file to the database. Outside events control resetting the sequence in the database. For the next payment file run, the sequence number is extracted from the database for the start at number (see start at subcommand).

      But the sequence value in the database is not getting incremented.

      Appreciate an early response as it is really urgent.

      Thank you in advance.
        • 1. Re: creation of sequence in etext template
          Tam_11
          I have the same question...would anyone be able to provide an answer, please?
          • 2. Re: creation of sequence in etext template
            810314
            If anyone has a solution for this please post your suggestions /solutions.


            Thanks,
            Sumana.
            • 3. Re: creation of sequence in etext template
              810314
              I have developed the solution using the below approach-

              Requirement - ( My requirement was a little different to what was mentioned above)
                   To generate a sequence number in the e-text template of a invoice payment file.
                   In a day when the first file is send to the bank, the sequence should be 1, for the second file the sequence should be 2.
                   For the next day run the sequence value should be reset to 1.

              Approach 1) Use the IBY_FD_EXTRACT_EXT_PUB hook and Use sequence in the e-text template.

              GET_INS_EXT_AGG procedure is called once only for the payment instruction.
              It will add XML data element under OutboundPaymentInstruction tag.

              Add a new XML tag with the successful count of the formatted payments in a day.
              SQL query.
              SELECT COUNT (1)
              INTO v_payment_count
              FROM iby_payments_all a
              WHERE UPPER (a.org_name) = <org_name>
              AND UPPER (a.payment_profile_sys_name) =
              'profile system name'
              AND TRUNC (a.creation_date) = TRUNC (SYSDATE)
              AND a.payment_service_request_id <
              (SELECT MAX (b.payment_service_request_id)
              FROM iby_payments_all b);

              In the e-text template use the sequence number
              <DEFINE SEQUENCE>     RecordSeq1
              <RESET AT LEVEL>     OutboundPaymentInstruction
              <INCREMENT BASIS>     LEVEL
              <START AT>          1
              <END DEFINE SEQUENCE >     RecordSeq1


              While referring to the sequence use :- SSPN_PAYMENT_COUNT + SEQUENCE_NUMBER(RecordSeq1)
              to get the latest count of payment files.

              Approach 2) Using payment system

              <DEFINE SEQUENCE>      RecordsSeq1
              <RESET AT LEVEL>      PERIODIC_SEQUENCE
              <INCREMENT BASIS>      LEVEL
              <START AT> /PaymentSequence[SequenceName=’RecordsSeq1’]/LastValue + 1
              <END DEFINE SEQUENCE > RecordsSeq1

              By using a PERIODIC_SEQUENCE it will periodically generate the numbers.
              SEQUENCE_NUMBER(RecordsSeq1) is used to generate the number.

              I believe we need to have a payment system defined and associate the same to a Payment Process Profile.
              Only then can it have association with the last sequence number in the database.
              Please correct me if the Approach#2 set up is incorrect.

              Since Payment system was not necessary for the payment profile that we have used I have used approach 1
              Approach 2 can be used as a guideline :)
              • 4. Re: creation of sequence in etext template
                user7202399

                Thanks.  I could not get the Sequence to work (approach 2), but I like your Approach 1 suggestion.

                 

                Thanks.

                -Charlie