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

Negative Posting on General Ledger in BAPI_ACC_DOCUMENT_POST

Former Member
0 Likes
3,566

Hello,

I have a requirement to create a document with the amount paid by the customer on the cash register with the change using the bapi BAPI_ACC_DOCUMENT_POST, example:

customer: 12.90- "sales total

cash register (111120) 15.00 "12.90 + change

cash register (111120) 2.10- "change

I am creating the customer register as account receivable and the cash as general ledger, but when I create the line -2.10 I am getting the message F5 702: Balance in transaction currency (12.90-).

My IT are:

header

bus_act = 'RFBU'

comp_code = 'EM01'

doc_date = '20150318'

pstng_date = '20150318'

fisc_year = '2015'

fis_period = '03'

accountreceivable

itemno_acc = '0000000001'

customer = '0000029910'

comp_code = 'EM01'

accountgl

itemno_acc = '0000000002'

gl_account = '0000111120'

doc_type = 'DZ'

comp_code = 'EM01'

fis_period = '03'

fisc_year = '2015'

pstng_date = '20150318'

itemno_acc = '0000000003'

gl_account = '0000111120'

doc_type = 'DZ'

comp_code = 'EM01'

fis_period = '03'

fisc_year = '2015'

pstng_date = '20150318'

currencyamount

itemno_acc = '0000000001'

currency = 'BRL'

amt_doccur = 12.9000-

itemno_acc = '0000000002'

currency = 'BRL'

amt_doccur = 15.0000

itemno_acc = '0000000003'

currency = 'BRL'

amt_doccur = 2.1000-

The message occurs on program LFACIF3V form CHECK_BALANCE_CURTP00:

   LOOP AT T_IBALTAB WHERE WRBTR NE 0

                   AND   CURTP EQ 00.

     WRITE T_IBALTAB-WRBTR TO STRINGC CURRENCY T_IBALTAB-WAERS.

     MESSAGE E702 WITH T_IBALTAB-CURTP STRINGC T_IBALTAB-WAERS.

   ENDLOOP.


And this is my T_IBALTAB:

Can someone help me with this, please?


Regards,

Tadeo

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,858

Problem Solved.

Debugging the error I discovered the form SUBST_BELNR on LFACIF02 and there is the following code:

  LOOP AT ACCIT_FI.

     IF SAVE-AWREF NE ACCIT_FI-AWREF

     OR SAVE-BUKRS NE ACCIT_FI-BUKRS

     OR SAVE-GJAHR NE ACCIT_FI-GJAHR

     OR SAVE-MONAT NE ACCIT_FI-MONAT

     OR SAVE-BUDAT NE ACCIT_FI-BUDAT

     OR SAVE-BLDAT NE ACCIT_FI-BLDAT

     OR SAVE-BLART NE ACCIT_FI-BLART

     OR SAVE-XBLNR NE ACCIT_FI-XBLNR

     OR SAVE-WAERS NE ACCIT_FI-WAERS

     OR SAVE-AWREF_REV NE ACCIT_FI-AWREF_REV

     OR SAVE-AWORG_REV NE ACCIT_FI-AWORG_REV.

       MOVE-CORRESPONDING ACCIT_FI TO SAVE.

*Belegköpfe immer mitzählen

       X_BELNR = X_BELNR + 1.

     ENDIF.

     IF ACCIT_FI-BELNR EQ SPACE.

       ACCIT_FI-BELNR    = X_BELNR.

       ACCIT_FI-BELNR(1) = '$'.

       MODIFY ACCIT_FI.

     ENDIF.

     CLEAR LOGDN.                                            "Note445916

     MOVE-CORRESPONDING ACCIT_FI TO LOGDN.                   "Note445916

     COLLECT LOGDN INTO LOGDN.                               "Note445916

   ENDLOOP.


If one of the vars in SAVE structure is different from the current line, this form put a new BELNR number into the line of ACCIT_FI and then when calculating the balance it get wrong.

