cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in end routine

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (5)

Answers (5)

fcorodriguezl
Contributor
0 Kudos

Hi Ajay!

Please mark a break-point and check your Result_Package.

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

Regards.

Frank.

former_member183519
Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Hitesh,

Thanks for your reply...

I tried out your suggestion..still not working its giving same error.

Thanks

Ajay.D

Former Member
0 Kudos

Hi Ajay,

One quick question. You mentioned that if the record is deleted then you are marking it as D and for new record it's A. How are you identifying if the record is deleted? The logic is if the record is new then it can also be taken as deleted record.

My point is how do you decide if the record is deleted ?

Thanks,

Krishna.

former_member183519
Contributor
0 Kudos

Hello Ajay,

Can you do small change in code..

change lv_count type declaration .


  DATA: LV_count Type RSARECORD.

give a try!!! let us know..

Regards,

Hitesh

anshu_lilhori
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

former_member186053
Active Contributor
0 Kudos

Hi Ajay,

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

Regards,

Vengal.

Former Member
0 Kudos

Hi Vengal,

Thanks for your reply..

No use in activating TRFN and DTP

Regards

Ajay

former_member220624
Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Amit,

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

Regards,

Ajay