03-25-2008 5:02 AM
03-25-2008 9:03 AM
Hi,
Use the following BAPI.
BAPI_ACC_GL_POSTING_POST
Regards,
Asmitha.
03-25-2008 9:06 AM
Hi bharat,
use this to post the data.
*********************************************************************
DATA DECLARATION
**********************************************************************
*
*&---HEADER DECLARATION
data: header type bapiache09. " HEADER DATA
**********************************************************************
INTERNAL TABLE DECLARATION
**********************************************************************
*&----G/L ACCOUNT ITEM
data: accountgl type standard table of bapiacgl09.
*&---g/l Account tax
data: account_tax type standard table of bapiactx09.
*&---CURRENCY ITEMS
data: currency_amount type standard table of bapiaccr09.
*&----RETURN PARAMETER
data: return type standard table of bapiret2 with header line.
**********************************************************************
WORK-AREA DECLARATION
**********************************************************************
*&----WORKAREA FOR G/L ACCOUNT ITEM
data: wa_accountgl type bapiacgl09.
*&---WORKAREA FOR CURRENCY ITEMS
data: wa_currency_amount type bapiaccr09.
*&---WORKAREA FOR TAX ITEMS
data: wa_tax type bapiactx09.
**********************************************************************
INITIALIZATION
**********************************************************************
header-header_txt = 'TEST HEADER'.
header-username = 'DEVELOPER'.
header-comp_code = '0002'.
header-fisc_year = '2007'.
header-doc_date = '20070502'.
header-pstng_date = '20070502'.
header-trans_date = '20070502'.
header-doc_type = 'SA'.
header-bus_act = 'RFBU'.
wa_accountgl-itemno_acc = '0000000010'.
wa_accountgl-gl_account = '0000113020'.
wa_accountgl-item_text = 'SO_DOC'.
wa_accountgl-de_cre_ind = 'S'.
append wa_accountgl to accountgl.
clear wa_accountgl.
wa_accountgl-itemno_acc = '0000000020'.
wa_accountgl-gl_account = '0000113020'.
wa_accountgl-item_text = 'SO_DOC'.
wa_accountgl-de_cre_ind = 'H'.
append wa_accountgl to accountgl.
clear wa_accountgl.
wa_currency_amount-itemno_acc = '0000000010'.
wa_currency_amount-amt_doccur = '500'.
wa_currency_amount-currency = 'INR'.
append wa_currency_amount to currency_amount.
clear wa_currency_amount.
wa_currency_amount-itemno_acc = '0000000020'.
wa_currency_amount-amt_doccur = '-500'.
wa_currency_amount-currency = 'INR'.
append wa_currency_amount to currency_amount.
clear wa_currency_amount.
*WA_TAX-ITEMNO_ACC = '0000000010'.
*WA_TAX-TAX_CODE = 'V0'.
*APPEND WA_TAX TO ACCOUNT_TAX.
*CLEAR WA_TAX.
*
*WA_TAX-ITEMNO_ACC = '0000000020'.
*WA_TAX-TAX_CODE = 'V0'.
*APPEND WA_TAX TO ACCOUNT_TAX.
*CLEAR WA_TAX.
**************************************************************
START-OF-SELECTION
**************************************************************
start-of-selection.
call function 'BAPI_ACC_DOCUMENT_POST'
exporting
documentheader = header
CUSTOMERCPD =
CONTRACTHEADER =
IMPORTING
OBJ_TYPE =
OBJ_KEY =
OBJ_SYS =
tables
accountgl = accountgl
ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE =
ACCOUNTTAX = ACCOUNT_TAX
currencyamount = currency_amount
CRITERIA =
VALUEFIELD =
EXTENSION1 =
return = return
PAYMENTCARD =
CONTRACTITEM =
EXTENSION2 =
REALESTATE =
.
if return-type na 'EA'.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
IMPORTING
RETURN = RETURN.
write:/ return-message.
else.
write:/ return-message.
endif.
write:/ return-message+36(10).
write:/ return+36(10).
Regards
Lalit