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

FB01 uploading problem with posting keys

Former Member
0 Likes
2,908

Hi Gurus!

I created this program to upload the FB01 transaction froma csv file using 'BAPI_ACC_DOCUMENT_CHECK'.

Everything seems to be working fine except for the fact that even when my csv file has the posting key of 31 for the vendor and 40 for the gl it picks up 21 and 50 from somewhere and posts that which is wrong. I am not sure why this is happening and where its picking up the posting keys from inspite of the file indicating 31 and 40 respectively.

My file is as follows:

02232010;KR;2000;02222010;;CAD;154085;009571;31;925049;20706.84;V005;02222010;C;213728;40;3998;20706.84;1;EA;002;730019;730019 and as you see the 31 and 40 are mentioned in the file but after i run teh program and see the FB03 for the postings it shows me as follows.

2000 1 000001 21 2000 Trade Accts Payable 6,935.41 CAD 730019

2000 2 000002 50 3998 Trade AR Conversion 6,935.41- CAD 730019 730019

Could anyone please tell me why is it picking up other posting key istead of mine being provided in the file.

Thanks

Hi Gurus!

I created this program to upload the FB01 transaction froma csv file using 'BAPI_ACC_DOCUMENT_CHECK'.

Everything seems to be working fine except for the fact that even when my csv file has the posting key of 31 for the vendor and 40 for the gl it picks up 21 and 50 from somewhere and posts that which is wrong. I am not sure why this is happening and where its picking up the posting keys from inspite of the file indicating 31 and 40 respectively.

My file is as follows:

02232010;KR;2000;02222010;;CAD;154085;009571;31;925049;20706.84;V005;02222010;C;213728;40;3998;20706.84;1;EA;002;730019;730019 and as you see the 31 and 40 are mentioned in the file but after i run teh program and see the FB03 for the postings it shows me as follows.

2000 1 000001 21 2000 Trade Accts Payable 6,935.41 CAD 730019

2000 2 000002 50 3998 Trade AR Conversion 6,935.41- CAD 730019 730019

Could anyone please tell me why is it picking up other posting key istead of mine being provided in the file.

Thanks

10 REPLIES 10
Read only

Former Member
0 Likes
2,413

This message was moderated.

Read only

0 Likes
2,413

Hi Rob!

I am using the BAPI to upload FB01.

Thanks

Read only

0 Likes
2,413

How do you use BAPI_ACC_DOCUMENT_CHECK to post a document?

Rob

Read only

0 Likes
2,413

I followed this:


***Vendor account check***
    CLEAR wa_ap.
    wa_ap-itemno_acc         = 1.                           "Item No
    wa_ap-vendor_no         = tw_upload-newko.              "Vendor account no
    wa_ap-item_text         = tw_upload-sgtxt.
    APPEND wa_ap TO ta_ap.

***General Ledger account check***
    CLEAR wa_gl.
    wa_gl-itemno_acc         = 2.                           "Item No
    wa_gl-gl_account         = tw_upload-newko_2.           "General ledger account
    wa_gl-item_text          = tw_upload-sgtxt_2.
*    wa_gl-fis_period         = tw_upload-monat.
    wa_gl-pstng_date         = wa_header-pstng_date.
    wa_gl-costcenter         = tw_upload-kostl.             "Cost center
    wa_gl-profit_ctr         = tw_upload-prctr.             "Profit center
    APPEND wa_gl TO ta_gl.

***Currency check***

    CLEAR wa_curr.
    wa_curr-itemno_acc       = 1.
    wa_curr-currency         = tw_upload-waers.
    wa_curr-amt_doccur       = tw_upload-wrbtr .
    APPEND wa_curr TO ta_curr.
    CLEAR wa_curr.
    wa_curr-itemno_acc       = 2.
    wa_curr-currency         = tw_upload-waers.
    wa_curr-amt_doccur       = tw_upload-wrbtr_2 * -1 .
    APPEND wa_curr TO ta_curr.

**Bapi check for the record to post
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
      EXPORTING
        documentheader = wa_header
      TABLES
        accountgl      = ta_gl
        currencyamount = ta_curr
        return         = ta_return
        accountpayable = ta_ap. " If return contains no errors then post documents

Read only

0 Likes
2,413

>

> I followed this:


         accountpayable = ta_ap. " If return contains no errors then post documents

But doesn't this just check the document? How do you post it?

Rob

Read only

0 Likes
2,413

For posting I follow the CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' after it has checked teh document.

As for the posting key why dosent it take the value from the csv when it takes all other values , why not the posting key , instead of assigning it on its own. Is there a way I can directly pull even this value of posting key from the file isntead if the Bapi assigninsg it on its own?

Thanks

Read only

0 Likes
2,413

Of course before that I used the

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = wa_header

TABLES

accountgl = ta_gl

currencyamount = ta_curr

return = ta_return

accountpayable = ta_ap.

Thanks

Read only

0 Likes
2,413

Where are you mapping the posting key from the csv file to the BAPI target structures? Well, you can't because there is no target field for posting key. This way SAP makes sure that the posting keys are consistent with the rest of the data you are posting.

Check out include LACC9F20, subroutine fill_acct_key.

Thomas

Read only

ThomasZloch
Active Contributor
0 Likes
2,413

The posting keys are derived internally inside the BAPI (based on debit/credit amount and account type), you cannot set them yourself.

Thomas

Read only

Former Member
0 Likes
2,413

You see, that's the problem. In the subject line of the question, you mention FB01. That's a transaction that can be used in batch input to post transactions, but you aren't using it here, so why mention it?

Then in the question itself, you talk about BAPI_ACC_DOCUMENT_CHECK. But it turns out this is not relevant either, because you actually use 'BAPI_ACC_DOCUMENT_POST' to post the document. You don't mention that until way down the list of replies.

If you want an answer to your questions, you have to give complete and accurate information at the beginning rather than expecting people to figure out what is really going on in your program.

I'm going to lock this and you can either re-submit it after thinking a bit more clearly about the problem.

Or you can just read Thomas's answer.

Rob