on 11-04-2015 10:01 AM
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:
Message no. RSM2716
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.
The processing of the data package is terminated.
Copy the data record number (field RECORD) from the original data record into the new data record.
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.
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P2_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
Hi Ajay!
Please mark a break-point and check your Result_Package.
I think only need add and populate 0RECORD and DATAPACKID.
Regards.
Frank.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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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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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ajay,
You can re-active transformation and DTP and see if you can load the data without any issues.
Regards,
Vengal.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.