cancel
Showing results for 
Search instead for 
Did you mean: 

Write to a work flow container.

Madhu2004
Active Contributor
0 Kudos

hi experts,

It may be a basic question but please guide how to do the following:

i am using an RFC to through which i need to write data to workflow conatiner.

but workflow conatiner has the structure which hass the following elemnts:

1) element 2) value.

Now i have a table of values : for ex: a table containing empno,empname, cur_sal and new_sal.

how to write the values into the work flow conatiner?

Regards,

Madhu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You have to create Identical Workflow Container element in Workflow Template.Use Function Module SAP_WAPI_WRITE_CONTAINER

.Please close thread if resolved.

Thanks

Arghadip

Madhu2004
Active Contributor
0 Kudos

Hi,

my scenario i si am triggering a workflow after creationg a notification. After triggering the workflow, i need to write some data to workflow conatiner. i ma using the method mentioned by you but i donot know the procedure to update the conatiner.because it has 2 variables, can u give me a sample example on how to write to a container.

Madhu

Former Member
0 Kudos

Check this FM SWU2_INPLACE_DECISION_PROCESS. It is being used there.

Element: Name of Container Element Like Employee(In workflow Container)

Value: Value you want to write.

Thanks

Arghadip

Madhu2004
Active Contributor
0 Kudos

Hi,

Thanks for your early replies.

The problem i am facing is, i am unable to write to a workflow conatiner. the workflow container has a emp_data stucture with emp_name and emp_no as fields. and the table which contains the data has the same fileds.

now how to write the data.

plz can you explain the process to write the data to the container??

Thankd,

Madhu

Former Member
0 Kudos

Check this code it is not similar but it will be of help use macros

SWC_SET_ELEMENT

SWC_SET_TABLE

Please check program <CNTN01> for macros.

FUNCTION zwf_process_trip.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(I_EMP_NUMBER) TYPE PERNR_D

*" VALUE(I_EMP_TRIP) TYPE REINR

*"----


INCLUDE <cntn01> .

DATA:i_emp_details TYPE STANDARD TABLE OF p0001, "Employee Details

wa_request TYPE p0001, "Workarea for Employee details

v_country_grp TYPE molga, "Country SubGrouping

v_object_key TYPE sweinstcou-objkey. "Key for the buisness object ZWOBUSTRIP

CONSTANTS: c_bo_trip TYPE swo_objtyp VALUE 'ZWOBUSTRIP',

c_event_trip TYPE swo_event VALUE 'TripCreate',

c_infy_type_1 TYPE infty VALUE '0001'.

  • Event Container declaration

swc_container i_event_cont.

swc_create_container i_event_cont.

  • Reading the INFO TYPE 0001 to obtain the

  • Employee details

CALL FUNCTION 'HR_READ_INFOTYPE'

EXPORTING

pernr = i_emp_number

infty = c_infy_type_1

begda = sy-datum

endda = sy-datum

TABLES

infty_tab = i_emp_details

EXCEPTIONS

infty_not_found = 1

OTHERS = 2.

  • SY-SUBRC check is not required as the error

  • handelling will be done by WorkFlow rule

  • resolution.

CLEAR wa_request.

READ TABLE i_emp_details INTO wa_request INDEX 1.

IF sy-subrc = 0.

  • Retrieving the Country SubGrouping for the employee

SELECT SINGLE molga

FROM t001p

INTO v_country_grp

WHERE werks = wa_request-werks

AND btrtl = wa_request-persk.

ENDIF.

  • Sending the relevant data to event container

swc_set_element i_event_cont 'EmpId' i_emp_number.

IF sy-subrc <> 0.

  • No Processing needed.

ENDIF.

swc_set_element i_event_cont 'PersonnelArea' wa_request-werks.

IF sy-subrc <> 0.

  • No Processing needed.

ENDIF.

swc_set_element i_event_cont 'CountryGrouping' v_country_grp.

IF sy-subrc <> 0.

  • No Processing needed.

ENDIF.

swc_set_element i_event_cont 'EmpSubGrp' wa_request-persk.

IF sy-subrc <> 0.

  • No Processing needed.

ENDIF.

swc_set_element i_event_cont 'EmpTripId' i_emp_trip.

IF sy-subrc <> 0.

  • No Processing needed.

ENDIF.

  • Raising the event to trigger the workflow

v_object_key = i_emp_number.

CALL FUNCTION 'SWE_EVENT_CREATE'

EXPORTING

objtype = c_bo_trip

objkey = v_object_key

event = c_event_trip

TABLES

event_container = i_event_cont

EXCEPTIONS

objtype_not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • No Processing needed.

ENDIF.

COMMIT WORK.

ENDFUNCTION.

Thanks

Arghadip

Madhu2004
Active Contributor
0 Kudos

THANKS VERY MUCH.............

martin_nooteboom
Active Contributor
0 Kudos

I hope you didn't switch to the SWE FM's. Could you let us know how you solved it, this will make it clear to others who will search for a similar requirement also.

Regards,

Martin

Madhu2004
Active Contributor
0 Kudos

yes i did not sole my problem using swe_*, but i am using the function module sap_wapi_start _workflow and writing it in to the container

Answers (0)