Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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 (29884 B)
Image 1.JPG (14741 B)
Former Member
Not what you were looking for? View more on this topic or Ask a question