Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

In ME_PROCESS_PO_CUST badi how to get previous rows value?

hi Friends,

I am Using ME_PROCESS_PO_CUST badi for validation in Purchase order (ME21N),

For that I implemented PROCESS_ITEM method which fires during each row now i want to add another validation in same implementation for that i need previous row's value so how to get that value ?

following is my current validation code.

method IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM.

DATA:ls_poitem TYPE mepoitem.

DATA:ls_poheader TYPE MEPOHEADER.

DATA:lm_poheader TYPE ref to IF_PURCHASE_ORDER_MM.

DATA:w_mara TYPE mara.

DATA:IT_ZMMTBL039 TYPE STANDARD TABLE OF ZMMTBL039 ,

WA_ZMMTBL039 TYPE ZMMTBL039 .

DATA:ls_poitem1 TYPE mepoitem.

DATA:V_KUNNR1 TYPE KNA1-KUNNR.

DATA:V_KUNNR2 TYPE KNA1-KUNNR.

ls_poitem = im_item->get_data( ).

lm_poheader = im_item->GET_HEADER( ).

ls_poheader = lm_poheader->GET_DATA( ).

CLEAR: WA_ZMMTBL039,w_mara.

REFRESH:IT_ZMMTBL039[] .

SELECT *

INTO TABLE IT_ZMMTBL039

FROM ZMMTBL039

WHERE bsart EQ ls_poheader-bsart.

IF sy-subrc EQ 0.

CLEAR: WA_ZMMTBL039,w_mara.

SELECT SINGLE *

INTO w_mara

FROM mara

WHERE matnr EQ ls_poitem-MATNR.

IF SY-SUBRC EQ 0.

READ TABLE IT_ZMMTBL039 INTO WA_ZMMTBL039 WITH KEY bsart = ls_poheader-bsart

mtart = w_mara-mtart

spart = w_mara-spart.

IF SY-SUBRC NE 0.

MESSAGE E009(zparts) WITH ls_poitem-MATNR w_mara-spart ls_poheader-bsart .

ENDIF.

ENDIF.

ENDIF.

endmethod.

Former Member
Former Member replied

import F1 F2 from memory id 'MEM01'.

if sy-subrc eq 0.

{

}

*at the end export current line-

export F1 F2 to memory id 'MEM01'

note-

f1,f2 are fields u want to store in memory

use <b>'free memory id 'MEM01'</b> to free memory space. at last

reward points if useful

Regards

Megha

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question