‎2012 Feb 27 3:23 PM
Hi All,
I have implemented the BADI ME_PROCESS_PO_CUST for one of my requirements.
The following code is written in the method PROCESS_SCHEDULE
CALL METHOD IM_SCHEDULE->SET_DATA
EXPORTING
IM_DATA = MEPOSCHEDULE.
I want to call the same code to update the schedule line items in the method PROCESS_ACCOUNT, based onsome modifications.
Please let me know how can this be achieved.
Regards,
Dawood
‎2012 Feb 27 3:55 PM
Hi,
You have many ways to do that.. one of them is to make one global variable on a public section
DATA: LT_SCHEDULES TYPE PURCHASE_ORDER_SCHEDULES,
LS_SCHEDULES LIKE LINE OF LT_SCHEDULES.
DATA: G_SCHEDULE TYPE MEPOSCHEDULE.On PROCESS_ITEM or PROCESS_SCHEDULE you can feed this variable like:
CALL METHOD LS_SCHEDULES-SCHEDULE->GET_DATA
RECEIVING
RE_DATA = G_SCHEDULE.Now you have a global schedule, you can update it any time, doing this:
CALL METHOD LS_SCHEDULES-SCHEDULE->SET_DATA
EXPORTING
IM_DATA = G_SCHEDULE.But on some cases that i had, i need to use abap memory access (for schedule).. like this:
ls_type_sy_tcode = '(SAPLMEPO)ETT[]'.
ASSIGN (ls_type_sy_tcode) TO <fs_ett>.
lt_ett[] = <fs_ett>[].
...
"Work on lt_ett
...
<fs_ett>[] = lt_ett[].Hope its helpfull, any doughts just ask and i try to answer
Regards,
Júlio Tavares
‎2012 Feb 28 4:50 AM
Hello Julio,
I created the global variables in public section.
When I wrote the code mentioned, I got a runtime error "Access via 'NULL' object reference not possible.".
Please guide.
Regards.
‎2012 Feb 28 5:04 AM
hi ,
method if_ex_me_process_po_cust~process_account .
data: ls_mepoaccounting type mepoaccounting .
ls_mepoaccounting = im_account->get_data( ).
" MOdify columns of ls_mepoaccounting as per your requirment and use set_data .
call method im_item->set_data
exporting
im_data =ls_mepoaccounting.regards
Deepak.
‎2012 Feb 28 5:09 AM
Hi Deepak,
Thanks, but, I want to modify the schedule line items , not the accounting details, in PROCESS_ACCOUNT.
Regards.
‎2012 Feb 28 5:25 AM
hi,
This is for process_scheduel
data : ls_meposchedule TYPE meposchedule .
ls_meposchedule = im_schedule>get_data( ).if you want ot update in process_account then check in im_account which are other methods to get schedule line data
such as Get_data() for accounting information .
ls_mepoaccounting = im_account->get_data( ).
regards
Deepak.
Edited by: Deepak Dhamat on Feb 28, 2012 6:25 AM
Edited by: Deepak Dhamat on Feb 28, 2012 6:28 AM
‎2012 Feb 28 6:47 AM
Hi,
Just to add more if you want to access schedule items in process_account menthod....
DATA : im_item TYPE REF TO if_purchase_order_item_mm.
DATA : schedule TYPE purchase_order_schedules,
ls_schedule_itm type purchase_order_schedule.
DATA : schedule_itm TYPE MEPOSCHEDULE..
*Get the item details
CALL METHOD im_account->get_item " get item
RECEIVING
re_item = im_item.
*Get Schedules
CALL METHOD im_item->get_schedules
RECEIVING
re_schedules = schedule.
*Get schedule
READ TABLE schedule INTO ls_schedule_itm INDEX 1.
*Get actual data
CALL METHOD ls_schedule_itm-schedule->get_data
RECEIVING
re_data = schedule_itm.
Schedule_itm has the schedule line item data.....
Regards,
Deepak.