I am running this BADI in the IF_EX_ME_PROCESS_REQ_CUST~PROCESS_ACCOUNT interface. My code is pasted below. I am able to retrieve our the GL Account Number from the cross-reference table and move it to wa_exkn-sakto. However, SAP issues a message that the GL Account need to be entered, thinking that it is not there. It is on the screen, and also in wa_exkn-sakto when I return to the Req screen after the BADI executes.
I am thinking that since SAP does not regognize it as being populated, or, on the screen, I have to move it somewhere else as well. The commented out code was a test to see if somehow I need to introduce MEACCT1100-SAKTO into my logic.
Thank-You.
METHOD if_ex_me_process_req_cust~process_account.
**************************************************************************
* D A T A *
**************************************************************************
DATA: wa_exkn TYPE exkn,
wa_exknx TYPE mepoaccounting_datax,
wa_item TYPE mereq_item,
wa_itemref TYPE REF TO if_purchase_requisition_item,
wa_exkn_hold TYPE exkn,
wa_exknx_hold TYPE mepoaccounting_datax,
wa_item_hold TYPE mereq_item,
wa_itemref_hold TYPE REF TO if_purchase_requisition_item.
**************************************************************************
* P R O C E S S I N G *
**************************************************************************
IF im_count = 1.
CLEAR:wa_exkn_hold,
wa_exknx_hold,
wa_item_hold,
wa_itemref.
ENDIF.
CLEAR: wa_exkn,
wa_exknx,
wa_item,
wa_itemref.
***********************************************
* get account classification data *
***********************************************
CALL METHOD im_account->get_exkn
RECEIVING
re_exkn = wa_exkn.
move wa_exkn to wa_exkn_hold.
CALL METHOD im_account->get_exknx
RECEIVING
re_exknx = wa_exknx.
move wa_exknx to wa_exknx_hold.
***********************************************
* get item data *
***********************************************
CALL METHOD im_account_ref->get_item
RECEIVING
re_item = wa_itemref.
move wa_itemref to wa_itemref_hold.
CALL METHOD wa_itemref->get_data
RECEIVING
re_data = wa_item.
move wa_item to wa_item_hold.
MOVE wa_item TO wa_item_hold.
***********************************************
* Get the Gl Account Number if needed *
***********************************************
DATA: ls_z4ppi_glmap TYPE z4ppi_glmap.
IF wa_exkn-sakto IS INITIAL AND
( wa_item-knttp = 'F' OR
wa_item-knttp = 'K' ).
SELECT SINGLE * FROM z4ppi_glmap
INTO ls_z4ppi_glmap
WHERE zzmatkl = wa_item-matkl AND
zzacc_assign = wa_item-knttp.
IF sy-subrc = 0.
MOVE ls_z4ppi_glmap-zzacc_no TO wa_exkn-sakto.
* move ls_z4ppi_glmap-zzacc_no to MEACCT1100-SAKTO.
ENDIF.
ENDIF.
** Cuenta Mayor
*field-symbols <fs_sakto> type meacct1100-sakto.
* Utilizo el truco de asignar el programa de control y el campo al field
*move wa_exkn-sakto to SAPLMEACCTVI-MEACCT1100-SAKTO. "' to <fs_sakto>.
*assign ('(SAPLMEACCTVI)MEACCT1100-SAKTO') to <fs_sakto>.
*if <fs_sakto> ne wa_exkn-sakto.
*endif.
***********************************************
* set the GL Account Number *
***********************************************
CALL METHOD im_account->set_exkn
EXPORTING
im_exkn = wa_exkn.
CALL METHOD im_account->set_exknx
EXPORTING
im_exknx = wa_exknx.
endmethod.