Skip to Content
0
Former Member
May 02, 2007 at 11:08 AM

BAPI_INCOMINGINVOICE_CREATE multiple Account assignment problem

2939 Views

Hi Friends,

I am using BAPI: BAPI_INCOMINGINVOICE_CREATE to create Invoice for respective service entry sheet of Purchase order.

In PO level I am having multiple account assignments, So while creating invoice I need to handle this in BAPI, can you help to populate the revalent data for account assignment,.

Code: for account asignment in BAPI

LOOP AT t_po_item.

  • Populate payable invoice items with service entry sheet

w_gross = w_gross + t_po_item-zpinamt.

li_item_pay-invoice_doc_item = li_item_pay-invoice_doc_item + 1.

li_item_pay-po_number = t_po_item-ebeln.

li_item_pay-po_item = t_po_item-ebelp.

li_item_pay-item_amount = t_po_item-zpinamt.

li_item_pay-sheet_no = t_po_item-lblni. " service entry sheet

APPEND li_item_pay.

  • Populate retainage invoice items with service entry sheet

w_ret_gross = w_ret_gross + t_po_item-zrtamt.

li_item_ret-invoice_doc_item = li_item_ret-invoice_doc_item + 1.

li_item_ret-po_number = t_po_item-ebeln.

li_item_ret-po_item = t_po_item-ebelp.

li_item_ret-item_amount = t_po_item-zrtamt.

li_item_ret-sheet_no = t_po_item-lblni. " service entry sheet

APPEND li_item_ret.

  • Get the details with ref to service entry sheet

CALL FUNCTION 'BAPI_ENTRYSHEET_GETDETAIL'

EXPORTING

entrysheet = t_po_item-lblni

  • LONG_TEXTS = ' '

  • IMPORTING

  • ENTRYSHEET_HEADER =

TABLES

entrysheet_account_assignment = lit_po_acct

entrysheet_services = lit_serpo_acc

entrysheet_srv_accass_values = lit_ser_acc.

lv_act_item = lv_act_item + 1.

LOOP AT lit_po_acct.

  • populate the account asignment data for Payable Invoice

IF NOT lit_po_acct-accass_val IS INITIAL.

lit_pay_acct_asgn-invoice_doc_item = lv_act_item.

lit_pay_acct_asgn-serial_no = lit_pay_acct_asgn-serial_no + 1.

lit_pay_acct_asgn-item_amount = ( t_po_item-zpinamt * lit_po_acct-PERCENTAGE ) / 100. " pass the amount at PO retainge level

lit_pay_acct_asgn-profit_ctr = lit_po_acct-profit_ctr.

lit_pay_acct_asgn-co_area = lit_po_acct-co_area.

lit_pay_acct_asgn-network = lit_po_acct-network.

lit_pay_acct_asgn-activity = t_po_item-vornr.

lit_pay_acct_asgn-CMMT_ITEM = lit_po_acct-cmmt_item_long.

  • lit_pay_acct_asgn-CMMT_ITEM_LONG = lit_po_acct-cmmt_item_long.

lit_pay_acct_asgn-gl_account = lit_po_acct-gl_account.

lit_pay_acct_asgn-tax_code = lit_po_acct-tax_code.

lit_pay_acct_asgn-costcenter = lit_po_acct-costcenter.

APPEND lit_pay_acct_asgn.

ENDIF.

ENDLOOP.

ENDLOOP.

Thanks,

Veerendra.