on 05-10-2009 2:36 AM
Hi Folks
My requirement is to take good recs to DSO and write bad recs to error stack. I am unable to write the bad record to error stack with following code. If I put raise exception the entire request is turning red.
I have following code in the start routine.
LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.
IF <SOURCE_FIELDS>-/BIC/ZMF_PATNO ='BAD-REC'.
MONITOR_REC-MSGID = 'ZRSM'.
MONITOR_REC-MSGTY = 'W'.
MONITOR_REC-MSGNO = '000'.
MONITOR_REC-MSGV1 = 'Master Data not'.
MONITOR_REC-MSGV2 = 'available for material'.
MONITOR_REC-MSGV3 = <SOURCE_FIELDS>-/BIC/ZMF_PATNO.
MONITOR_REC-SKIPPED = 'X'.
APPEND MONITOR_REC TO MONITOR.
DELETE SOURCE_PACKAGE.
raise exception type CX_RSROUT_SKIP_RECORD.
ENDIF.
ENDLOOP.
In my DTP I have a setting "Valid REcords Update, Reporting possible(request Green)"
Hi Poonam,
Just by defining an attribute as bad a record will not be bad.
It wont go to the error stack.
Moreover from your code it seems you are deleting a record after defining as bad.
Chk this link.
http://help.sap.com/saphelp_nw70/helpdata/EN/42/fa1acfcf2c1aa2e10000000a422035/frameset.htm
YOu will need to have a scenario as mentioned in the link to move records to the error stack.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mansi
Yes for my testing I have taken a attribute and trying to validate it, eventually I will have more complex logic. My goal is to have my business logic and validate the records and if invalid I want to write it on error stack. Then reprocess it next day. Currently I am focusing on how I can push the record to erro stack.
Poonam
Hi Mansi
Now my code looks as follows and still I am unable to write the bad record to the error stack.
LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.
IF <SOURCE_FIELDS>-/BIC/ZMF_PATNO ='BAD-REC'.
MONITOR_REC-MSGID = 'ZRSM'.
MONITOR_REC-MSGTY = 'W'.
MONITOR_REC-MSGNO = '000'.
MONITOR_REC-MSGV1 = 'Master Data not'.
MONITOR_REC-MSGV2 = 'available for material'.
MONITOR_REC-MSGV3 = <SOURCE_FIELDS>-/BIC/ZMF_PATNO.
MONITOR_REC-SKIPPED = 'X'.
APPEND MONITOR_REC TO MONITOR.
DELETE SOURCE_PACKAGE.
raise exception type CX_RSROUT_SKIP_RECORD.
ENDIF.
ENDLOOP.
Hi Mansi
I finally figured it out. There were some posts which mentioned that "RECNO" field should be filled if we try to write to error stack in start routine.
This is working code, I had to put the Delete statement or else the record is going to my DSO. I am closing this thread. Thanks for your help!!
LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.
IF <SOURCE_FIELDS>-/BIC/ZMF_PATNO ='BAD-REC'.
MONITOR_REC-MSGID = 'ZRSM'.
MONITOR_REC-MSGTY = 'E'.
MONITOR_REC-MSGNO = '000'.
MONITOR_REC-MSGV1 = 'Master Data not'.
MONITOR_REC-MSGV2 = 'available for material'.
MONITOR_REC-MSGV3 = <SOURCE_FIELDS>-/BIC/ZMF_PATNO.
MONITOR_REC-SKIPPED = 'X'.
MONITOR_REC-RECNO = sy-tabix."This statement is very important
APPEND MONITOR_REC TO MONITOR.
DELETE SOURCE_PACKAGE.
raise exception type CX_RSROUT_SKIP_RECORD.
ENDIF.
ENDLOOP.
regards
Poonam
User | Count |
---|---|
77 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.