Skip to Content
avatar image
Former Member

Problem in end routine

Hello Friends,

I implemented an end routine for DSO ABC to generate a flag "N - for New record", "A - for Active record", "D - for Deleted Record"

Basically, this routine checks the target whether incoming record is existing in Target DSO or not. If it exists it flag as "A", If it doesn't exist it flags as "D", If its a new record it flags as "N".

When i was loading for the first time into DSO, data is loading fine and Flag is "N" as all the records were newly getting loaded.

When trying to load same data for the 2nd time. Expected flag is "A". Instead of this load is getting failed with below error & log

Please suggest any changes required in code below:



Record 0, segment 0001 is not in the cross-record table

Message no. RSM2716

Diagnosis

You created new data records in a routine of the transformation. They do not have a data record number. An error occurred in one of these data records. Since this record does not have a data record number, it cannot be handled by error processing.

You cannot process the error on single-record basis since this sorts out the corresponding original data records and provides a correction.

System Response

The processing of the data package is terminated.

Procedure

Copy the data record number (field RECORD) from the original data record into the new data record.

Example

DATA: result_fields TYPE _ty_s_tg_1.

LOOP AT result_package INTO result_fields WHERE accounttype = 'I'.

  result_fields-accounttype = 'E'.

  APPEND result_fields TO result_package.

ENDLOOP.

Result
Each data record of the original package exists twice, once with accounttype = 'I', and once with accounttype = 'E'. The new data records have the same record numbers as the original data records.

End Routine:

data : itab1 type standard table of /BIC/AZP2_ODIG00,

           lwa1 type /BIC/AZP2_ODIG00,

           itab2 type standard table of _ty_s_TG_1,

           lwa2 type _ty_s_TG_1,

           itab_target type standard table of _ty_s_TG_1.

    select * from  /BIC/AZP2_ODIG00 into table itab1.

loop at RESULT_PACKAGE assigning <result_fields>.

      clear lwa1.

      read table itab1 into lwa1 with key

        /BIC/ZP2_AUFNR = <result_fields>-/BIC/ZP2_AUFNR

        /BIC/ZP2_AUFS1 = <result_fields>-/BIC/ZP2_AUFS1

        /BIC/ZP2_EQUNR = <result_fields>-/BIC/ZP2_EQUNR

        /BIC/ZP2_DICPO = <result_fields>-/BIC/ZP2_DICPO

        /BIC/ZP2_DISPN = <result_fields>-/BIC/ZP2_DISPN.

      if sy-subrc eq 0.

        <result_fields>-/BIC/ZP2_CFAW = 'A'.

      Else.

        <result_fields>-/BIC/ZP2_CFAW = 'N'.

      endif.

Endloop.

    clear lwa1.

