Application Development 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: 

Changing of BOM status through workflow

rekha_manjunath2
Participant
0 Kudos

Hi Experts,

I have created a workflow for changing the status of BOM. The flow is as below : Workflow gets triggered (created a custom class and method) through CS01 / CS02 (Fiori App)>The status of BOM initially should be set to 2(Inactive) > This request comes to inbox of approver to approve or reject > If the approver approves the status of BOM should change to 1(Active). I tried to use the BAPI_BOM_UPDATE_SAVE but this is not updating the status. so i have tried to use FM DB_UPDATE_TABLE. Also in the workflow if the approver approves or rejects the initiator gets an alert.

But the workflow does not complete?.

How should the workflow conclude.?

What should i perform to conclude the workflow.?

Could anyone please help me with this issue, i have searched the forums for all suggestion, but did not find. Please provide me the FM or BAPI along with a example code .

This issue is pending from many days and i am unable to update this. Please help me.

Thanks in advance

Regards,

Rekha

      CALL FUNCTION 'DB_UPDATE_TABLE'
EXPORTING
tablename = lc_stko
TABLES
inttab = lt_stko
EXCEPTIONS
db_error = 1
not_found = 2
wrong_param = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc = 0.
COMMIT WORK.
ENDIF.
8 REPLIES 8

DominikTylczyn
Active Contributor

Hello rekha.manjunath2

I think you have two problems.

The first one is your workflow design that doesn't end. It's really hard to tell what's going on based on your screenshot. I suspect that the issue is with "Mail Approval BOM" step which is a dialog step. That means that someone has to execute that step from their inbox. That step is still waiting to be executed, therefore your workflow is not finished. If this step is to send an email notification, then it should be defined as a background step.

The second one is the way you update the BOM. You should never update SAP data directly on database level, even if you wrap such an update in DB_UPDATE_TABLE function. That's a sure-fire recipe for data inconsistency. Why don't you try the CSAP_MAT_BOM_MAINTAIN function instead? It's part of APIs for Logistics.

Best regards

Dominik Tylczynski

0 Kudos

Hi Dominik,

Thank u so much!!

1) for the 1st issue of workflow not finishing, yes as u have suspected, the initiator receives a notification, if that is set to approve workflow ends. But how can i avoid that step? Am not sure how to take that forward. If the initiator receives the notification that should be the end of workflow. How to define as background step.

2) For the 2nd issue if i am running the FM explicitly im getting error. How should i pass the value from this FM to my workflow?

Regards,

Rekha

0 Kudos

hi Dominic,

Could you please help me on how to use APIs I’m new to workflow and not sure how to use them.

Regards

Rekha

rekha.manjunath2 Are you asking Dominik only, or the whole community?

0 Kudos

Hi sandra.rossi

I was asking the community, if anyone could help me for this issue. Its a very long pending issue and not knowing how to proceed.

Could you please help me solve this. I have searched all the forums, but i am not getting to know how to pass the value to workflow and to update BOM status in (CS03 / CS02) after approval.

Regards,

Rekha

rekha.manjunath2

For defining a background task, the workflow step refers to a task, which has a checkbox "background processing". Select this checkbox and the workflow won't stop at this step, it will be executed immediately, and the workflow will continue at the next step.

For the BOM update, no idea.

Sandra_Rossi
Active Contributor
0 Kudos

As Dominik said, you should never use DB_UPDATE_TABLE to update a standard table. You should use only official APIs which guarantee there are some coherence checks made by SAP.

rekha_manjunath2
Participant
0 Kudos

hi All,

Could anyone please help me with an example code so that i will be able to implement accordingly.

Regards,

Rekha