SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Create MIRO with GL reference and Profitability segment



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Wed May 20, 2009 5:09 pm    Post subject: Create MIRO with GL reference and Profitability segment Reply with quote

Create MIRO with GL reference and Profitability segment using BAPI

Code:
Field used :
*** HEADERDATA – 1 row
MIRO_HEADER-INVOICE_IND = 'X'.
MIRO_HEADER-DOC_TYPE = 'RE'.
MIRO_HEADER-DOC_DATE =
MIRO_HEADER-PSTNG_DATE = SY-DATUM.
MIRO_HEADER-REF_DOC_NO = [ reference PO number from that GR ]
MIRO_HEADER-PO_REF_NO = [ dummy PO – all item deleted ]
MIRO_HEADER-COMP_CODE = [ company code ]
MIRO_HEADER-DIFF_INV = [ vendor code ]
MIRO_HEADER-BUS_AREA = [ business area ]
MIRO_HEADER-CURRENCY = [ currency used on MIRO doc ]
MIRO_HEADER-EXCH_RATE = 1.
MIRO_HEADER-ALLOC_NMBR = [ allocation number, on my case I use same number with ref_doc_no ]
MIRO_HEADER-HEADER_TXT = [header text]


*** TAXDATA – 1 row
MIRO_HEADER-ITEM_TEXT = [header text]
MIRO_TAX-TAX_CODE = [tax code]

*** MATERIALDATA – 1 row [in my case I use only 1 material]
MIRO_MAT-INVOICE_DOC_ITEM = [sequence number]
MIRO_MAT-MATERIAL = [material number]
MIRO_MAT-VAL_AREA = [plant]
MIRO_MAT-DB_CR_IND = 'S'.
MIRO_MAT-ITEM_AMOUNT = [value amount]
MIRO_MAT-QUANTITY = [value quantity]
MIRO_MAT-BASE_UOM = [unit]
MIRO_MAT-BASE_UOM_ISO = [unit]
MIRO_MAT-TAX_CODE = [tax code]

*** GLACCOUNTDATA – multiple row, according to GL account related to journal
MIRO_GL-INVOICE_DOC_ITEM = [line number - sequence]
MIRO_GL-GL_ACCOUNT = [GL account]
MIRO_GL-ITEM_AMOUNT = [GL value amount]
MIRO_GL-DB_CR_IND = 'H'.
MIRO_GL-COMP_CODE = [company code]
MIRO_GL-TAX_CODE = [tax code]
MIRO_GL-BUS_area = [business area]

*** RUN THE BAPI
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
EXPORTING
HEADERDATA = miro_header
IMPORTING
INVOICEDOCNUMBER = result_invoice
FISCALYEAR = result_invoice_year
TABLES
ITEMDATA = miro_item
TAXDATA = miro_tax
GLACCOUNTDATA = miro_gl
MATERIALDATA = miro_mat
RETURN = return.

*** INVOICE NUMBER
RESULT_INVOICE
RESULT_INVOICE_YEAR

*** YOU NEED TO COMMIT THE TRANSACTION, OTHERWISE THE INVOICE NUMBER WONT BE SAVED COMPLETELY

IF RESULT_INVOICE NE SPACE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDIF.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.