Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

Using SOFM Object for Adding GOS Attachments to Work item

$
0
0

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.

 

0.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

2.png1.png

3.png

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

   4.png

  • Binding the "Get Attachment List" Task

     5.png

  • Binding from Workflow to User Decision Step

        6.png

 

 

Testing the Workflow using SWUS

 

7.png


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>