Hope that helps someone too, and thanks for all the answers.

Have you try to transport the posting key(BSCHL)?

10 REPLIES 10
Read only

Former Member
0 Likes
2,858

hi,

replace this

itemno_acc = '0000000001'

currency = 'BRL'

amt_doccur = 12.9000-

itemno_acc = '0000000002'

currency = 'BRL'

amt_doccur = 15.0000

itemno_acc = '0000000003'

currency = 'BRL'

amt_doccur = 2.1000-

with

      

itemno_acc = '0000000001'

currency = 'BRL'

amt_doccur = 15.0000-

itemno_acc = '0000000002'

currency = 'BRL'

amt_doccur = 12.9000

itemno_acc = '0000000003'

currency = 'BRL'

amt_doccur = 2.1000

and try please

Read only

0 Likes
2,858

Hi, thanks for answering, but I already have 12.90+ in the customer created by the billing document, I have to create another document with 12.90- to compensate it and add to the cash register account. In your example the customer accounting wouldn't be wrong?

Read only

0 Likes
2,858

Also try with 'BAPI_ACC_DOCUMENT_REV_POST' for reversing the document.

You can check this link

may be it will be useful to you.

Read only

0 Likes
2,858

This will be useful, thanks!

Read only

Former Member
0 Likes
2,858

I think the amount for item 1 should be positive rather than negative.

Rob

Read only

0 Likes
2,858

No, thanks but it didn't work. I also tried to reverse the values and didn't work too. If I use the 12.90 without the change (deleting line 3 and setting the value of the 2 to 12.9), the BAPI works and creates the document, it doesn't work only with the change line.

Read only

0 Likes
2,858

Have you try to transport the posting key(BSCHL)?

Read only

0 Likes
2,858

Hello,

Yes, I use the extensions and BTE to change it.

Read only

Former Member
0 Likes
2,859

Problem Solved.

Debugging the error I discovered the form SUBST_BELNR on LFACIF02 and there is the following code:

  LOOP AT ACCIT_FI.

     IF SAVE-AWREF NE ACCIT_FI-AWREF

     OR SAVE-BUKRS NE ACCIT_FI-BUKRS

     OR SAVE-GJAHR NE ACCIT_FI-GJAHR

     OR SAVE-MONAT NE ACCIT_FI-MONAT

     OR SAVE-BUDAT NE ACCIT_FI-BUDAT

     OR SAVE-BLDAT NE ACCIT_FI-BLDAT

     OR SAVE-BLART NE ACCIT_FI-BLART

     OR SAVE-XBLNR NE ACCIT_FI-XBLNR

     OR SAVE-WAERS NE ACCIT_FI-WAERS

     OR SAVE-AWREF_REV NE ACCIT_FI-AWREF_REV

     OR SAVE-AWORG_REV NE ACCIT_FI-AWORG_REV.

       MOVE-CORRESPONDING ACCIT_FI TO SAVE.

*Belegköpfe immer mitzählen

       X_BELNR = X_BELNR + 1.

     ENDIF.

     IF ACCIT_FI-BELNR EQ SPACE.

       ACCIT_FI-BELNR    = X_BELNR.

       ACCIT_FI-BELNR(1) = '$'.

       MODIFY ACCIT_FI.

     ENDIF.

     CLEAR LOGDN.                                            "Note445916

     MOVE-CORRESPONDING ACCIT_FI TO LOGDN.                   "Note445916

     COLLECT LOGDN INTO LOGDN.                               "Note445916

   ENDLOOP.


If one of the vars in SAVE structure is different from the current line, this form put a new BELNR number into the line of ACCIT_FI and then when calculating the balance it get wrong.

Hope that helps someone too, and thanks for all the answers.

Read only

Former Member
0 Likes
2,858

Dear Lucas,

Very helpful answer, Thanks you.

Thanks & Regards,

John