cancel
Showing results for 
Search instead for 
Did you mean: 

Attachments to Material Master

Former Member
0 Kudos

Hi Guys,

I have the ff scenario:

1. I have a wed dynpro.

2. I can create X number of materials using the data I entered in the web dynpro.

3. In each of the materials that I'm about to create, there can be an X number of attachments.

4. I store the attachments in an internal table.

     It needs to be stored in an internal table first because the web dynpro needs to pass through reviewers and approvers before I can actually create the material. The reviewers and approvers can check the attachment and delete and reupload it if needed.

5. I'm creating the material using 'BAPI_MATERIAL_SAVEDATA'.

Question:

How can I attach my attachments to the materials created?

My attachments is in the database table.

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Navi,

You can attach the documents to the material by using GOS.

Please refer the below document.

In the above document, you just need to focus on the logic, which attaches the file to GOS and rest may not be applicable to you.

Regards,

Rama

Former Member
0 Kudos

Hi Rama,

I'm on an older system than yours.

The classes used doesn't exist in mine.

Plus, I need to attach the files to the material master.

Thanks.

Former Member
0 Kudos

Hi Rama,

My current logic is patterned from your article (super thank you for it!):

All my attachments are in a database table.

My Materials are in an ALV table.

So when the user navigates through the material items, they will see different attachments for each material when they select it.

Now, I just need to attach these data to it's corresponding material in MM02.

How can I achieve this?

Thanks.

Former Member
0 Kudos

Hi Rama,

Kindly help me out on how to upload attachments to MM02.

I will look forward to your reply.

Thanks.

ramakrishnappa
Active Contributor
0 Kudos

Hi Navi,

The attachments in material master use the GOS ( Generic Object Services ).

You can achieve your requirement as below

  • Use FM: SO_OBJECT_CREATE - Object creation
    • Fetch the attachment data from your custom table and convert the data using SO_CONVERT_CONTENTS_BIN & pass it as content
    • Determine the folder id details using FM: SO_FOLDER_ROOT_ID_GET
    • Create an object using fm: SO_OBJECT_CREATE
  • Use FM: BINARY_RELATION_CREATE_COMMIT : to link the attachment to material
    • Pass the folder details & object details into fm to link the attachment to the given material number

Please refer the below link

GOS Attachements!

Hope this helps you.

Regards,

Rama

Former Member
0 Kudos

Thanks Rama for helping.

ramakrishnappa
Active Contributor
0 Kudos

You are welcome

Answers (0)