Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ME_PROCESS_REQ_CUST accounting data

Former Member
0 Likes
3,398

Hi All,

Can you please let me know how to access the accounting data i.e. cost center in the method check or post.

I need to put validation on Check on cost center.

Please some sample code f you have.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,488

Hi,Juheb,

Please validate your accounting data  in inside CHECK method.

you can use below  sample code. this code is written for ME_PROCESS_PO_CUST

Regards,

Prasenjit

INCLUDE mm_messages_mac.

DATA: ls_ACCOUNT    TYPE MEPOACCOUNTING,
ltb_account   type table of MEPOACCOUNTING,
ltb_meaccount type PURCHASE_ORDER_ACCOUNTINGS,
ls_meaccount  type PURCHASE_ORDER_ACCOUNTING,
ls_mepohead   TYPE MEPO_HEADER,
ltb_mepoitem  type PURCHASE_ORDER_ITEMS,
lwa_item      TYPE purchase_order_item,
lwa_item_data TYPE mepoitem.

CALL METHOD im_header->get_previous_data
IMPORTING
ex_data = ex_data
EXCEPTIONS
no_data = 1.

ls_mepohead = im_header->get_data( ).
ltb_mepoitem = im_header->get_items( ).

REFRESH: ltb_item_data, ltb_account.

LOOP AT ltb_mepoitem INTO lwa_item.
"   Read each PO item data
lwa_item_data = lwa_item-item->get_data( ).
clear: ltb_meaccount, ls_meaccount.
ltb_meaccount = lwa_item-ITEM->GET_ACCOUNTINGS( ).
loop at ltb_meaccount into ls_meaccount.
ls_account = ls_meaccount-ACCOUNTING->GET_DATA( ).

Validate here your code.
append ls_account to ltb_account.
clear: ls_account.
endloop.

Endloop.

8 REPLIES 8
Read only

Former Member
0 Likes
2,489

Hi,Juheb,

Please validate your accounting data  in inside CHECK method.

you can use below  sample code. this code is written for ME_PROCESS_PO_CUST

Regards,

Prasenjit

INCLUDE mm_messages_mac.

DATA: ls_ACCOUNT    TYPE MEPOACCOUNTING,
ltb_account   type table of MEPOACCOUNTING,
ltb_meaccount type PURCHASE_ORDER_ACCOUNTINGS,
ls_meaccount  type PURCHASE_ORDER_ACCOUNTING,
ls_mepohead   TYPE MEPO_HEADER,
ltb_mepoitem  type PURCHASE_ORDER_ITEMS,
lwa_item      TYPE purchase_order_item,
lwa_item_data TYPE mepoitem.

CALL METHOD im_header->get_previous_data
IMPORTING
ex_data = ex_data
EXCEPTIONS
no_data = 1.

ls_mepohead = im_header->get_data( ).
ltb_mepoitem = im_header->get_items( ).

REFRESH: ltb_item_data, ltb_account.

LOOP AT ltb_mepoitem INTO lwa_item.
"   Read each PO item data
lwa_item_data = lwa_item-item->get_data( ).
clear: ltb_meaccount, ls_meaccount.
ltb_meaccount = lwa_item-ITEM->GET_ACCOUNTINGS( ).
loop at ltb_meaccount into ls_meaccount.
ls_account = ls_meaccount-ACCOUNTING->GET_DATA( ).

Validate here your code.
append ls_account to ltb_account.
clear: ls_account.
endloop.

Endloop.

Read only

0 Likes
2,488


Thank you Prasenjit.

I am trying to modify the above code for ME_PROCESS_REQ_CUST but I am getting dump.

Can you please provide me the code for CHECK method of ME_PROCESS_REQ_CUST.

I will be very thankful to you.

Read only

0 Likes
2,488

Hi Juheb,

Please validate your code in the methodf check as mention in  below thread.

Regards,

Prasenjit

Read only

0 Likes
2,488

Hi Prasenjit,

Thank you for your reply.

I have written below code in Check method as per the given thread but I am getting short dump saying '  Access via 'NULL' object reference not possible.'

Please check if i m doing something wrong. your reply will be highly appreciated.

DATA: l_account_list TYPE mmpur_accounting_list,

           l_account_line TYPE mmpur_accounting_type,

           ls_exkn TYPE exkn.

  DATA i_items   TYPE  mmpur_requisition_items.

  DATA: wa_item LIKE LINE OF i_items,

        lv_if_item TYPE REF TO if_purchase_requisition_item,

        lt_itm_data TYPE mereq_item.


  CALL METHOD lv_if_item->if_acct_container_mm~get_items

    RECEIVING

      re_items = l_account_list.

  CHECK l_account_list IS NOT INITIAL.

  LOOP AT l_account_list INTO l_account_line.


    CALL METHOD l_account_line-model->get_exkn

      RECEIVING

        re_exkn = ls_exkn.

  ENDLOOP.

Read only

0 Likes
2,488

Hi Juheb,

Please try to debug and check where system get null value for that reference object.

once you identify then please  validate the value after that you can pass.

Regards,

Prsenjit

Read only

0 Likes
2,488

Execute the get_items method on the receivec IM_HEADER parameter, and not a local variable/reference noy yet assigned, also the internal table of items received contain ITEMs which are REF TO IF_PURCHASE_REQUISITION_ITEM, etc.

Regards,

Raymond

Read only

0 Likes
2,488

Hi Prasenjit/Raymond,

Thank you for your replies. I am now able to get the accounting data in CHECK method.

but I am getting only single entry in l_account_list, though I am creating PR with multiple line items.

Its picking only last line items accounting data.

Please help.

Read only

0 Likes
2,488

Can you confirm/infirm that "im_header->GET_ITEMS" returns only one record in "RE_ITEMS" itab (with ITEM field) or that during the "LOOP AT RE_ITEMS INTO lr_item." the "lr_item-item->if_acct_container_mm~get_items returns" returns only on record in its own "RE_ITEMS" itab (with MODEL field on which you apply GET_EXKN method)  ?

Regards,

Raymond