Skip to Content

The linking of attachments between SAP documents will be required in many business scenarios in SAP. But in this document, I have taken a scenario of cross company posting to explain this process. Let us go through this with an example,

Generally, an accounting document (i.e. Accounts receivable document) will be generated when billing is done (T-code VF01). In cross company trading scenario, when this document is generated, there may arise a requirement to post a corresponding AP document (Account Payable) on the partner company code. Using workflow, AP documents in partner company code can be posted. But how to transfer the attachment from AR document to AP document posted in SAP. This document will explain this process.

Below screen shot shows the AR document posted (in Company code – 0774) which is generated upon Billing. The attachment can also be seen along with the AR document. The trading partner company code for this Customer is 3277.

/wp-content/uploads/2014/09/1_540938.png

When this document is posted, workflow will be triggered to post the AP document and the transfer of attachment will happen.

AP document posted in the partner company code 3277 along with attachment is given as example below. Here, if you notice, the attachment from AR document is transferred to the newly posted AP document.

/wp-content/uploads/2014/09/2_540939.png

The linking of this attachment between the documents involves two steps,

  1. Configuration of Document Type and linking the content repository in T-Codes – OAC2 and OAC3 respectively. Also, changing the setting for the message type in transaction NACE

   b. Coding part to do the linking of attachment

  1. Configuration of Document Type

Step 1: Go to Transaction OAC2 and create a new document type as shown below. Here, the kind of attachment which we intend to transfer is PDF.

/wp-content/uploads/2014/09/3_540943.png

Step 2: Go to Transaction OAC3 and create a link for content repository. Here Billing document (VBRK) and Accounting document (BKPF) will be linked      with a test content repository ‘TN’. Here in this example, link table ‘TOA01’ is used.

/wp-content/uploads/2014/09/4_540959.png

Step 3: Go to transaction NACE and select the output type for this process is followed. In storage mode select “Print and Archive” and give the document      type that was created in transaction OAC2.

/wp-content/uploads/2014/09/5_540960.png

B. Coding – To link the attachment

Please find the code which is added as attachment along with document. Please refer the code for the variables mentioned here.

Step 1: Use the object key (BKPF-AWKEY) of the AR document to prepare source object W_OBJECT

Step 2: Call FM ‘ARCHIV_GET_CONNECTIONS’ using source object key to get the attachment document link into internal table T_TOAV0.

Step 3: Prepare target object W_BKPF_OBJECT (i.e. target AP document to which attachment link needs to be created). Here, we can use AP document’s object key (BKPF-AWKEY)

Step 4: Call FM ‘ARCHIV_WORKFLOW_COMMIT’ and pass the import parameters as shown below.

   /wp-content/uploads/2014/09/6_540961.png

     Done. Attachment will be transferred.

Feedback and Suggestions to correct any mistakes or improve this document are most welcome

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Sridhar Bolisetti

    Hi Raja Kesavan,

    Thanks for the process.  It’s a nice explanation.

    You mentioned that when the billing is completed (ie, AR document) then workflow will be triggered to post the AP document.  Could you please elaborate on this process as well so that this document can be a good guide.  Also mention if it is possible to have this workflow set up in case of AR document is in one SAP system (ie, one business) and AP document should be in another SAP system (ie, another business).

    Thanks and Regards,

    Sridhar

    (0) 
  2. Vincent Chevillard

    Hi Raja Kesavan,

    the business case you mentioned is exactly the one we need to achieve at my company. It was very useful to know it could be done quite easily. However, i have two questions for you:

    1- Could you tell me how you generated the pdf SD Invoice and attached it to the AR document

    2- I was not able to find the code in the post. Could you send it over to me?

    Thanks in adavcen for your answers.

    Kind regards,

    Vincent

    (0) 

Leave a Reply