Skip to Content
author's profile photo Former Member
Former Member

Help Requires...........

Hi Gurus,

I am working on an interface where I am using BAPI_ACC_DOCUMENT_POST for posting an accounting document and I have not being provided with the vendor number but I have been provided with the G/L accounts for both the posting key 40 and 50 but when I am running this program, I am getting this error, "Account 206221 in company code 1000 cannot be directly posted to" and this G/L a/c is associated with posting key 50, can you please have a look at the following code and please let me know my mistake.

data: begin of it_input_file occurs 0,

pos_date(10),

bukrs(4),

pos_per(2),

currency(3),

h_text(25),

doc_type(2),

pos_key(2),

glaccount(10),

amount(16),

bus_area(4),

kostl(10),

item_text(50),

order(20),

allocation(10),

prctr(10),

doc_date(10),

end of it_input_file.

if it_input_file-pos_key eq 50.

move:

v_count to glaccount-ITEMNO_ACC,

it_input_file-glaccount to glaccount-gl_account,

it_input_file-kostl to glaccount-COSTCENTER,

it_input_file-prctr to glaccount-PROFIT_CTR,

it_input_file-bus_area to glaccount-bus_area,

it_input_file-item_text to glaccount-ITEM_TEXT.

append glaccount.

move:

v_count to currencyamount-ITEMNO_ACC,

it_input_file-currency to currencyamount-CURRENCY.

currencyamount-AMT_DOCCUR = it_input_file-amount * -1.

append currencyamount.

clear: glaccount, currencyamount.

else.

move:

v_count to glaccount-ITEMNO_ACC,

it_input_file-glaccount to glaccount-gl_account,

it_input_file-kostl to glaccount-COSTCENTER,

it_input_file-prctr to glaccount-PROFIT_CTR,

it_input_file-bus_area to glaccount-bus_area,

it_input_file-item_text to glaccount-ITEM_TEXT.

  • it_input_file-assignment to glaccount-ALLOC_NMBR.

append glaccount.

move:

v_count to currencyamount-ITEMNO_ACC,

it_input_file-currency to currencyamount-CURRENCY,

it_input_file-amount to currencyamount-AMT_DOCCUR .

append currencyamount.

clear: glaccount, currencyamount.

endif.

FORM call_bapi .

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

DOCUMENTHEADER = documentheader

IMPORTING

OBJ_TYPE = obj_type

OBJ_KEY = obj_key

OBJ_SYS = obj_sys

TABLES

ACCOUNTGL = glaccount

ACCOUNTPAYABLE = ap

CURRENCYAMOUNT = currencyamount

RETURN = return.

read table return with key type = 'S'.

if syst-subrc eq 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

IMPORTING

RETURN = return2.

perform create_success_log.

else.

perform create_failure_log.

endif.

Message was edited by:

Rajeev Gupta

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 20, 2007 at 10:29 PM

    You asked this question earlier. The answer is the same. You need to use an account that can be posted to. This is handled in config. So your business analyst is the person to ask, not the forum.

    If your anaalyst is not handy, try looking in BSAS. You should be able to find an account there.

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      No, there are still problems with the code. After the BAPI call, you check sy-subrc to see if you should commit. The return code will be zero because the bapi raises no exceptions. You have to analyze the return table in order to determine whether to do a commit. (Look for a success message with a document number.)

      Rob

  • Posted on Nov 20, 2007 at 10:02 PM

    You are trying to post to the account in which you can't post directly. This GL should be some kind of the recon account. SO, you can't post directly.

    If you try to post directly with this account, still will give you the same message.

    Use some other account. Consult your functional consutlant for some more postable account.

    Regards,

    Naimesh Patel

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.