Hello SAP Gurus,
I am working in developing a program for creation of Routing. I have used BAPI_ROUTING_CREATE for creating the routing with task, material task, Operations, Component allocation ,sequence and texts and with a return value. I was successful in creating the routing. Then customer requested for change functionality should work for Routing. I assume that we do not have any perfect BAPI for change functionality .I have checked ROUTING_MAINTAIN function module but in operations we do not have a deletion indicator field for setting deletion indicator.
Finally I have found a BAPI '/SAPMP/BAPI_ROUTING_PROCESS' and I was able to create the routing with this BAPI but I am getting error while trying to change the BAPI. The error is 'No Routing found'.
I assume this error is because of the importing parameter field 'work area'. Does any one how to fill this field during change.
Did any one has used the function module in your program to change the routing process since this function module has all the parameters which satisfy my requirement.
Kindly provide me the code as an example if any one has worked on this in your project.
Thanks
Raj
Request clarification before answering.
Hi Raj,
As a possible alternative to the mentioned BAPI, please have a look at the OSS note 488765 - Do-it-yourself EWB programming.
It's a very interesting note, with a sample program that illustrates some use cases.
Basically, the function modules in the Engineering Workbench (EWB, transaction CEWB) are available for routing and BoM processing.
For instance, the following FM's will allow routing creation, change, copy and deletion:
| CP_CL_S_OPR_CREATE | Creation |
| CP_CL_S_OPR_CHANGE | Change |
| CP_CL_S_OPR_COPY | Copying |
| CP_CC_S_DELETE_BY_OPR Deletion. |
In case of any doubt, just let me know. I have used this approach several times in the past, and proved to be always working properly.
I do hope this could be of some help.
Thanks and bye,
Flavio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Flavio,
Thank for the response.
For my case I should use task , Operation, Component allocation, Material assignment and text. For all the above cases I should be able to create, change and deletion. I fear that I should work and use multiple function modules for using above approach. If you have worked on all the above cases kindly provide me an example so that I can map accordingly in my program.
Thanks
Raj
Hi Raj,
Yes, right, multiple FM's shall be used. The basics are described in the sample program that is attached to the mentioned OSS note.
The typical program structure should be:
* load objects into EWB
CALLFUNCTION'CP_CC_S_LOAD_COMPLEX_BY_TSK'
EXPORTING
i_class = 'P'
i_classes_in_workarea = l_classes_in_workarea
i_cpsc_tsk_sel = l_tsk_selection
i_date_from = l_sttag
i_date_to = l_sttag
EXCEPTIONS
workarea_not_found = 1
workarea_wrong_type = 2
class_in_workarea_inconsistent = 3
workarea_not_specified = 4
opr_not_found = 5
no_selection_criteria = 6
invalid_selection_period = 7
key_date_required_for_ecm = 8
OTHERS = 9.
* provide all operations from EWB buffer
CALL FUNCTION 'CP_CL_S_OPR_PROVIDE'
TABLES
e_opr_class_data = lt_opr_class_data
EXCEPTIONS
wrong_key = 1
OTHERS = 2.
Then, lock the operations and reload operation again
* lock the operations and reload operations
LOOP AT lt_opr_class_data INTO l_opr_class_data.
MOVE-CORRESPONDING l_opr_class_data TO l_opr_ident.
APPEND l_opr_ident TO lt_opr_ident.
ENDLOOP.
CALL FUNCTION 'CP_CC_S_RELOAD_BY_OPR'
EXPORTING
i_flg_set_lock = 'X'
IMPORTING
e_opr_lock = lt_opr_lock
CHANGING
c_opr_ident = lt_opr_ident
EXCEPTIONS
reloading_not_allowed = 1
OTHERS = 2.
IF NOT lt_opr_lock[] IS INITIAL.
w_log-msg = text-110. w_log-msgty = 'E'.
RETURN.
ENDIF.
* again: provide all operations from EWB buffer
* reason: between first providing and locking another user can
* change the operations
CALL FUNCTION 'CP_CL_S_OPR_PROVIDE'
TABLES
e_opr_class_data = lt_opr_class_data
EXCEPTIONS
wrong_key = 1
OTHERS = 2.
CALL FUNCTION 'CP_CL_S_OPR_CHANGE'
EXPORTING
i_key_date_s = l_sttag
i_flg_opr_check = 'X'
i_opr_class_data = l_opr_class_data
EXCEPTIONS
operation_not_consistent = 1
no_authority = 2
wrong_operation_type = 3
no_valid_operation = 4
operation_not_locked = 5
wrong_operation_number = 6
ecm_data_not_suitable = 7
OTHERS = 8.
An useful way to understand how to work with this approach, is to set breakpoints in the concerned FM's and execute the activity (for instance, component allocation) from within the EWB, and check what the standard is doing.
Thank you and bye,
Flavio
Hi Raj,
Forgot to mention the unlocking of operation
* Release operation locks
LOOP AT lt_opr_ident INTO l_opr_ident.
CALL FUNCTION 'CP_CL_S_OPR_UNLOCK'
EXPORTING
i_plnty = l_opr_ident-plnty
i_plnnr = l_opr_ident-plnnr
i_plnal = l_opr_ident-plnal
i_plnfl = l_opr_ident-plnfl
i_plnkn = l_opr_ident-plnkn
i_ident = l_opr_ident-ident
EXCEPTIONS
wrong_parameters = 1
foreign_lock = 2
system_failure_lock = 3
update_required = 4
OTHERS = 5.
IF sy-subrc <> 0.
.....
ENDIF.
ENDLOOP.
* Remove objects from memory
CLEAR lt_tsk_ident. REFRESH lt_tsk_ident.
l_tsk_ident-mandt = sy-mandt.
l_tsk_ident-plnty = 'N'.
l_tsk_ident-plnnr = l_plnnr.
l_tsk_ident-plnal = l_plnal.
APPEND l_tsk_ident TO lt_tsk_ident.
CALL FUNCTION 'CP_CC_S_UNLOAD_BY_TSK'
EXPORTING
i_tsk_ident = lt_tsk_ident.
and the final saving
CALL FUNCTION 'CP_CC_S_SAVE'
EXCEPTIONS
ERROR_AT_SAVE = 1
OTHERS = 2.
IF sy-subrc <> 0.
ROLLBACK WORK.
ELSE.
COMMIT WORK AND WAIT.
ENDIF.
Thanks and bye,
Flavio
| User | Count |
|---|---|
| 18 | |
| 13 | |
| 9 | |
| 8 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.