Skip to Content
author's profile photo Former Member
Former Member

How to find Attachment in po (Services for object) at in any exit.

hi every one,

i have requirement to find out Document Attachment in po (Services for object) at exit where i can send mail to vendor with po output as pdf and attachment document of po...

how it possible ......................?

Untitled.png (99.7 kB)
Untitledaa.png (50.8 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 13, 2015 at 10:24 AM

    Hi Suresh,

    I believe you are using Output technique to generate the PO Output. You can use the Output form routine you can use cl_binary_relation=>read_links and then SO_OBJECT_READ to read the GOS attachment for PO or Material and then use CL_BCS and CL_DOCUMENT_BCS classes to send mail.

    If you just want to send mail with the GOS attachment, you can have a look at the BADI ME_PROCESS_PO_CUST Method POST to write your own code there.

    Sample code:

    * buseinss object key

    DATA: gs_lpor TYPE sibflporb.


    gs_lpor-instid = <matnr> or <po>

    gs_lpor-typeid = 'BUS1001006'. "For Material or BUS2012 for PO

    gs_lpor-catid = 'BO'.


    * attachment type selection

    DATA: lt_relat TYPE obl_t_relt,

    la_relat LIKE LINE OF lt_relat.


    la_relat-sign = 'I'.

    la_relat-option = 'EQ'.

    la_relat-low = 'ATTA'.

    APPEND la_relat TO lt_relat.


    * Read the links

    DATA: t_links TYPE obl_t_link,

    la_links LIKE LINE OF t_links.


    DATA: lo_root TYPE REF TO cx_root.



    CALL METHOD cl_binary_relation=>read_links


    is_object = gs_lpor

    it_relation_options = lt_relat


    et_links = t_links.

    CATCH cx_root INTO lo_root.




    * Read Attachment contents


    DATA l_folder_id TYPE soodk.

    DATA l_object_id TYPE soodk.

    DATA document_id TYPE sofmk.


    * Get document id

    READ TABLE t_links INTO la_links INDEX 1. "Or you can loop for multplie attachment


    document_id = la_links-instid_b.


    * Set folder

    l_folder_id-objtp = document_id-foltp.

    l_folder_id-objyr = document_id-folyr.

    l_folder_id-objno = document_id-folno.


    * Set Object

    l_object_id-objtp = document_id-doctp.

    l_object_id-objyr = document_id-docyr.

    l_object_id-objno = document_id-docno.


    * Read the document content

    DATA document_content TYPE STANDARD TABLE OF soli.




    folder_id = l_folder_id

    object_id = l_object_id


    objcont = document_content "This is your attachment


    active_user_not_exist = 1

    communication_failure = 2

    component_not_available = 3

    folder_not_exist = 4

    folder_no_authorization = 5

    object_not_exist = 6

    object_no_authorization = 7

    operation_no_authorization = 8

    owner_not_exist = 9

    parameter_error = 10

    substitute_not_active = 11

    substitute_not_defined = 12

    system_failure = 13

    x_error = 14

    OTHERS = 15.

    IF sy-subrc NE 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 13, 2015 at 11:11 PM

    Dear Suresh,

    You can find the Attachment for every PO at table "SRGBTBREL", in INST_A field you can put the PO number and then apply the steps mention by Rudra.


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.