2014 Jan 21 12:26 PM
Good morning Gurus.
I want to know how to connect an error message that is in the 't_return' to the corresponding item number to generate the ALV for the user.
CALL FUNCTION 'BAPI_CONTRACT_CHANGE'
EXPORTING
purchasingdocument = v_purchasingdocument
TABLES
item = t_item
itemx = t_itemx
item_text = t_item_text
return = t_return.
For example:T_item has 10 itens and t_return have 2 errors How do I know which of the 10 items are in error.
Please see attach.
Thanks Gurus.
2014 Jan 21 12:31 PM
Normally in case it is realted to any line then in variable MSG_V1/MSG_V2/MSG_V3/MSG_V4 in either one of these you will find the item number
2014 Jan 21 12:31 PM
Normally in case it is realted to any line then in variable MSG_V1/MSG_V2/MSG_V3/MSG_V4 in either one of these you will find the item number
2014 Jan 22 1:16 PM
2014 Jan 22 1:40 PM
Yes use BAPIRET2-ROW, you may also use BAPIRET2-FIELD to give a better report to user in case the value of the field is not in one of the four MESSAGE_V* fields.
IF bapiret2-field IS NOT INITIAL.
ASSIGN COMPONENT (bapiret2-field) OF STRUCTURE bapiitemstructure TO <FS>.
IF sy-subrc EQ 0.
MOVE bapiret2-field TO columnerrorfieldname.
WRITE <fs> TO columnerrorfieldvalue.
ENDIF.
ENDIF.
Eventually use a call of CL_ABAP_TYPEDESCR->DESCRIBE_BY_NAME or other tool to give the field name (e.g. "plant invalid", "PLT1)
| Line | Field | Value | Message |
|---|---|---|---|
| 10 (BAPIRET2-ROW) | Storage Location (from BAPIRET2-FIELD) | XXXX (from ASSIGN) | Error message (BAPIRET2-MESSAGE) |
Regards,
Raymond
2014 Mar 05 2:36 PM
Hello,
I am currently maintaining a program using BAPI_CONTRACT_CHANGE, where the messages in the RETURN table are associated to the relevant contract item using the ROW column, and it seems that it does not work in case of deleted items.
The contract looks like this:
The messages for items 6800 and 6810 have return-row = 2,
the message for item 6830 has return-row = 5.
These row ids are the ids of the previous non-deleted row, but it results in an incorrect mapping.
I guess I have to switch to the other osolution, i.e. searching for the item id in MSG_V1/MSG_V2/MSG_V3/MSG_V4.
Any other idea?
Thanks in advance,
Magalie