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: 

Retrieve filename of attachment for inspection lot

Former Member
0 Kudos

Hi all,

How to get the attachment list for a particular inspection lot number(those attachment that appeared in QA03)?

I have google around it seems like function module GOS_ATTACHMENT_LIST_POPUP might do the trick.

My objective is to get the filename of the attachment.Can anyone spread some idea on this?

Regards,

Marlson

1 ACCEPTED SOLUTION

alejandro_bindi
Active Contributor
0 Kudos

Go through note 927407 - Determining the content of GOS and SAPoffice documents.

Basically:

1. Determine the BOR object in question as Frédéric already pointed out.

2. Use method CL_BINARY_RELATION=>READ_LINKS_OF_BINRELS to read the links. You are specially interested probably in those of type ATTA. In older SAP versions you call SREL_GET_NEXT_RELATIONS function module instead.

3. Call function SO_DOCUMENT_READ_API1. In parameter DOCUMENT_DATA you'll find the file name. You also get the file contents with this one.

I had the same doubt today, so I'm positive it works

Regards

4 REPLIES 4

FredericGirod
Active Contributor
0 Kudos

Hi Marlson,

you have to find the object corresponding to the Inspection lot

(have a look to the trans. OAM1, .. customizing .. ling .. )

and after write a code like this :

      MOVE : it_qcpr-certno TO is_object-instid ,

             'BUS2117'      TO is_object-typeid ,

             'BO'           TO is_object-catid .

      APPEND is_object TO it_objects.

* Création de la clef.

  MOVE : 'I'          TO is_role-sign ,
         'EQ'         TO is_role-option ,
         'GOSAPPLOBJ' TO is_role-low.
  APPEND is_role TO it_roles.
  MOVE : 'I'          TO is_relation-sign ,
         'EQ'         TO is_relation-option ,
         'ATTA'       TO is_relation-low .
  APPEND is_relation TO it_relations.

  MOVE : 'BIN' TO w_file_type.

* Extraction des liens.

  TRY.
      CALL METHOD cl_binary_relation=>read_links_of_objects
        EXPORTING
          it_objects          = it_objects

*    ip_logsys           =

          it_role_options     = it_roles
          it_relation_options = it_relations

*    ip_no_buffer        = SPACE

         IMPORTING
           et_links_a          = it_link_a.
    CATCH cx_obl_model_error .
    CATCH cx_obl_parameter_error .
    CATCH cx_obl_internal_error .
  ENDTRY.

Regards

Fred

0 Kudos

Hi Girod,

Thanks for your reply. Anyway I just want to get the title of the attachment.

What should I put for this field is_object-instid? Should I just put the inspection lot number(PRUEFLOS) for this field? I'm not quite understanding on how to get the object corresponding to the inspection lot.

Regards,

Marlson

alejandro_bindi
Active Contributor
0 Kudos

Go through note 927407 - Determining the content of GOS and SAPoffice documents.

Basically:

1. Determine the BOR object in question as Frédéric already pointed out.

2. Use method CL_BINARY_RELATION=>READ_LINKS_OF_BINRELS to read the links. You are specially interested probably in those of type ATTA. In older SAP versions you call SREL_GET_NEXT_RELATIONS function module instead.

3. Call function SO_DOCUMENT_READ_API1. In parameter DOCUMENT_DATA you'll find the file name. You also get the file contents with this one.

I had the same doubt today, so I'm positive it works

Regards

0 Kudos

Thanks for the precise explanation.

For the solution:

I have search through the object list in SWO1 and discover that BUS2045 is the SAP standard object for inspection lot.

   lwa_object-instid = iv_prueflos. "Inspection lot number

   lwa_object-typeid = 'BUS2045'.

   lwa_object-catid = 'BO'.