Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_ACC_DOCUMENT_POSt

Former Member
0 Likes
2,751

Hi SAP Fans,

I'm facing a problem when posting a document using this BAPI, i'm getting the error "Special G/L transactions of type W are not supported" can anyone help me out ?

Thx in advance.

9 REPLIES 9
Read only

Former Member
0 Likes
1,467

Hi,

Spl Gl indicator is not defined..

Read only

Former Member
0 Likes
1,467

Solved with Batch-Input

Read only

WenjingLiu
Participant
0 Likes
1,467

Hi gurus,

I hope someone has found out a way that we can still use this BAPI rather than batch input in this circumstance.

Best,

Arwen

Read only

Former Member
0 Likes
1,467

hi ,

Try to pass the values as shown below, i hope this will resolve your prob.

DATA : DOCUMENTHEADER like BAPIACHE09 occurs 0  with header line.

DATA : ACCOUNTGL  like BAPIACGL09 occurs 0  with header line.

DATA : ACCOUNTPAYABLE like BAPIACAP09 occurs 0 with header line.

DATA : CURRENCYAMOUNT  like BAPIACCR09 occurs 0  with header line.

DATA : Return  like BAPIRET2  occurs 0  with header line.

DOCUMENTHEADER-USERNAME     = sy-uname.

*DOCUMENTHEADER-HEADER_TXT   = 'FB01 Bapi tst prg'.

DOCUMENTHEADER-COMP_CODE    = 'XYZ'.

DOCUMENTHEADER-DOC_DATE     = sy-datum.

DOCUMENTHEADER-PSTNG_DATE   = sy-datum.

DOCUMENTHEADER-DOC_TYPE     = 'KZ'.

APPEND DOCUMENTHEADER.

ACCOUNTGL-ITEMNO_ACC  = '0000000001'.

ACCOUNTGL-GL_ACCOUNT  = '0000100305'.

*ACCOUNTGL-PSTNG_DATE  = sy-datum.

*ACCOUNTGL-VENDOR_NO   = '4000000012'.

APPEND ACCOUNTGL.

ACCOUNTPAYABLE-ITEMNO_ACC  = '0000000002'.

ACCOUNTPAYABLE-GL_ACCOUNT  = '0000100405'.

ACCOUNTPAYABLE-COMP_CODE  =  'XYZ'.

APPEND ACCOUNTPAYABLE.

CURRENCYAMOUNT-ITEMNO_ACC = '0000000001'.

CURRENCYAMOUNT-CURRENCY   = 'INR'.

CURRENCYAMOUNT-AMT_DOCCUR = '5000'.

Append CURRENCYAMOUNT.

CURRENCYAMOUNT-ITEMNO_ACC = '0000000002'.

CURRENCYAMOUNT-CURRENCY   = 'INR'.

CURRENCYAMOUNT-AMT_DOCCUR = '-5000'.

Append CURRENCYAMOUNT.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

   EXPORTING

     DOCUMENTHEADER          =  DOCUMENTHEADER

*    CUSTOMERCPD             =

*    CONTRACTHEADER          =

*  IMPORTING

*    OBJ_TYPE                =

*    OBJ_KEY                 =

*    OBJ_SYS                 =

   TABLES

    ACCOUNTGL               =  ACCOUNTGL

*    ACCOUNTRECEIVABLE       =

    ACCOUNTPAYABLE          =  ACCOUNTPAYABLE

*    ACCOUNTTAX              =

     CURRENCYAMOUNT          = CURRENCYAMOUNT

*    CRITERIA                =

*    VALUEFIELD              =

*    EXTENSION1              =

     RETURN                  = Return

*    PAYMENTCARD             =

*    CONTRACTITEM            =

*    EXTENSION2              =

*    REALESTATE              =

*    ACCOUNTWT               =

           .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

--

Regards

Jack

Read only

0 Likes
1,467

Hi Jack,

Our issue is when passing accountreceivable-sp_gl_ind = 'W' to the BAPI, we get error message 'Special G/L transactions of type W are not supported', even in Transaction OBYR we have made the required configuration, which means we can post such documents via foreground transactions (hence batch input is an option).

Regards,

Arwen

Read only

0 Likes
1,467

Try BAPI_ACC_GL_POSTING_POST

Read only

WenjingLiu
Participant
0 Likes
1,467

Just for reference, I have found that if the check for type W is bypassed, the document will be created successfully through BAPI_ACC_DOCUMENT_POST. The amount will be displayed in tranaction FBL5N as open item, and the entry can be also found in table BSID. But this is achieved by modifying the standard code. I am not sure whether there is some side effect.

The code is in include LFACIF02, FORM SUBST_BSCHL.

*{   INSERT         DEVK900990                                        1

* FI-01, by arwen, 2014-05-07

* bypass check for special g/l type w

     data: lv_umsks type accit_fi-umsks.

     if sy-tcode = 'ZFI001' and x_umsks = 'W'.

       lv_umsks = x_umsks.

       clear x_umsks.

     endif.

*}   INSERT

     IF X_UMSKS EQ CHAR_W.

       MESSAGE E246 WITH X_UMSKS X_UMSKZ.

     ENDIF.

*{   INSERT         DEVK900990                                        2

* FI-01, arwen, 2014-05-07

     if sy-tcode = 'ZFI001' and x_umsks = 'W'.

       x_umsks = lv_umsks.

     endif.

*}   INSERT

Read only

0 Likes
1,467

Just to confirm that Arwen Liu is right. I tried it as well and it seems that the problem is in the include LFACIF02 at the code:

IF X_UMSKS EQ CHAR_W.

       MESSAGE E246 WITH X_UMSKS X_UMSKZ.

ENDIF.


For me it is easy I only use the Bapi with Special GL for a specific document type so I added another clause in the if to check if  X_UMSKS EQ CHAR_W only if the document type is different to the one I am interested in.


Thanks Arwen.


A different solution:


After further investigation I came across the reason why this is happening. In table T047U your special GL has Special GL transaction type W which corresponds to the "Bills of exchange/Bill request" If one is not too keen in changing standard SAP code, can go to transaction "FBKP" find the GL they are interested in and in properties change the Spacial G/L transaction types radio button from "Bills of exchange/Bill request" to something else. It is advised to consult your FI Consultant before making such a change.


Best,

Kyriakos

Message was edited by: Kyriakos Poyias

Read only

0 Likes
1,467

We encountered the same problem when we were passing 'Y' or 'W' to the SP_GL_IND.

And we also changed the the standard code to bypass this error, but then we found the side effect is that the document could not be reversed correctly.

The reason is BKPF-XWVOF is not set as 'X'  if you bypass this check in the BAPI.

I spent a lot of time debugging, but I could not figure out the reason why SAP just wrote this kind of code

IF X_UMSKS EQ CHAR_W.

       MESSAGE E246 WITH X_UMSKS X_UMSKZ.

ENDIF.


without any explanation.


Anyone have better solution for it?