Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Workflow for approving BOM

rekha_manjunath2
Participant
0 Likes
15,065

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

20 REPLIES 20
Read only

Sandra_Rossi
Active Contributor
0 Likes
14,656

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

Read only

rekha_manjunath2
Participant
0 Likes
14,656

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

5.png

Read only

14,656

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

Read only

rekha_manjunath2
Participant
0 Likes
14,656

Hi Friends,

Kindly review the screen shots and let me know please. It will be very helpful for me

Regards,

Rekha

Read only

0 Likes
14,656

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.

Read only

0 Likes
14,656

hi Sandra,

Apologies, will click on Comment. Sorry was not aware of this.

Read only

rekha_manjunath2
Participant
0 Likes
14,656

Hi Friends,

Kindly review the screen shots and let me know please. It will be very helpful for me

Regards,

Rekha

Read only

rekha_manjunath2
Participant
0 Likes
14,656

I have made my configurations in SWEC.

Read only

Sandra_Rossi
Active Contributor
0 Likes
14,656

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.

Read only

0 Likes
14,656

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.

Read only

0 Likes
14,656

how do i change the BOM status from 1(Active ) to 2(Inactive) inside the workflow. Not sure if that is getting triggered.

Read only

0 Likes
14,656

CS_H2M_MBOM_ADD_HEADER hasn't got the right interface. Why did you select this function module?

Please display field help.

Read only

0 Likes
14,656

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.

Read only

0 Likes
14,655

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.

Read only

0 Likes
14,655

Also if i start transaction CS01 , event (CHANGE) is triggered. Not sure how to change that flow.

Read only

0 Likes
14,655

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.

Read only

0 Likes
14,655

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.
Read only

0 Likes
14,655

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

Read only

0 Likes
14,655

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.

Read only

0 Likes
14,655

Sorry, I just saw that you created a new question.