Background
This blog describes how to add customer-specific massprocessing functions to production-orders using navigation-profiles with classes.
SAP provides certain functions in COHV massprocessing (e.g. Mass-Release, Mass-Print, etc.). However the available functions are limited.
Many users are asking for a custom-specific functions as you can see in Additional Functions in COHV | SAP Community or
Add New Mass Function in COHV | SAP Community
But – there seems to be no way to add customer-functions to COHV.
Idea
A navigationprofile combined with class-usage might be a “good-enough” workaround. In my case, that is the case as i’ve been looking for a mass-processing for transaction LP10 “WM-Staging”.
Guilherme Frisoni describes in his article
How to use navigation profiles with classes | SAP Blogs
the general usage. It ends up with the generic access to all ALV-table-entries – and it needs few more abap-development to access the selected rows only.
As this is finally quite easy i wanted to share my approach (also based on a quite old answer from former member Yannik Function Parameter for a Class Call in a Navigation Profile | SAP Community )
Steps
- Create a customer-class implememting the interface IF_NAVIGATION_PROFILE
- Use following Coding for method USER_COMMAND
Kod:METHOD if_navigation_profile~user_command. DATA: lr_grid TYPE REF TO cl_gui_alv_grid. FIELD-SYMBOLS: <lt_table> TYPE STANDARD TABLE, "to be able to do READ ... INDEX <ls_table> TYPE ANY. DATA: lt_row TYPE lvc_t_row. FIELD-SYMBOLS <ls_row> TYPE LINE OF lvc_t_row. FIELD-SYMBOLS <lv_aufnr> TYPE afko-aufnr. TRY. lr_grid ?= io_alv. CATCH cx_sy_move_cast_error. MESSAGE i888(navigation_profile) WITH 'CAST-Error. ABAP-Developer should check'. ENDTRY. lr_grid->get_selected_rows( IMPORTING et_index_rows = lt_row ). IF lt_row IS INITIAL. MESSAGE i017(navigation_profile). "select at least a single line... ELSE. ASSIGN id_table->* TO <lt_table>. IF sy-subrc <> 0. MESSAGE i888(navigation_profile) WITH 'ASSIGN-Error. ABAP-Developer should check'. ELSE. LOOP AT lt_row ASSIGNING <ls_row>. READ TABLE <lt_table> ASSIGNING <ls_table> INDEX <ls_row>-index. ASSIGN COMPONENT 'AUFNR' OF STRUCTURE <ls_table> TO <lv_aufnr>. IF <lv_aufnr> IS ASSIGNED and <lv_aufnr> is not INITIAL. SET PARAMETER ID 'ANR' FIELD <lv_aufnr>. CALL TRANSACTION iv_parameter AND SKIP FIRST SCREEN. ELSE. MESSAGE i888(navigation_profile) WITH 'Strange... no AUFNR in structure?'. ENDIF. ENDLOOP. ENDIF. ENDIF. ENDMETHOD.
- Maintain the Navigation-Profile
This way you can use the same class for different tcodes.
Result
Each selected line gets processed by transaction LP10 in this example.
Comparison of Navigation-profile with class vs. COHV
- COHV is using application-log for all kind of messages / errorhandling.Above idea does a simple CALL-TRANSACTION – each error will be shown to the user.
The called transaction has to be a “single-screen” transaction, that can be used in a “fire & forget”-mode - Navigation-Profiles are really powerful to integrate customer-specific functions / tcodes
(compared to “closed shop” COHV)
Summary
The perfect solution (with errorhandling, etc.) would need a much more complex Z-program which would reinvent the existing COHV plus the missing function (in my case LP10).
This approach is quite easy, flexible and provides a lot of benefit.
Okumaya devam et...