2013 Sep 02 9:26 AM
Dear Experts ,
I am using bapi " BAPI_ACC_GL_POSTING_POST " for bulk document parking and it is parking document properly but the problem is that it is not taking proper posting key.
Below is my code.
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
EXPORTING
DOCUMENTHEADER = GD_DOCUMENTHEADER1
IMPORTING
OBJ_TYPE = L_TYPE
OBJ_KEY = L_KEY
OBJ_SYS = L_SYS
TABLES
ACCOUNTGL = IT_ACCOUNTGL1
CURRENCYAMOUNT = IT_CURRENCYAMOUNT1
RETURN = IT_RETURN
EXTENSION1 = IT_EXTENSION1.
Kindly help.
Thanks
Alok
2013 Sep 02 10:13 AM
2013 Sep 02 10:56 AM
Hi Raymond ,
The bapi given by you is only for docs posting not for parking and for posing I am using the same, but for parking I am using 'BAPI_ACC_GL_POSTING_POST' and documents park successfully but the problem is in posting key, it parked with gl posing key in both dr/cr line in place of customer and vendor.
Thanks
Alok
2013 Sep 02 1:25 PM
This BAPI allows parking, but it is a G/L BAPI, unable to post vendor or customer account, read its documentation. So try BAPI_ACC_DOCUMENT_POST as I suggested, it can park document as many threads already describe this as well as an OSS note : Note 1282005 - Parking using the accounting interface (Look also at related notes that correct some problems) or using BAdI AC_DOCUMENT changing C_ACCHD-STATUS_NEW to 2 or 3.
Regards,
Raymond
2013 Sep 02 11:24 AM
Hi Raymond,
Can we try the following logic as mentioned in link.
http://www.saptechnical.com/Tutorials/BAPI/Parking/Index.htm
Thanks and Regards
Srimanta
2013 Sep 02 12:09 PM
Same way I have done my code but in place of picking the posting key of customer of vendor it is picking posting key of reconcilation account of customer and vendor and at the time of posting it is giving error.
Thanks
Alok
2013 Sep 02 12:12 PM
2013 Sep 02 12:26 PM
In this bapi also there is no parameter for posting key but as per the posting key we can identify the Gl/Vendor/Customer and pass accordingly into BAPI.
See below code.
GD_DOCUMENTHEADER1-USERNAME = SY-UNAME.
GD_DOCUMENTHEADER1-HEADER_TXT = 'Document Park'.
GD_DOCUMENTHEADER1-COMP_CODE = ITAB_HD-CCODE.
GD_DOCUMENTHEADER1-FISC_YEAR = ITAB_HD-FYEAR.
GD_DOCUMENTHEADER1-DOC_DATE = ITAB_HD-DDATE.
GD_DOCUMENTHEADER1-PSTNG_DATE = ITAB_HD-PDATE.
GD_DOCUMENTHEADER1-DOC_TYPE = ITAB_HD-DTYPE.
GD_DOCUMENTHEADER1-REF_DOC_NO = ITAB_HD-REFR.
LOOP AT ITAB WHERE HD_TXT = ITAB_HD-HD_TXT.
IF LV_LINE_NO IS INITIAL.
LV_LINE_NO = SY-TABIX.
ENDIF.
ITMNO = ITMNO + 1.
WA_ACCOUNTGL1-ITEMNO_ACC = ITMNO.
* Line items for GLs
IF ITAB-PKEY = '40' OR ITAB-PKEY = '50'.
WA_ACCOUNTGL1-GL_ACCOUNT = ITAB-GLNO.
* Line items for customer
ELSEIF ITAB-PKEY = '01' OR ITAB-PKEY = '02'
OR ITAB-PKEY = '03' OR ITAB-PKEY = '04'
OR ITAB-PKEY = '05' OR ITAB-PKEY = '06'
OR ITAB-PKEY = '07' OR ITAB-PKEY = '08'
OR ITAB-PKEY = '09' OR ITAB-PKEY = '11'
OR ITAB-PKEY = '12' OR ITAB-PKEY = '13'
OR ITAB-PKEY = '14' OR ITAB-PKEY = '15'
OR ITAB-PKEY = '16' OR ITAB-PKEY = '17'
OR ITAB-PKEY = '18' OR ITAB-PKEY = '19'.
* Fetching customer Reconciliation Account
WA_ACCOUNTGL1-CUSTOMER = ITAB-GLNO. " Customer code
SELECT SINGLE AKONT FROM KNB1
INTO WA_ACCOUNTGL1-GL_ACCOUNT
WHERE KUNNR = ITAB-GLNO.
WA_ACCOUNTRECEIVABLE-ITEM_TEXT = ITAB-TEXT.
WA_ACCOUNTRECEIVABLE-COMP_CODE = ITAB-CCODE.
WA_ACCOUNTRECEIVABLE-PROFIT_CTR = ITAB-PROFIT.
* Line items for Vendor
ELSEIF ITAB-PKEY = '21' OR ITAB-PKEY = '22'
OR ITAB-PKEY = '24' OR ITAB-PKEY = '25'
OR ITAB-PKEY = '26' OR ITAB-PKEY = '27'
OR ITAB-PKEY = '28' OR ITAB-PKEY = '29'
OR ITAB-PKEY = '31' OR ITAB-PKEY = '32'
OR ITAB-PKEY = '34' OR ITAB-PKEY = '35'
OR ITAB-PKEY = '36' OR ITAB-PKEY = '37'
OR ITAB-PKEY = '38' OR ITAB-PKEY = '39'.
WA_ACCOUNTGL1-VENDOR_NO = ITAB-GLNO.
* Fetching vendor Reconciliation Account
SELECT SINGLE AKONT FROM LFB1
INTO WA_ACCOUNTGL1-GL_ACCOUNT
WHERE LIFNR = ITAB-GLNO.
ENDIF.
WA_ACCOUNTGL1-ITEM_TEXT = ITAB-TEXT. "
WA_ACCOUNTGL1-COMP_CODE = ITAB-CCODE.
WA_ACCOUNTGL1-PROFIT_CTR = ITAB-PROFIT.
WA_ACCOUNTGL1-COSTCENTER = ITAB-COST.
WA_ACCOUNTGL1-ALLOC_NMBR = ITAB-ZUONR.
APPEND WA_ACCOUNTGL1 TO IT_ACCOUNTGL1.
* Fill currency amount datails
WA_CURRENCYAMOUNT1-ITEMNO_ACC = ITMNO.
WA_CURRENCYAMOUNT1-CURR_TYPE = '00'.
WA_CURRENCYAMOUNT1-CURRENCY = 'INR'.
WA_CURRENCYAMOUNT1-AMT_DOCCUR = ITAB-AMOUNT.
APPEND WA_CURRENCYAMOUNT1 TO IT_CURRENCYAMOUNT1.
* Fill extention table for parking
WA_EXTENSION1-FIELD1 = 'BAPI-PARK'.
WA_EXTENSION1-FIELD2 = '1'.
APPEND WA_EXTENSION1 TO IT_EXTENSION1.
ENDLOOP.
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
EXPORTING
DOCUMENTHEADER = GD_DOCUMENTHEADER1
IMPORTING
OBJ_TYPE = L_TYPE
OBJ_KEY = L_KEY
OBJ_SYS = L_SYS
TABLES
ACCOUNTGL = IT_ACCOUNTGL1
CURRENCYAMOUNT = IT_CURRENCYAMOUNT1
RETURN = IT_RETURN
EXTENSION1 = IT_EXTENSION1.
Here u can understand the role of posting key.