‎2006 Nov 07 8:28 AM
What are the parmaeters to be filled up essentially for calling this BAPI . What is meant by Object type parameter in this BAPI. Please reply.
Thanks in advance
‎2006 Nov 07 8:30 AM
HI,
chk a sample code.
* IF GL ACCOUNT
* Accountgl / Compte générale
ws_accountgl-itemno_acc = w_compt.
ws_accountgl-comp_code = p_bukrs.
ws_accountgl-pstng_date = ws_reformat-datecpt.
ws_accountgl-fisc_year = ws_reformat-datecpt(4).
ws_accountgl-fis_period = ws_reformat-datecpt+4(2).
ws_accountgl-doc_type = p_blart.
ws_accountgl-item_text = ws_reformat-libel.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ws_reformat-cptclf
IMPORTING
output = ws_accountgl-gl_account.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ws_reformat-kostl
IMPORTING
output = ws_accountgl-costcenter.
ELSE. " ACC. PAYABLE
* Account Payable / Compte fournisseur
ws_accountpayable-itemno_acc = w_compt.
ws_accountpayable-comp_code = p_bukrs.
ws_accountpayable-item_text = ws_reformat-libel.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ws_reformat-cptclf
IMPORTING
output = ws_accountpayable-vendor_no.
APPEND ws_accountpayable TO accountpayable.
ENDIF.
* Currencyamount Struct.
ws_currencyamount-itemno_acc = w_compt.
ws_currencyamount-currency = 'EUR'.
* ws_currencyamount-curr_type = '00'.
IF ws_reformat-sign EQ 'C'.
ws_reformat-wrbtr_c = ws_reformat-wrbtr_c * ( - 1 ).
ENDIF.
ws_currencyamount-amt_doccur = ws_reformat-wrbtr_c.
APPEND ws_currencyamount TO currencyamount.
* BAPI
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = documentheader
TABLES
accountgl = accountgl
accountpayable = accountpayable
currencyamount = currencyamount
return = t_return.
IF sy-subrc <> 0.
MESSAGE e999(re) WITH 'Problem occured'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.rgds
Anver
if hlped plsmark points
‎2006 Nov 07 8:30 AM
Hi AA ,
this BAPI has Documentation , So please check /read the documentation .
FU BAPI_ACC_DOCUMENT_POST OBJ_TYPE
____________________________________________________
Text
Reference procedure
Source document
Description
When a business transaction is updated in Accounting, it may be that several documents are updated at the same time (FI document, CO document, etc). If the business transaction is not initiated in Accounting, a source document must exist outside Accounting. The information from this document must be transferred when the FI/CO interface is called up. The source information is updated in all accounting documents, and is made up of the following fields:
AWTYP (OBJ_TYPE) Reference transaction
Sender ID
AWKEY (OBJ_KEY) Reference key
Source document number
The reference key is made up of:
AWREF Reference document number (10 digits)
Source document number
AWORG Reference organizational unit (10 digits)
Number range ID (if required)
AWSYS (OBJ_SYS) Logical system
Logical system of source document
When the document is being processed, the system checks whether a reference document number (first part of the reference key) has been transferred.
Notes
Use a separate value in the OBJ_TYPE field (reference transaction). You must maintain an entry for this value in table TTYP, which could be a function module that is called when the user wants to branch back to the source/sender document from an accounting document. This makes it possible for documents updated using BAPIs to be included in the document navigation (revision). If you use SAP defined characters in the field OBJ_TYPE, errors can occur in the navigation.
The FI and CO line item suppression is defined separately for each reference transaction.
It is not necessary to separate the reference key into reference document number and reference organizational unit. This means that reference document numbers that are longer than 10 digits can be transferred into the reference key.
Function Module
BAPI_ACC_DOCUMENT_POST
‎2006 Nov 07 8:32 AM
Hi,
Pass the parameters as below....
Document Header Structure.......
-
BUS_ACT RFBU
USERNAME GKUMARG
COMP_CODE RIL
DOC_DATE 03.02.2006
PSTNG_DATE 03.02.2006
FIS_PERIOD 00
DOC_TYPE SA
AccountGL Table....
-
ITEMNO_ACC 0000000001
GL_ACCOUNT 113200
ITEM_TEXT TEST
DOC_TYPE SA
And Currency Amount Table...
-
ITEMNO_ACC 0000000001
CURRENCY_ISO INR
Regards,
Ram
Pls reward points if helpful....
Message was edited by: Ram Mohan Naidu Thammineni
‎2006 Nov 07 8:39 AM
Hi:
just check this sample code.
REPORT gl_posting.
DATA:
Structure for document header
g_docheader LIKE bapiache08,
Table and header for G/L Account Line Items
gi_accountgl TYPE STANDARD TABLE OF bapiacgl08,
g_accountgl LIKE bapiacgl08,
Table and header for Line Item Currency Fields
gi_amount TYPE STANDARD TABLE OF bapiaccr08,
g_amount LIKE bapiaccr08,
Return
gi_return TYPE STANDARD TABLE OF bapiret2,
g_return LIKE bapiret2.
START-OF-SELECTION.
*----
HEADER DATA
*
OBJ_TYPE Objekttypes can be found in table TTYP
OBJ_KEY Seems that you can use any value
OBJ_SYS Logical system. Logical ystems can be found in
table TBDLS. If there is no logical system assigned
to the client, assign it this way:
*
Transaction: SPRO
- Basis components
- Application Link Enabling (ALE)
- Sending and receiving systems
- Logical systems
- Define logical system
- Assign client o logical system
*
*
*----
g_docheader-obj_type = 'BKPFF'.
g_docheader-obj_key = '1'.
g_docheader-obj_sys = 'B3TCLNT800'.
g_docheader-username = sy-uname.
g_docheader-header_txt = 'BAPI test'.
g_docheader-comp_code = '1000'.
g_docheader-doc_date = sy-datum.
APPEND g_amount TO gi_amount.
*----
LINE ITEMS
*----
Item 1
g_accountgl-itemno_acc = '0000000001'.
g_accountgl-gl_account = '0000192600'.
g_accountgl-pstng_date = sy-datum.
APPEND g_accountgl TO gi_accountgl.
Item 2
g_accountgl-itemno_acc = '0000000002'.
g_accountgl-gl_account = '0000192600'.
g_accountgl-pstng_date = sy-datum.
APPEND g_accountgl TO gi_accountgl.
*----
CURRENCY AND AMOUNT
*----
Item 1
g_amount-itemno_acc = '0000000001'.
g_amount-currency = 'EUR'.
g_amount-amt_doccur = 5000.
APPEND g_amount TO gi_amount.
Item 2
g_amount-itemno_acc = '0000000002'.
g_amount-currency = 'EUR'.
g_amount-amt_doccur = -5000.
APPEND g_amount TO gi_amount.
END-OF-SELECTION.
Call the BAPI function
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = g_docheader
IMPORTING
OBJ_TYPE =
OBJ_KEY =
OBJ_SYS =
TABLES
accountgl = gi_accountgl
currencyamount = gi_amount
return = gi_return
EXTENSION1 =
.
LOOP AT gi_return INTO g_return.
WRITE: / g_return-message.
ENDLOOP.