Skip to Content
Author's profile photo Mithun Shetty

Using SOFM Object for Adding GOS Attachments to Work item

Prerequisites: Basic Knowledge on Workflow and Generic Object Services

Summary: In this Scenario we are using Business Object for Inbound Delivery (BUS2015). We have created a Subtype of the Object to include a few Events and Methods.  The Requirement here is to fetch the GOS Attachments for Inbound Delivery in ECC and add the Attachment in the User Decision Step of workflow.

/wp-content/uploads/2014/03/0_415119.png

Process

  • Create a method in the Business Object which will provide you the details of the Business Document Service: Document ID. Since there can be more than one attachment we create a internal  Table of type SWC_OBJECT.
  • Create an output Parameter of type ATTLIST which refers to OBJECT “SOFM”



BEGIN_METHOD CREATEATTACHMENT CHANGING CONTAINER.

 DATA: ls_lpor           TYPE sibflporb,
 lt_conn           TYPE TABLE OF bdn_con,
 ls_conn           TYPE bdn_con.

 TYPES :BEGIN OF ty_conn,
 LOIO_ID TYPE  BDS_DOCID,
 END of ty_conn.

 DATA: lt_conn1 type standard table of ty_conn,
 ls_conn1 type ty_conn.

 * Constants
 CONSTANTS : lc_x        TYPE  char1      VALUE 'X',
 lc_bus2015  TYPE  bds_clsnam VALUE 'BUS2015',
 lc_clstype  TYPE  char2      VALUE 'BO',
 lc_e        TYPE  char1      VALUE 'E',
 lc_t        TYPE  char1      VALUE 'T',
 lc_b        TYPE  char1      VALUE 'B'.

 *--Attachments
 DATA:ATTLIST TYPE SWC_OBJECT OCCURS 0.
 DATA:ATT     TYPE SWC_OBJECT.

 DATA:BEGIN OF SOFMKEY,
 KEY TYPE SWO_TYPEID,
 END OF SOFMKEY.

 DATA:l_delivery type vbeln.

 SWC_GET_ELEMENT CONTAINER 'Delivery' l_delivery.

 if OBJECT-KEY-DELIVERY is NOT initial.
 MOVE OBJECT-KEY-DELIVERY TO ls_lpor-instid.
 else.
 MOVE l_DELIVERY TO ls_lpor-instid.
 endif.
 ls_lpor-typeid  = lc_bus2015.
 ls_lpor-catid   = lc_clstype.

 CALL FUNCTION 'BDS_ALL_CONNECTIONS_GET'
 EXPORTING
 classname        = lc_bus2015
 classtype        = lc_clstype
 objkey           = ls_lpor-instid
 all              = lc_x
 no_gos_docs      = ''
 TABLES
 all_connections  = lt_conn
 EXCEPTIONS
 no_objects_found = 1
 error_kpro       = 2
 internal_error   = 3
 not_authorized   = 4
 OTHERS           = 5.

 loop at lt_conn into ls_conn.
 move ls_conn-LOIO_ID to SOFMKEY-key.

 SWC_CREATE_OBJECT ATT 'SOFM' SOFMKEY.

 * Insert object reference into multiline object reference
 APPEND ATT TO ATTLIST.
 clear ls_conn.

 endloop.

 SWC_SET_TABLE CONTAINER 'ATTLIST' ATTLIST.
 END_METHOD

  • Create a task which will transfer the Output ATTLIST to the workflow element

/wp-content/uploads/2014/03/2_415120.png /wp-content/uploads/2014/03/1_415153.png

/wp-content/uploads/2014/03/3_415151.png

  • Create a User Decision Task in the Workflow and create a Element T_ATTACHMENT of type SOFM

   /wp-content/uploads/2014/03/4_415154.png

  • Binding the “Get Attachment List” Task

     /wp-content/uploads/2014/03/5_415155.png

  • Binding from Workflow to User Decision Step

        /wp-content/uploads/2014/03/6_415156.png

Testing the Workflow using SWUS

/wp-content/uploads/2014/03/7_415160.png

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Modak Gupta
      Modak Gupta

      Very Nice Mithun!

      This is required at many places!

      Regards,

      Modak

      Author's profile photo Former Member
      Former Member

      Hello Mithun,

      Thanks a lot for the nice post.

      Aashish

      Author's profile photo Suresh Subramanian
      Suresh Subramanian

      Very useful document.

      Thank you so much for sharing !

      Author's profile photo Ranjeet Srivastav
      Ranjeet Srivastav

      Hello everyone,

      I have to add pdf output of material pr and service pr with triggered mail pf PR Release.

      Kindly help me to do it.

      Regards

      Ranjeet

      Author's profile photo Former Member
      Former Member

      Thank you Mithun.

       

      Very Nice Document.

       

      Author's profile photo Dursun Fadime
      Dursun Fadime

      ,