Skip to Content
Personal Insights
Author's profile photo Joachim Rees

Modern SAP warehousing (EWM) makes me use old ABAP

I am an ABAP developer.
And you might know that I claim to do “modern” ABAP.

But programming in a modern SAP warehousing solution – SAP EWM – makes me use old ABAP.
Like function modules.
And maybe even dynpros.

An example is the /SCWM/MON: the nodes have to be FMs, the methods as well.

Here is an example monitor method:

FUNCTION Z_MON_METHOD_PAINT_HU
  IMPORTING
    IV_LGNUM TYPE /SCWM/LGNUM
    IT_DATA TYPE /SCWM/TT_LIME_ALL_MON.

*Allow just 1 line
  IF lines( it_data ) <> 1.
    "Please select exactly 1 line for this method!
    MESSAGE s003 DISPLAY LIKE 'W'.
    RETURN.
  ELSE.
    DATA(ls_hu_data) = it_data[ 1 ].
  ENDIF.

*Ask for Input ("what colour to paint the HU?")
gs_hu_paint_dynpro-huident = ls_hu_data-huident
  CALL SCREEN c_screen_paint_HU STARTING AT 10 10 .
*make sure no cancel etc. 
  IF g_fcode NE c_fcode_save.
    RETURN.
  ENDIF.

* do the actual work in ABAP OO:
go_my_mon_node->paint_hu_in_colour( i_huident = gs_hu_paint_dynpro-huident 
				    i_colour = gs_hu_paint_dynpro-colour_to_paint ). 

ENDFUNCTION.

You know what: I think it’s not that bad, actually.

What do you think?
Do you use old ABAP?
Do you have to?

Best
Joachim

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Robert Forster
      Robert Forster

      Hi,

      FM still alive!

      Try to use Try...Catch for ls_hu_data = it_data[ 1 ].

      Will make your ABAP little more modern.

      And delete the obvious comments for Clean code: Comment why not what

       

      Cheers

      Robert

      Author's profile photo Daniil Mazurkevich
      Daniil Mazurkevich

      try ... catch there not needed, it is one line in the table

      Author's profile photo Matthew Billingham
      Matthew Billingham

      I still use old stuff. Sometimes I'm working on a legacy program - I'll improve it a bit. Much of my work is still using SAPGui as the front end, so I'm still using selection screens, dynpros and function modules. I generally skip off into methods as soon as its possible. I'm pragmatic about it though.

      Recently I did something like this

      METHOD zif_my_app~start_my_app_screen.
        CALL FUNCTION 'Z_MY_APP'
            EXPORTING i_instance = me.
      ENDMETHOD.
      
      ...
      
      FUNCTION 'Z_MY_APP'
        IMPORTING i_instance TYPE REF TO zif_my_app.
      
        g_instance = i_instance.
        CALL SCREEN '200'.
      ...
      ENDFUNCTION.
      
      ...
      
      MODULE status_0200 OUTPUT.
        g_instance->set_up_display( ).
      ENDMETHOD.
      
      MODULE user_command_0200 INPUT.
        g_instance->handle_command( okcode ).
        clear okcode.
      ENDMODULE.

      Where screen 200 has a custom container.

      Of course I use factory classes to get my concrete classes - but only returning a reference to an interface, and allow all the classes that ZCL_MY_APP use to be injected into its constructor, which makes it easier to write the unit tests.

      Author's profile photo Kim Bo Hansen
      Kim Bo Hansen

      I do - of course hiding the function calls in methods, because...well...I don't know:

      Method call:

      I am a bit curious about your example - from where is the function called, is there a way to add custom buttons/functions in the EWM Monitors?

       

       

      Author's profile photo Joachim Rees
      Joachim Rees
      Blog Post Author

       is there a way to add custom buttons/functions in the EWM Monitors?

      Yes, there is customizing to add methods to /SCWM/MON :
      Screenshot%20of%20SPRO%3A%20Node%20Extended%20Warehouse%20Management%20-%20Monitoring%20-%20Warehouse%20Management%20Monitor%20-%20Define%20Object%20Class%20Methods

      Screenshot of SPRO: Node Extended Warehouse Management - Monitoring - Warehouse Management Monitor - Define Object Class Methods