Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
jschoetteler
Participant

Background


This blog-post 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 https://answers.sap.com/questions/11613055/additional-functions-in-cohv.html or
https://answers.sap.com/questions/35234/add-new-mass-function-in-cohv.html

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
https://blogs.sap.com/2013/04/23/how-to-use-navigation-profiles-with-classes/
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 https://answers.sap.com/answers/7726483/view.html )

Steps



  1. Create a customer-class implememting the interface IF_NAVIGATION_PROFILE

  2. Use following Coding for method USER_COMMAND
    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.​


  3. Maintain the Navigation-Profile
    Trick: The function-parameter is used as the tcode for the mass-processing.
    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.
6 Comments
Labels in this area