loop at itab1 into lwa1.

      clear lwa2.

      read table RESULT_PACKAGE into lwa2 with key

        /BIC/ZP2_AUFNR =  lwa1-/BIC/ZP2_AUFNR

        /BIC/ZP2_AUFS1 = lwa1-/BIC/ZP2_AUFS1

        /BIC/ZP2_EQUNR = lwa1-/BIC/ZP2_EQUNR

        /BIC/ZP2_DICPO = lwa1-/BIC/ZP2_DICPO

        /BIC/ZP2_DISPN = lwa1-/BIC/ZP2_DISPN.

      if sy-subrc ne 0.

        lwa2-/BIC/ZP2_AUFNR = lwa1-/BIC/ZP2_AUFNR.

        lwa2-/BIC/ZP2_AUFS1 = lwa1-/BIC/ZP2_AUFS1.

        lwa2-/BIC/ZP2_EQUNR = lwa1-/BIC/ZP2_EQUNR.

        lwa2-/BIC/ZP2_DICPO = lwa1-/BIC/ZP2_DICPO.

        lwa2-/BIC/ZP2_DISPN = lwa1-/BIC/ZP2_DISPN.

        lwa2-/BIC/ZP2_DIALR = lwa1-/BIC/ZP2_DIALR.

        lwa2-/BIC/ZP2_DIABY = lwa1-/BIC/ZP2_DIABY.

        lwa2-/BIC/ZP2_DIAPF = lwa1-/BIC/ZP2_DIAPF.

        lwa2-/BIC/ZP2_DIARC = lwa1-/BIC/ZP2_DIARC.

        lwa2-/BIC/ZP2_DIARD = lwa1-/BIC/ZP2_DIARD.

        lwa2-/BIC/ZP2_DIBNO = lwa1-/BIC/ZP2_DIBNO.

        lwa2-/BIC/ZP2_DICBY = lwa1-/BIC/ZP2_DICBY.

        lwa2-/BIC/ZP2_DICDT = lwa1-/BIC/ZP2_DICDT.

        lwa2-/BIC/ZP2_DICRN = lwa1-/BIC/ZP2_DICRN.

        lwa2-/BIC/ZP2_DICUS = lwa1-/BIC/ZP2_DICUS.

        lwa2-/BIC/ZP2_DIDFD = lwa1-/BIC/ZP2_DIDFD.

        lwa2-/BIC/ZP2_DIDET = lwa1-/BIC/ZP2_DIDET.

        lwa2-/BIC/ZP2_DIDAD = lwa1-/BIC/ZP2_DIDAD.

        lwa2-/BIC/ZP2_DIDCD = lwa1-/BIC/ZP2_DIDCD.

        lwa2-/BIC/ZP2_DIDIA = lwa1-/BIC/ZP2_DIDIA.

        lwa2-/BIC/ZP2_DIDLE = lwa1-/BIC/ZP2_DIDLE.

        lwa2-/BIC/ZP2_DIDMD = lwa1-/BIC/ZP2_DIDMD.

        lwa2-/BIC/ZP2_DIDRC = lwa1-/BIC/ZP2_DIDRC.

        lwa2-/BIC/ZP2_DIECO = lwa1-/BIC/ZP2_DIECO.

        lwa2-/BIC/ZP2_DIDNR = lwa1-/BIC/ZP2_DIDNR.

        lwa2-/BIC/ZP2_DIFLM = lwa1-/BIC/ZP2_DIFLM.

        lwa2-/BIC/ZP2_DIDIB = lwa1-/BIC/ZP2_DIDIB.

        lwa2-/BIC/ZP2_DIMAI = lwa1-/BIC/ZP2_DIMAI.

        lwa2-/BIC/ZP2_DIMAT = lwa1-/BIC/ZP2_DIMAT.

        lwa2-/BIC/ZP2_DIMCN = lwa1-/BIC/ZP2_DIMCN.

        lwa2-/BIC/ZP2_DIMFN = lwa1-/BIC/ZP2_DIMFN.

        lwa2-/BIC/ZP2_DILWD = lwa1-/BIC/ZP2_DILWD.

        lwa2-/BIC/ZP2_DIMWT = lwa1-/BIC/ZP2_DIMWT.

        lwa2-/BIC/ZP2_DIOWC = lwa1-/BIC/ZP2_DIOWC.

        lwa2-/BIC/ZP2_DIOWN = lwa1-/BIC/ZP2_DIOWN.

        lwa2-/BIC/ZP2_DITFL = lwa1-/BIC/ZP2_DITFL.

        lwa2-/BIC/ZP2_DISFA = lwa1-/BIC/ZP2_DISFA.

        lwa2-/BIC/ZP2_DISER = lwa1-/BIC/ZP2_DISER.

        lwa2-/BIC/ZP2_DIPSE = lwa1-/BIC/ZP2_DIPSE.

        lwa2-/BIC/ZP2_DITFO = lwa1-/BIC/ZP2_DITFO.

        lwa2-/BIC/ZP2_DIDDT = lwa1-/BIC/ZP2_DIDDT.

        lwa2-/BIC/ZP2_GSOND = lwa1-/BIC/ZP2_GSOND.

        lwa2-/BIC/ZP2_COMDT = lwa1-/BIC/ZP2_COMDT.

        lwa2-/BIC/ZP2_WOCUS = lwa1-/BIC/ZP2_WOCUS.

        lwa2-/BIC/ZP2_DINRR = lwa1-/BIC/ZP2_DINRR.

        lwa2-/BIC/ZP2_LAYLN = lwa1-/BIC/ZP2_LAYLN.

        lwa2-/BIC/ZP2_ABNLN = lwa1-/BIC/ZP2_ABNLN.

        lwa2-/BIC/ZP2_DINGB = lwa1-/BIC/ZP2_DINGB.

        lwa2-/BIC/ZP2_DIDIL = lwa1-/BIC/ZP2_DIDIL.

        lwa2-/BIC/ZDIG_VKF1 = lwa1-/BIC/ZDIG_VKF1.

        lwa2-BBP_GRFLAG     = lwa1-BBP_GRFLAG.

        lwa2-/BIC/ZP2_CFAW  = 'D'.

        append lwa2 to RESULT_PACKAGE.

      endif.

    endloop.

Thanks & Regards,

Ajay D

