When you use MB_MIGO_BADI Method Check_Item you can’t get all line item data, as you see on below screenshot.
As you can see, in CHECK_ITEM Method only have 2 parameter I_LINE_ID and ET_BAPIRET2 , you can’t get all line items data in CHECK_ITEM Method.
So you need to use Method LINE_MODIFY, but before that you need add 2 Attributes in Class of Enhancement Implementation, for this sample we use class
You need to add 2 Attributes to store data line items in method LINE_MODIFY, so you can read data line items from CHECK_ITEM Method.
ABAP Source code in method LINE_MODIFY to store data all line items to GT_GOITEM.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
METHOD if_ex_mb_migo_badi~line_modify. IF gt_goitem[] IS NOT INITIAL. READ TABLE gt_goitem INTO gs_goitem WITH KEY zeile = cs_goitem-zeile. IF sy-subrc NE 0. APPEND cs_goitem TO gt_goitem. ELSE. MODIFY gt_goitem FROM cs_goitem INDEX sy-tabix. ENDIF. ELSE. APPEND gs_goitem TO gt_goitem. ENDIF. ENDMETHOD. |
ABAP Source code in method CHECK_ITEM
1 2 3 |
LOOP AT gt_goitem INTO gs_goitem WHERE take_it IS NOT INITIAL. "--Your ABAP Code ENDLOOP. |
Then don’t forget to add clear GT_GOITEM in method POST_DOCUMENT.
1 |
CLEAR : gt_goitem[]. |