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 - AWKEY

Former Member
0 Likes
2,958

How do we form the field DOCUMENTHEADER-OBJ_KEY (BKPF-AWKEY)? I know that it is made up of the material document number and the year but how do I supply this in the BAPI? I do'nt know what the material document is.

Please don't just link to examples of using the BAPI unless they explain how you create the key.

Regards,

Davis

9 REPLIES 9
Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,170

There is usually a structure to fill the AWREF fill, for AWKEY = 'MKPF' the structure name is [MKPF_AWKEY|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=mkpf_awkey&adv=false&sortby=cm_rnd_rankvalue].

To get this information look at table [TTYP|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=ttypAWKEY&adv=false&sortby=cm_rnd_rankvalue] (SE16) where you will find the structure name and/or the name of a FM to display the sender document.+

For you request

- AWKEY = 'MKPF'

- AWREF = structure MKPF_AWKEY, with subfields BELNR and GJAHR from material document (MKPF/MSEG)

Regards

Read only

0 Likes
2,170

Thanks but I am trying to form the field so that I can create the document. I'm not sure how this will help being that the document hasn't been created yet.

Regards,

Davis

Read only

0 Likes
2,170

If you want to post a financial document (BAPI_ACC_xxx_POST) related to a material document, the material document MUST exist or at least the number MUST be known. So you MUST do it in a step where this is true, like a in BADI MB_DOCUMENT_BADI method MB_DOCUMENT_BEFORE_UPDATE.

If some data are no longer available during the BADI execution, you must export them in memory and import in BADI, or any equivalent method.

Regards

Read only

0 Likes
2,170

I am trying to use this to simply create an invoice document which will be a transfer of funds from one GL to another. Therefore, there will not necessarily be a material document. I have been told that this BAPI will work for what I want to do. From what you are saying (a material document is necessary), it will not work.

Are you saying that I can't use this for what I am trying to do?

Regards,

Davis

Read only

0 Likes
2,170

The material document is not mandatory, but when i read your question, i undestood that you needed it.<div class="jive-quote">I know that it is made up of the material document number and the year</div>You can of course use this BAPI with another AWTYP that don't need any link to a sender document.<br />

<br />

Take a look at <a class="jive-link-external" href="https://service.sap.com/sap/support/notes/306504" target="_newWindow">Note 306504 - Collective note: BAPIs for the AC interface</a><br />

<br />

Regards

Read only

0 Likes
2,170

When I try to create the document, using the BAPI, it tells me that I have to fill in the field OBJ_KEY but I have no idea how it is made for BKPF (buisness transaction RMRP). Do you have any idea?

Regards,

Davis

Read only

0 Likes
2,170

'RMRP' stand for MM invoices, you need an invoice in SAP.

- AWTYP = 'RMRP'

- AWREF = RBKP-BELNR

- AWORG = RBKP-GJAHR

This code is used by MIRO and the like, and i'm not sure you can use it with this GL BAPI, if you have no purchase order, try to [simulate FB60|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=bapi+fb60&adv=false&sortby=cm_rnd_rankvalue] with a type 'BKPF' or 'BKPFF' (look at OSS [Note 561175 - BAPI posting in accounting with FI as reference|https://service.sap.com/sap/support/notes/561175])

If you have a purchase order, try to use [BAPI_INCOMINGINVOICE_CREATE|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=bapi_incominginvoice_create&adv=false&sortby=cm_rnd_rankvalue].

Regards

Read only

0 Likes
2,170

Thanks, I'll take a look at that BAPI. The reason I said I will be using 'RMRP' is because I was simply looking at an existing posting that I was trying to duplicate. However, these invoices are going to be created based off an invoice (we are reversing retention which was based on a PO).

I will award points once I get a chance to take a look at this.

Regards,

Davis

Read only

Former Member
0 Likes
2,170

I decided to go with a BDC call instead.