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: 

Get attached file

Former Member
0 Kudos

Hello,

I need to retrieve a file attached to a purchase order document. I know this file is stored on the database and what i need is to get it and store it in a file in the hard drive.

How can i do this?

Thank you in advance

Nuno Silva

12 REPLIES 12

Former Member
0 Kudos

Hi,

Use this FM BDS_BUSINESSDOCUMENT_GET_TAB.

You need to pass

EXPORT PARAMETERS:

LOGICAL SYSTEM

CLASSNAME - 'BUS2012'

CLASSTYPE - 'BO'

OBJECT_KEY - PO Number

TABLES PARAMETERS

SIGNATURE

COMPONENTS

CONTENT

Regards,

Satish

0 Kudos

Hi Satish,

Thank you for the info, but can you point to how can i get those parameters i need to export?

Thank you

Nuno Silva

0 Kudos

Hi,

Go to OAOR Transaction, give the class name as BUS2012 and class type as 'BO' and object key as PO Number(which ever has the attachment).

You will get the SIGNATURE & COMPONENT DETAILS of that attachment in the bottom of the screen properties window.

Pass all the values to the FM and you will get the content into CONTENTS Parameter of the FM.

Download the content to the local system using FM GUI_DOWNLOAD.

Right now i am not infront of SAP system, so i am not able to give you more information.

<b>Reward Points for helpful answers</b>,

Satish

0 Kudos

Hello,

I checked in OAOR and the attachment is actually there.

But when going thru the FM i don't know what to put in LOGICAL_SYSTEM and if i leave it blank it returns NOTHING_FOUND.

Why is this?

Thank you,

Nuno Silva

0 Kudos

Hi,

LOGICAL_SYSTEM keep your SAP Logical system name ex: EC1CLNT800.

You can see the logical system in BD54 transaction.

Regards,

Satish

0 Kudos

Thank you,

But it still says nothing found.

Any idea why?

Nuno Silva

0 Kudos

Hello,

After some investigation i found out that as this is a GOS attachment your solution does not work.

I know how to find the attachment list connected to the object using FM BDS_GOS_CONNECTIONS_GET but i do not know how to obtain the data in these files.

Any idea?

Thank you

Nuno Silva

0 Kudos

I think It doesn't matter whether it is GOS or BDS, I could attach the file using BDS Method in GOS Attahment list. That means, it is possible even to read. right?

Regards,

Satish

0 Kudos

That should probably be true, but when using the FM BDS_BUSINESSDOCUMENT_GET_TAB it is not returning anything.

And in fact the attachment is there.

0 Kudos

Hello,

When i open the GOS in the ME23N trasaction there is a export option and that is exactly what i need.

I know that the program used the FM SO_DOCUMENT_VIEW_MANAGER to do this but i do not know how to obtain the data for the FM.

Do you know how can i do this?

Best regards,

Nuno Miguel Silva

former_member195698
Active Contributor
0 Kudos

From your query what i could get is your PO has documents attached to it and those documents will be stored in Business Documents in BSD.

You can use the following information to get the information of these documents.

BDS_BUSINESSDOCUMENT_GET_INFO

BDS_PHIO_GET_RIGHT

SDOK_PHIOS_FILE_PROPERTIES_GET

SCMS_R3DB_GET

The FM SCMS_R3DB_GET will return the file data in Binary format.

You can use the FM DOWNLOAD to download the Binary Data to your Frontend Server.

<b>Reward Points if useful</b>

Regards,

Abhishek

Former Member
0 Kudos

Devi usare FM SO_DOCUMENT_READ_API1.

Prima si cerca il documento con FM BDS_GOS_CONNECTIONS_GET da qui si ottiene DOCUMENT_ID

Esempio:

( You have to use FM SO_DOCUMENT_READ_API1.

Before you search for the document with FM BDS_GOS_CONNECTIONS_GET from here you get document_id

example: )

  CALL FUNCTION 'BDS_GOS_CONNECTIONS_GET'

    EXPORTING

*   LOGICAL_SYSTEM           =

      classname                = 'ZFPLT'

      objkey                   = '0000017803000001'

*   CLIENT                   = SY-MANDT

    TABLES

      gos_connections          = lt_gos_connections

e quindi internamente a

( and then internally to )

loopt at lt_gos_connections

CALL FUNCTION 'SO_DOCUMENT_READ_API1'

  EXPORTING

    document_id                      = lt_gos_connections-bds_docid

*   FILTER                           = 'X '

  IMPORTING

    DOCUMENT_DATA                    =

  TABLES

    OBJECT_HEADER                    =

    OBJECT_CONTENT                   =

    OBJECT_PARA                      =

    OBJECT_PARB                      =

    ATTACHMENT_LIST                  =

    RECEIVER_LIST                    =

    CONTENTS_HEX                     =

Translations done for better responses and awareness.

Message was edited by: Venkat Gowrishankar