on 2023 Dec 13 7:26 AM
Hello, experts
I created report which creates BO for RAP application. Report uploads records from file and then creates BO via MODIFY ENTITY ... CREATE
Report creates records one by one and after each MODIFY report executes COMMIT ENTITIES RESPONSE OF ... REPORTED FAILED
I debugged behavior implementation and have seen that records were not sent one by one looks like record were sent all. And problem is that I want to send it one by one so that good records should be saved but bad records should be returned as reported and failed with messages. And also I noted that records are saved to DB while bad records are came, after that no records are saved to DB.
Question is how to send records to MODIFY one by one and clear records which were sent before.
Code sample below
LOOP AT it_items ASSIGNING FIELD-SYMBOL(<line>).
ASSIGN <line>->* TO <item>.
MODIFY ENTITIES OF zi_xpl_link_stores_rtp
ENTITY storeslink
CREATE FIELDS ( teamid distrchanextid salesorgextid storezoneid extraplacementid extstoreid explpriority )
WITH VALUE #(
( %cid = |{ <item>-teamid } { <item>-distrchanextid } { <item>-salesorgextid } { <item>-storezoneid } { <item>-extraplacementid } { <item>-extstoreid } { <item>-explpriority }|
teamid = <item>-teamid
distrchanextid = <item>-distrchanextid
salesorgextid = <item>-salesorgextid
storezoneid = <item>-storezoneid
extraplacementid = <item>-extraplacementid
extstoreid = <item>-extstoreid
explpriority = <item>-explpriority ) ).
COMMIT ENTITIES RESPONSE OF zi_xpl_link_stores_rtp REPORTED DATA(ls_reported) FAILED DATA(ls_failed).
* LOOP AT ls_reported-storeslink ASSIGNING FIELD-SYMBOL(<storelink>).
*
* INSERT VALUE #( teamid = <item>-teamid
* distrchanextid = <item>-distrchanextid
* salesorgextid = <item>-salesorgextid
* storezoneid = <item>-storezoneid
* extraplacementid = <item>-extraplacementid
* extstoreid = <item>-extstoreid
* explpriority = <item>-explpriority ) INTO TABLE mt_results
* ASSIGNING FIELD-SYMBOL(<result>).
*
* <result>-error ?= <storelink>-%msg.
* ENDLOOP.
* LOOP AT ls_mapped-storeslink ASSIGNING FIELD-SYMBOL(<mapped>).
*
* MESSAGE s028(zmi) INTO DATA(dummy).
*
* INSERT VALUE #( teamid = <item>-teamid
* distrchanextid = <item>-distrchanextid
* salesorgextid = <item>-salesorgextid
* storezoneid = <item>-storezoneid
* extraplacementid = <item>-extraplacementid
* extstoreid = <item>-extstoreid
* explpriority = <item>-explpriority ) INTO TABLE mt_results ASSIGNING <result>.
*
* INSERT VALUE bapiret2( type = sy-msgty
* id = sy-msgid
* number = sy-msgno
* message_v1 = sy-msgv1
* message_v2 = sy-msgv2
* message_v3 = sy-msgv3
* message_v4 = sy-msgv4 ) INTO TABLE <result>-messages.
*
* ENDLOOP.
ENDLOOP.
Thank you in advance.
User | Count |
---|---|
57 | |
11 | |
7 | |
6 | |
6 | |
6 | |
6 | |
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.