‎2022 Jan 04 6:41 AM
Hi Friends,
I have a scenario with single step approval for workflow. The scenario is
User tries to create or change BOM (CS01 / CS02). The status of BOM should be made inactive (2) while saving.
Once the BOM is saved, it has to be sent to approver to approve the BOM.
The approvers are maintained in one role (provided by functional). I am new to workflow and i am not sure what should be the steps to be performed. Have checked several forums and tried to replicate it. I have created a custom BOM in SWO1 using BUS1080 and created 2 events create and change.
But what ever i execute, its always the change event which will trigger. Could you please provide what steps to start with and what all should be noted till it completes the workflow.
Help will be really appreciated, as i am stuck at this position and not able to proceed.
Regards,
Rekha
‎2022 Jan 04 7:53 AM
Could you explain what code you did to trigger the custom events? Via change documents?
NB: this other discussion contains information about doing the changes: Business object BUS1080 with 3 events | SAP Community
‎2022 Jan 04 8:57 AM
Hi Sandra,
Thanks so much for your response. Not sure how the events are triggered. As i have copied from standard BO, i have not written any exit or enhancement to trigger this. Not sure what i am doing is right or wrong. I have attached all the screen shots of what i have performed in the workflow.
Regards,
Rekha2.png







‎2022 Jan 04 2:28 PM
If you want to target someone, if this person has posted an Answer, use the button COMMENT, if this person is the Original Poster of the question he/she will be automatically informed, otherwise copy/paste their hyperlinked name so that the person receives a warning (NB: @ doesn't work/but typing this character will suggest hyperlinked names).
Example: rekha.manjunath2
‎2022 Jan 04 1:36 PM
Hi Friends,
Kindly review the screen shots and let me know please. It will be very helpful for me
Regards,
Rekha
‎2022 Jan 04 2:35 PM
Please use the COMMENT button for comments, questions, adding details, replying to a comment or a proposed solution or to the OP question, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.
‎2022 Jan 04 2:44 PM
hi Sandra,
Apologies, will click on Comment. Sorry was not aware of this.
‎2022 Jan 04 2:44 PM
Hi Friends,
Kindly review the screen shots and let me know please. It will be very helpful for me
Regards,
Rekha
‎2022 Jan 04 2:47 PM
‎2022 Jan 04 8:52 PM
I don't understand why CS01 always creates change documents in CDHDR with CHANGE_IND always set to "U" (which leads at looking at event in SWEC "on update" by default).
What you can do is defining a custom function module in SWEC to select the Event ID you want ("CREATED"), for instance by checking if [EDIT] the parameter CHANGEDOCUMENT_HEADER-TCODE is equal to CS01 (better use this parameter rather than my old proposal SY-TCODE / CL_ABAP_SYST=>GET_TRANSACTION_CODE( ) which maybe won't work as the function module is called in an update task (?)).
Maybe it's not a good idea, I don't know much of Materials Management.
‎2022 Jan 05 4:17 AM
There is a standard FM "CS_H2M_MBOM_ADD_HEADER" which has info on header. Can the same be used in the event ID.
Is this the place for me to create container, how would i have to create the container.

‎2022 Jan 05 4:21 AM
how do i change the BOM status from 1(Active ) to 2(Inactive) inside the workflow. Not sure if that is getting triggered.
‎2022 Jan 05 8:00 AM
CS_H2M_MBOM_ADD_HEADER hasn't got the right interface. Why did you select this function module?
Please display field help.
‎2022 Jan 05 8:25 AM
Concerning the update of BOM status, it's a completely different question, maybe you'll reach more people by posting a new question. NB: I have found the same question with two answers.
‎2022 Jan 05 9:17 AM
i did a search and found this CS_H2M_MBOM_ADD_HEADER which is related to BOM.
I am stuck at a place for workflow triggering part. The mail is triggering to approver , but the material number is not being displayed. Approver is not able to approve for that specific material number. If this taken care then the workflow is working fine.
Could anyone please help on this.

‎2022 Jan 05 9:19 AM
Also if i start transaction CS01 , event (CHANGE) is triggered. Not sure how to change that flow.
‎2022 Jan 05 11:42 AM
In the email, &Material& refers to container element named "Material".
For having event CREATED instead of CHANGED, what you can do is defining a custom function module in SWEC to select the Event ID you want ("CREATED"), for instance by checking if the parameter CHANGEDOCUMENT_HEADER-TCODE is equal to CS01. See field help in SWEC.
‎2022 Jan 05 2:18 PM
not sure whether it works (not clear to me if APPEND to events is needed), but you get the idea:
FUNCTION Z_SWEC_MATERIAL_BOM_CREATED
IMPORTING
VALUE(CHANGEDOCUMENT_HEADER) TYPE CDHDR OPTIONAL
VALUE(OBJECTTYPE) TYPE SIBFOTYPE OPTIONAL
VALUE(EVENT) TYPE SWECDEXIT-EVENT OPTIONAL
TABLES
CHANGEDOCUMENT_POSITION LIKE CDPOS OPTIONAL
EVENTS LIKE SWE_S_EVT OPTIONAL.
IF changedocument_header-tcode = 'CS01'.
events-event = 'CREATED'.
ENDIF.
ENDFUNCTION.
‎2022 Jan 06 4:25 PM
hi Sandra,
I have created custom BO, parameters and in the program i have created my logic to change the status. But now my problem is the agents are not determining. I have assigned role and agents need to be picked from role. It was appearing earlier, not it has stopped suddenly. Dont know what caused this. Do you have any suggestion to this.
Regards,
Rekha
‎2022 Jan 06 4:56 PM
The question was about to trigger the event CREATED. I don't even know if you succeeded. If you want to discuss another point, please create a new question.
‎2022 Jan 06 4:59 PM