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

Accessing Account assignment in P.Req BADI -PROCESS_REQ_CUST~PROCESS_HEADER

former_member125661
Contributor
0 Likes
2,312

I have implemented a BADI for Purchase requisition and in PROCESS_HEADER method of BADI Implementation for ME_PROCESS_REQ_CUST. I am trying to access account assignment lines on the purchase requisition (EKBN).

IM_HEADER is the only parameter available for me. But I am able to access the items indirectly via get_items method in its interface.

method IF_EX_ME_PROCESS_REQ_CUST~PROCESS_HEADER.

 DATA: l_item_list TYPE mmpur_requisition_items,
       l_item_listx type mereq_itemx,
      l_item      TYPE mmpur_requisition_item,
      l_item_akt  TYPE mereq_item,
      l_item_account type MMPUR_ACCOUNTING_LIST,
      l_item_ref  TYPE REF TO if_purchase_requisition_item.

data :  lt_preq_items type standard table of mereq_item .

  FIELD-SYMBOLS:
    <lo_lcl>        TYPE ANY,
    <ls_item>       TYPE mereq_item,
    <ls_itemx>      TYPE mereq_itemx,
    <item>          TYPE mmpur_requisition_item.

  " Get items of purchase requisition
   l_item_list = im_header->get_items( ).

  check IM_COUNT <= 1 .

* Logic for approver determination goes here .
   LOOP AT l_item_list ASSIGNING <item>.
    l_item_akt = <item>-item->get_data( ).
    break-point.
*   l_item_account = <item>-item->get_items( ).

    append l_item_akt to lt_preq_items[].
  ENDLOOP.

I am able to collect all the items of the p.req (i.e EBAN entries) in lt_preq_items .

Now, my challege is to use get_items() method inside

IF_ACCT_CONTAINER_MM~GET_ITEMS ( Return Account Assignment Objects ) which is inside IF_PURCHASE_REQUISITION_ITEM interface.

A simple l_item_account = <item>-item->get_items( ) resulted in syntax error. How can I get account assignment objects inside this process header BADI of purchase requisition ? Any useful tips is greatly appreciated.

Regards,

Shareen

Edited by: Shareen Hegde on Jan 27, 2012 12:29 AM

1 REPLY 1
Read only

Former Member
0 Likes
1,226

Hi,

DATA: l_item_list TYPE mmpur_requisition_items,

l_item_listx type mereq_itemx,

l_item TYPE mmpur_requisition_item,

l_item_akt TYPE mereq_item,

l_item_account type MMPUR_ACCOUNTING_LIST,

l_item_ref TYPE REF TO if_purchase_requisition_item.

data : lt_preq_items type standard table of mereq_item .

FIELD-SYMBOLS:

<lo_lcl> TYPE ANY,

<ls_item> TYPE mereq_item,

<ls_itemx> TYPE mereq_itemx,

<item> TYPE mmpur_requisition_item.

" Get items of purchase requisition

l_item_list = im_header->get_items( ).

check IM_COUNT <= 1 .

  • Logic for approver determination goes here .

LOOP AT l_item_list ASSIGNING <item>.

l_item_akt = <item>-item->get_data( ).

break-point.

*litem_account = <item>-item->IF_ACCT_CONTAINER_MM~GET_ITEMS( ).*_

append l_item_akt to lt_preq_items[].

ENDLOOP.

Check with the above code for l_item_account .

Thanks,

Shailaja Ainala.