Application Development and Automation 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: 
Read only

Customer master attachment list

Former Member
0 Likes
6,088

Hi Experts,

I would like to get the list of attachments from customer master. How to link the tables to get the attachments from the customer master.

Please help.

Thanks in adance

lakshminarayana

Hi Experts,

I would like to get the list of attachments from customer master. How to link the tables to get the attachments from the customer master.

Please help.

Thanks in adance

lakshminarayana

7 REPLIES 7
Read only

Former Member
0 Likes
3,895

Are you talking about this attachment list?

If so, it's called GOS, and yout objtype is KNA1.

You can see attachment files at table SRGBTBREL using:

INSTID_A: customer key

TYPEID_A: KNA1

So you will receive a object of SAP Office type... SOFM like:

FOL33000000000004EXT38000000000138

Now you need to get information about managing SOFM objects like downloading file, converting to binary etc.

You can go to SWO1 transaction and instantiate a SOFM object to see details:

The main table is SOOD.

I hope it helps!

Read only

0 Likes
3,895

Hi,

Thanks for your reply.

Can you please elaborate the process from SWO1 transaction.

My requirement is to develop a report displaying customer number, attached file name, file type and size of the file. Please let me know how to link KUNNR and SOOD table.

Thanks in advance

Lakshminarayana

Read only

0 Likes
3,895

From Kunnr to SOOD table is simple, but you need to access SRGBTBREL first...

SRGBTBREL-INSTID_A = KNA1-KUNNR

SRGBTBREL-TYPEID_A = "KNA1"

So you need to get the INSTID_B field.

Observe that INSTID_B field is the Object key of SOFM:

Then go to SOOD table with INSTID_B field:

SOOD-OBJTP = EXT

SOOD-OBJYR = 38

SOOD-OBJNO = 000000000138

Best regards,

Read only

0 Likes
3,895

Hi Leonardo,

I tryed as you said, It is working fine. similarly I need Vendor attachment list, I tryed similar to Customer attachment list, but I didn't get any data. Could you please let me know the procedure to get Vendor attachment list.

Thanks a lot for your help

Read only

GauthamV
Active Contributor
0 Likes
3,895

To display GOS toolbar with customer master attachments, use below logic.

Data: gt_manager        TYPE REF TO cl_gos_manager,

         gt_obj                TYPE borident.

        gt_obj-objtype =  'KNA1'.
        gt_obj-objkey  =  kna1-kunnr.


** GOS toolbar


      CREATE OBJECT gt_manager
        EXPORTING
          is_object          = gt_obj
          ip_no_commit   = space
          ip_mode           = 'D'
        EXCEPTIONS
          others       = 1.

Read only

FredericGirod
Active Contributor
0 Likes
3,895

Hi,

Data:

         it_objects        TYPE sibflporbt,

         it_roles          TYPE obl_t_rolt ,

         it_relations      TYPE obl_t_relt ,

         it_link           TYPE obl_t_link ,

    CONCATENATE ...kunnr ..

                INTO is_object-instid.

    MOVE : 'KNA1'     TO is_object-typeid ,

           'BO'         TO is_object-catid .

    APPEND is_object TO it_objects.

* Alimentation 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
          it_role_options     = it_roles
          it_relation_options = it_relations
        IMPORTING
          et_links_a          = it_link.
    CATCH cx_obl_model_error.
    CATCH cx_obl_parameter_error.
    CATCH cx_obl_internal_error.
  ENDTRY.

regards

Fred

Read only

chundru_ravindra
Participant
0 Likes
3,895

Hi,

You can Do like this,

  SELECT * FROM SRGBTBREL INTO TABLE LT_SRGBTBREL WHERE TYPEID_A EQ 'KNA1'

                                                                                                                  AND CATID_A   EQ 'BO'.

  IF SY-SUBRC = 0.

    SORT LT_SRGBTBREL BY INSTID_A TYPEID_A CATID_A.

    DELETE ADJACENT DUPLICATES FROM LT_SRGBTBREL COMPARING INSTID_A                                                                        TYPEID_A CATID_A.

 

      WA_OPTION-SIGN = 'I'.

      WA_OPTION-OPTION = 'EQ'.

      WA_OPTION-LOW = 'ATTA'.

      APPEND WA_OPTION TO LT_OPTIONS.

    CLEAR : WA_SRGBTBREL.

    LOOP AT LT_SRGBTBREL INTO WA_SRGBTBREL.

      CLEAR : WA_LOR.

      WA_LOR-INSTID = WA_SRGBTBREL-INSTID_A.

      WA_LOR-TYPEID = WA_SRGBTBREL-TYPEID_A.

      WA_LOR-CATID  = WA_SRGBTBREL-CATID_A.

      TRY.

*Getting all the links

          CALL METHOD CL_BINARY_RELATION=>READ_LINKS_OF_BINRELS

            EXPORTING

              IS_OBJECT           = WA_LOR

              IT_RELATION_OPTIONS = LT_OPTIONS

              IP_ROLE             = 'GOSAPPLOBJ'

            IMPORTING

              ET_LINKS            = LT_LINKS.

          CLEAR : WA_LINKS.

*looping for multiple attachments of each instance id

          LOOP AT LT_LINKS INTO WA_LINKS.

            CASE WA_LINKS-TYPEID_B.

              WHEN 'MESSAGE'.

                WA_KEY = WA_LINKS-INSTID_B.

                MOVE-CORRESPONDING WA_KEY TO WA_ATTACHMENT.

                WA_ATTACHMENT-ROLETYPE = WA_LINKS-ROLETYPE_B.

                IF WA_LINKS-BRELGUID IS INITIAL.

                  WA_ATTACHMENT-BRELGUID = WA_LINKS-RELGUIDOLD.

                ELSE.

                  WA_ATTACHMENT-BRELGUID = WA_LINKS-BRELGUID.

                ENDIF.

                APPEND WA_ATTACHMENT TO LT_ATTACHMENT.

              WHEN 'OTHERS'.

                CONTINUE.

            ENDCASE.

          ENDLOOP.

        CATCH CX_OBL_PARAMETER_ERROR .

        CATCH CX_OBL_INTERNAL_ERROR .

        CATCH CX_OBL_MODEL_ERROR .

        CATCH CX_ROOT.

      ENDTRY.

    ENDLOOP.

*checking for attachments

    CHECK LINES( LT_ATTACHMENT ) > 0.

*Fetching all the attachments from the table 'SOOD'

    SELECT * FROM SOOD INTO TABLE LT_SOOD

              FOR ALL ENTRIES IN LT_ATTACHMENT

            WHERE OBJTP = LT_ATTACHMENT-OBJTP

              AND OBJYR = LT_ATTACHMENT-OBJYR

              AND OBJNO = LT_ATTACHMENT-OBJNO.

*If you want to download attachments into your PC

    LOOP AT LT_SOOD INTO WA_SOOD.

  Use this FM 'SO_OBJECT_DOWNLOAD'

    ENDLOOP.

Finally Declare all the variables with respective types.

Regards,

Ravindra.