Image 2.JPG (29.9 kB)
Image 1.JPG (14.7 kB)
Image 1.JPG (14.7 kB)
Image 2.JPG (29.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Nov 04, 2015 at 10:14 AM

    When you are adding the new records in dso then you also need to increment the record number.

    If not then it will give error while activating the data.

    You can make use of this method CALL METHOD me->new_record__end_routine


    Please check this note 1223532 as well.


    Regards,

    AL

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi AL

      Thanks for your reply.

      I am facing error while loading data itself.

      for the first time fresh data load its successful. for the second time load i am facing this issue.

      Can you please suggest me where shall i insert the statement for increment the new record

      Thanks

      Ajay

  • avatar image
    Former Member
    Nov 04, 2015 at 10:08 AM

    Hi Ajay,

    Can you enable the Error stack and then run the DTP. This will help us in identifying the erroneous record.

    The error occurs due to the Fields in the select Query and the internal table fields are unsynchronized.

    please check the select query fields as well as internal table fields as  their assignment should be in proper way.

    Regards,

    Amit

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Amit,

      I tried to debug, while debugging simulation is success.I think when writing to DSO only problem occurs

      Regards,

      Ajay

  • Nov 04, 2015 at 10:11 AM

    Hi Ajay,

    You can re-active transformation and DTP and see if you can load the data without any issues.

    Regards,

    Vengal.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 04, 2015 at 11:31 AM

    Hi Ajay,

    Whenever you append any records to END_ROUTINE, you must increment your record number manually else there will error .....

    pls use below code... i have made changes to your code in BOLD.

    data : itab1 type standard table of /BIC/AZP2_ODIG00,

               lwa1 type /BIC/AZP2_ODIG00,

               itab2 type standard table of _ty_s_TG_1,

               lwa2 type _ty_s_TG_1,

               itab_target type standard table of _ty_s_TG_1.

    DATA: LV_count Type I.

        select * from  /BIC/AZP2_ODIG00 into table itab1.

    loop at RESULT_PACKAGE assigning <result_fields>.

          clear lwa1.

          read table itab1 into lwa1 with key

            /BIC/ZP2_AUFNR = <result_fields>-/BIC/ZP2_AUFNR

            /BIC/ZP2_AUFS1 = <result_fields>-/BIC/ZP2_AUFS1

            /BIC/ZP2_EQUNR = <result_fields>-/BIC/ZP2_EQUNR

            /BIC/ZP2_DICPO = <result_fields>-/BIC/ZP2_DICPO

            /BIC/ZP2_DISPN = <result_fields>-/BIC/ZP2_DISPN.

          if sy-subrc eq 0.

            <result_fields>-/BIC/ZP2_CFAW = 'A'.

          Else.

            <result_fields>-/BIC/ZP2_CFAW = 'N'.

          endif.

    Endloop.

        clear lwa1.

    Describe table RESULT_PACKAGE   lines LV_count.

    loop at itab1 into lwa1.

          clear lwa2.

          read table RESULT_PACKAGE into lwa2 with key

            /BIC/ZP2_AUFNR =  lwa1-/BIC/ZP2_AUFNR

            /BIC/ZP2_AUFS1 = lwa1-/BIC/ZP2_AUFS1

            /BIC/ZP2_EQUNR = lwa1-/BIC/ZP2_EQUNR

            /BIC/ZP2_DICPO = lwa1-/BIC/ZP2_DICPO

            /BIC/ZP2_DISPN = lwa1-/BIC/ZP2_DISPN.

          if sy-subrc ne 0.

            lwa2-/BIC/ZP2_AUFNR = lwa1-/BIC/ZP2_AUFNR.

            lwa2-/BIC/ZP2_AUFS1 = lwa1-/BIC/ZP2_AUFS1.

            lwa2-/BIC/ZP2_EQUNR = lwa1-/BIC/ZP2_EQUNR.

            lwa2-/BIC/ZP2_DICPO = lwa1-/BIC/ZP2_DICPO.

            lwa2-/BIC/ZP2_DISPN = lwa1-/BIC/ZP2_DISPN.

            lwa2-/BIC/ZP2_DIALR = lwa1-/BIC/ZP2_DIALR.

            lwa2-/BIC/ZP2_DIABY = lwa1-/BIC/ZP2_DIABY.

            lwa2-/BIC/ZP2_DIAPF = lwa1-/BIC/ZP2_DIAPF.

            lwa2-/BIC/ZP2_DIARC = lwa1-/BIC/ZP2_DIARC.

            lwa2-/BIC/ZP2_DIARD = lwa1-/BIC/ZP2_DIARD.

            lwa2-/BIC/ZP2_DIBNO = lwa1-/BIC/ZP2_DIBNO.

            lwa2-/BIC/ZP2_DICBY = lwa1-/BIC/ZP2_DICBY.

            lwa2-/BIC/ZP2_DICDT = lwa1-/BIC/ZP2_DICDT.

            lwa2-/BIC/ZP2_DICRN = lwa1-/BIC/ZP2_DICRN.

            lwa2-/BIC/ZP2_DICUS = lwa1-/BIC/ZP2_DICUS.

            lwa2-/BIC/ZP2_DIDFD = lwa1-/BIC/ZP2_DIDFD.

            lwa2-/BIC/ZP2_DIDET = lwa1-/BIC/ZP2_DIDET.

            lwa2-/BIC/ZP2_DIDAD = lwa1-/BIC/ZP2_DIDAD.

            lwa2-/BIC/ZP2_DIDCD = lwa1-/BIC/ZP2_DIDCD.

            lwa2-/BIC/ZP2_DIDIA = lwa1-/BIC/ZP2_DIDIA.

            lwa2-/BIC/ZP2_DIDLE = lwa1-/BIC/ZP2_DIDLE.

            lwa2-/BIC/ZP2_DIDMD = lwa1-/BIC/ZP2_DIDMD.

            lwa2-/BIC/ZP2_DIDRC = lwa1-/BIC/ZP2_DIDRC.

            lwa2-/BIC/ZP2_DIECO = lwa1-/BIC/ZP2_DIECO.

            lwa2-/BIC/ZP2_DIDNR = lwa1-/BIC/ZP2_DIDNR.

            lwa2-/BIC/ZP2_DIFLM = lwa1-/BIC/ZP2_DIFLM.

            lwa2-/BIC/ZP2_DIDIB = lwa1-/BIC/ZP2_DIDIB.

            lwa2-/BIC/ZP2_DIMAI = lwa1-/BIC/ZP2_DIMAI.

            lwa2-/BIC/ZP2_DIMAT = lwa1-/BIC/ZP2_DIMAT.

            lwa2-/BIC/ZP2_DIMCN = lwa1-/BIC/ZP2_DIMCN.

            lwa2-/BIC/ZP2_DIMFN = lwa1-/BIC/ZP2_DIMFN.

            lwa2-/BIC/ZP2_DILWD = lwa1-/BIC/ZP2_DILWD.

            lwa2-/BIC/ZP2_DIMWT = lwa1-/BIC/ZP2_DIMWT.

            lwa2-/BIC/ZP2_DIOWC = lwa1-/BIC/ZP2_DIOWC.

            lwa2-/BIC/ZP2_DIOWN = lwa1-/BIC/ZP2_DIOWN.

            lwa2-/BIC/ZP2_DITFL = lwa1-/BIC/ZP2_DITFL.

            lwa2-/BIC/ZP2_DISFA = lwa1-/BIC/ZP2_DISFA.

            lwa2-/BIC/ZP2_DISER = lwa1-/BIC/ZP2_DISER.

            lwa2-/BIC/ZP2_DIPSE = lwa1-/BIC/ZP2_DIPSE.

            lwa2-/BIC/ZP2_DITFO = lwa1-/BIC/ZP2_DITFO.

            lwa2-/BIC/ZP2_DIDDT = lwa1-/BIC/ZP2_DIDDT.

            lwa2-/BIC/ZP2_GSOND = lwa1-/BIC/ZP2_GSOND.

            lwa2-/BIC/ZP2_COMDT = lwa1-/BIC/ZP2_COMDT.

            lwa2-/BIC/ZP2_WOCUS = lwa1-/BIC/ZP2_WOCUS.

            lwa2-/BIC/ZP2_DINRR = lwa1-/BIC/ZP2_DINRR.

            lwa2-/BIC/ZP2_LAYLN = lwa1-/BIC/ZP2_LAYLN.

            lwa2-/BIC/ZP2_ABNLN = lwa1-/BIC/ZP2_ABNLN.

            lwa2-/BIC/ZP2_DINGB = lwa1-/BIC/ZP2_DINGB.

            lwa2-/BIC/ZP2_DIDIL = lwa1-/BIC/ZP2_DIDIL.

            lwa2-/BIC/ZDIG_VKF1 = lwa1-/BIC/ZDIG_VKF1.

            lwa2-BBP_GRFLAG     = lwa1-BBP_GRFLAG.

            lwa2-/BIC/ZP2_CFAW  = 'D'.

    LWA2-record = LV_count + 1.

            append lwa2 to RESULT_PACKAGE.

          endif.

        endloop.

    *** pls ensure presence of record field inside internal table LWA2...

    Regards,

    Hitesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 04, 2015 at 04:37 PM

    Hi Ajay!

    Please mark a break-point and check your Result_Package.

    I think only need add and populate 0RECORD and DATAPACKID.

    Regards.

    Frank.

    Add comment
    10|10000 characters needed characters exceeded