BaDI ME_PROCESS_REQ_CUST — Accessing Local Class from Global Class

I’ve gotten new functional spec from my functional teams, in this requirements, I have to fill value into EBAN-FISTL ( Fund Center ) in Account Assignment tab — ME51N tcode , I believe you have known number of enhancement for these tcode ( ME51N/ME52N) , I choose BaDI ME_PROCESS_REQ_CUST ( Enhancements for Processing Enjoy PReqs: Customer) and  PROCESS_ITEM method for handling it.

I hope you are already familiar how to implement BaDI enhancement, as you know in this PROCESS_ITEM method have MEREQ_ITEM structure and i need to input value to FISTL field ( fund center ) in order this value will be saved to EBAN table.

After write ABAP code and test my enhancement code. so far nothing any error display, but EBAN-FISTL still empty, after debug this enhancement  in OOP ABAP and exploring clue to solve this problem, suddenly i remember one article about how to accessing local class within global class..

local_Class

Note: im_item (TYPE REF TO if_purchase_requisition_item) is instantiated as local class of function group MEREQ. However, after casting to the ROOT object (lo_obj) the public attribute MY_STATE (TYPE REF TO lcl_req_item_state) is accessible, at least in the debugger but not in the coding. and if you go to SE80 and open MEREQ Function Group and then you can’t missed all of local class on it, as you can see picture below.

local_class_mereq-300x300

Look at a picture, these local class could be used to solve my requirement, at this time go to LCL_ACCT_CONTAINER because FISTL field is own by COBL ( Coding Block ).

Note : You can experiment with other class as your own requirement.

Expanding LCL_ACCT_CONTAINER node and check in Method Definitions, and there are two method that get my attention i.e : GET_COBL and SET_COBL.

LTY_T_COBL refer to COBL, if you check into COBL you’ll found FISTL ( Fund Center ), ok these methed is exactly i need.

Below my full source code to populate Account Assignment in ME51N/ME52N.

Ok this is my short article today about ABAP, i hope this article could be a solution if you meet same problem.

me52n

Leave a Reply

Your email address will not be published. Required fields are marked *