Application Development 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: 

Posting Key in BAPI_ACC_DOCUMENT_POST

Former Member
0 Kudos

Hi,

I am using bapi 'BAPI_ACC_DOCUMENT_POST' to post 'Customer Document' in FB01. I was able to post the document but Posting Key in the document is not as desired. When I try to Post the document with out any Posting Key by default I am having Posting Key as '01'(Customer document) and '50'(GL account).

But I want bapi 'BAPI_ACC_DOCUMENT_POST' to post a document with Posting key '15'(Customer Document) and '40'(GL account).

In bapi I am using these tables along with header.

ACCOUNTGL- GL Account

ACCOUNTRECEIVABLE- Customer Document

I tried passing the posting key in ACCT_TYPE in table ACCOUNTGL and passing the the posting key using EXTENSION2 table but was not successful .

Can anyone let me know

How can I pass the Posting Key to the bapi 'BAPI_ACC_DOCUMENT_POST' for Customer Document and GL account?

OR

How can I use EXTENSION2 table to create an appropriate posting key?

please let me know.

Vikki,

In one of your thread you came across the same issue and you solved it. Can you please guide me how to achive appropriate posting key using EXTENSION2 table?

Thanks,

Vijay.

1 ACCEPTED SOLUTION

Former Member

Hi,

Just follow these steps:

1. Fill in your EXTENSION table like this

  • first 3 character represent item number

  • next 2 character represent posting key

CLEAR: gt_extension.

gt_extension(3) = sy-index(3).

gt_extension+3(2) = 'New Posting Key'.

APPEND gt_extension.

2. Create an FM similar to SAMPLE_INTERFACE_RWBAPI01 and put the following codes:

IF NOT extension IS INITIAL.

LOOP AT extension.

READ TABLE it_accit WITH KEY posnr = extension(3).

IF sy-subrc IS INITIAL.

it_accit-bschl = extension+3(2).

MODIFY it_accit INDEX sy-tabix.

ENDIF.

ENDLOOP.

ENDIF.

3.

- Go to TCode "FIBF".

- Go to Settings -> Products -> ... of a customer

- Create a new entry and check the box to activate the product

Product = <any name>

Text = <description>

RFC = blank

Check the activation box

- Go to Settings -> Process Modules -> ... of a customer

- Create a new entry by specifying the name of the function module name and product name created earlier.

Process = RWBAPI01

Ctr = blank

Appl = blank

FM = <FM created>

Product = <name of product created earlier>

Hope this helps,

Leonard Chomi.

4 REPLIES 4

Former Member

Hi,

Just follow these steps:

1. Fill in your EXTENSION table like this

  • first 3 character represent item number

  • next 2 character represent posting key

CLEAR: gt_extension.

gt_extension(3) = sy-index(3).

gt_extension+3(2) = 'New Posting Key'.

APPEND gt_extension.

2. Create an FM similar to SAMPLE_INTERFACE_RWBAPI01 and put the following codes:

IF NOT extension IS INITIAL.

LOOP AT extension.

READ TABLE it_accit WITH KEY posnr = extension(3).

IF sy-subrc IS INITIAL.

it_accit-bschl = extension+3(2).

MODIFY it_accit INDEX sy-tabix.

ENDIF.

ENDLOOP.

ENDIF.

3.

- Go to TCode "FIBF".

- Go to Settings -> Products -> ... of a customer

- Create a new entry and check the box to activate the product

Product = <any name>

Text = <description>

RFC = blank

Check the activation box

- Go to Settings -> Process Modules -> ... of a customer

- Create a new entry by specifying the name of the function module name and product name created earlier.

Process = RWBAPI01

Ctr = blank

Appl = blank

FM = <FM created>

Product = <name of product created earlier>

Hope this helps,

Leonard Chomi.

Former Member
0 Kudos

Hi Vijay,

I dont have much knowledge on this but I have searched some in SDN.. Check these links..

Check this links

[BAPI_ACC_DOCUMENT_POST|]

[BAPI_ACC_DOCUMENT_POST|]

[BAPI_ACC_DOCUMENT_POST|]

[Posting Key in BAPI_ACC_DOCUMENT_POST |]

[Posting Key in BAPI_ACC_DOCUMENT_POST|]

[BAPI_ACC_DOCUMENT_POST post One-time vender data , can't ? |]

Thanks & regards,

Dileep .C

Adi_Bathineni
Participant
0 Kudos

Hi,

For posting the Document with the Posting Key , you should use the Extension2 Structure and BADI for implementing that.

You should pass all the posting keys to the EXTENSION2 structure and you should implement ACC_DOCUMENT_POST (BADI),

Once you pass all the posting keys to the EXTENSION2 structure, in the BAPI (BAPI_ACC_DOCUMENT_POST), the routine will call for BADI.

Hope above idea is helpful

Let me know if you require some more help on this.

Thanks,

Adi.