cancel
Showing results for 
Search instead for 
Did you mean: 

Need info on building object key for BAPI_DOCUMENT_GETOBJECTDOCS

Former Member
0 Kudos

I have an MII transaction that uses BAPI_DOCUMENT_GETOBJECTDOCS to retrieve documents attached to a production order. 

I set the object type to PORDER and am putting the string "000012345678H0001          000000000001" (where 12345678 is my PO) as the object key. 

I have been creating the string by simply appending the "H0001          000000000001" at the end of my PO.

This works most of the time.  However, I have a PO where the document originally got into the PO from the bill of material, instead of linked to the material master like most of my PO's.

In debugging the problem I used BAPI_DOCUMENT_GETDETAIL2 to find that the actual object key should have ended in "H0001          000000000000".  (a zero instead of a 1 in the last character)

But I'm in a chicken/egg problem because my transaction can't use BAPI_DOCUMENT_GETDETAIL2 because I only have a production order.

I understand that the string is built up from several fields, but have not found anything that details how to build it up. 

Hopefully one of you can point me to some details on how to build this string.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I'm giving this a bump to see if I get any replies.

I've currently wrapped a for loop from 0 to 1 and search twice, once with a 0, and again with a 1. 

Not a very elegant solution.

former_member185280
Active Contributor
0 Kudos

Not sure if it would be the same docs you are looking for, but RFC CSAP_MAT_BOM_READ can get you the documents attached to a bom.

Former Member
0 Kudos

Unfortunately, that won't help because the documents in our bills have VC object dependancies that select then only when certain conditions are met.  So I need to start with the production order.

former_member185280
Active Contributor
0 Kudos

You could try going at the DRAD table with RFC_READ_TABLE using a wildcard, something like DOKOB = 'PORDER' AND OBJKY LIKE '000012345678H0001%'.

Former Member
0 Kudos

It's defined in table TCLO (PORDER).

It's implemented, for example, in CO_DM_PORDER_OBJECT_KEY_GET