Skip to Content
Technical Articles
Author's profile photo Beyhan MEYRALI

How To Add Batch Verification To WM Mobil Screen With Enter Definition

Hi,

I don’t know why but batch verification does not exists on WM mobile screens. I have checked Google and noticed many people are asking same question. Therefore I decided to share my solution with you.

If you worked with WM, you would know, WM provides RF Screens to be used by mobile devices with tcodes starts with LMXX. Those screens can be enhanced and new screen can be assigned to those transaction codes with a variant. And in LRFMD you can choose that variant if you want to work with enhanced screen.

Replacing screens and adding new fields are easy. For that I have followed Rakshith Gore’s blog post. That part is easy. It becomes complex once you need to integrate Verification customization to that new screen. And on top of that, if you need to implement Enter Functionality customization, then you may spend sometime debugging existing screens.

 

Please check screen shot below to see customizing settings for Verification and Enter Behavior.

 

Verification Profile Settings

 

Enter Function Settings

Remember that part after copying screen 1212 to 9212. Here you need to write 1212 not 9212!

Note: 1212 and 9212 screens are explained below.

 

Enhancement bit…

So far we have seen customization settings and below, I will show you how to add batch verification to LM06 screen.

First we need to find the screen and enhancement for it. To do that, we just need to open status screen on LM06 screen that we want to change.

Our screen number is 2212. Last 3 digit is important, *212 will help us to find user exit.

 

To find user exit, run tcode SMOD and select components, enter *wm*212* and pres f4 to search.

We found our user-exit. Now click display and pay attention to program name.

 

To create an alternative screen we need to copy screen 1212 from SAPLLMOB to SAPLXLRF with screen number 9212. Below you can see attributes and code of 9212.

Batch field is assigned to LTAP-CHARG, which is WM transfer order’s batch.

GS_9212-CHARG is the verification field. GS_9212 is a structure which is defined in ZXLRFTOP.

ZXLRFTOP is an include file of XLRF function group’s master program LXLRFTOP.

Code of ZXLRFTOP:

*&---------------------------------------------------------------------*
*& Include          ZXLRFTOP
*&---------------------------------------------------------------------*

INCLUDE llmobdat.
INCLUDE zzxlrf_9212.

DATA: gs_9212 TYPE ZWM_S_SCR_9212.

And attributes of structure ZWM_S_SCR_9212

 

And the screen’s code… Placed in include ZZXLRF_9212 of Function Group XLRF

*&---------------------------------------------------------------------*
*& Include          ZZXLRF_9212
*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*
*& Module STATUS_SCREEN_GROUP3 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE status_screen_group3 OUTPUT.

ENDMODULE.
*&---------------------------------------------------------------------*
*& Module TAP_DISPLAY OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE tap_display OUTPUT.

  "Standard verification requires call of line below in sub screen.
  PERFORM tap_display(sapllmob).

  "Below lines are required for integration of batch verification
  "and for enter behaviour.
  "Standard enter behaviour does not know about added batch field GS_9212-CCHARG
  "Therefore we need to create a mechanism to make sure it works as part
  "Existing enter behaviour and verification
  CONSTANTS: mem_9212(25) TYPE c VALUE 'GS_9212'.
  FIELD-SYMBOLS: <scr9212> TYPE zwm_s_scr_9212.
  ASSIGN (mem_9212) TO <scr9212>.

  IF <scr9212> IS ASSIGNED.

    LOOP AT SCREEN.

      IF screen-name EQ 'GS_9212-CCHARG'.
        IF ltap-charg IS INITIAL.
          screen-invisible = '1'.
          Screen-active = 0.

          IF <scr9212> IS ASSIGNED.
            CLEAR <scr9212>-mustverify.
          ENDIF.
        ELSE.

          IF <scr9212> IS ASSIGNED.
            <scr9212>-mustverify = abap_true.
          ENDIF.

          screen-invisible = '0'.
          Screen-active = 1.

          IF <scr9212> IS ASSIGNED AND ltap-charg EQ <scr9212>-ccharg.
            screen-input = 0.
          ELSE.
            screen-input = 1.
          ENDIF.

        ENDIF.
        MODIFY SCREEN.

      ENDIF.
    ENDLOOP.

    "This data is used in FIND_NEXT_KEY function
    "Which is used in enter behaviour
    IF <scr9212> IS ASSIGNED.
      CONSTANTS: mem_R9212(25) TYPE c VALUE '(SAPLLMOB)GS_9212'.
      FIELD-SYMBOLS: <gs_R9212> TYPE zwm_s_scr_9212.
      ASSIGN (mem_R9212) TO <gs_R9212>.
      IF <gs_R9212> IS ASSIGNED.
        <gs_R9212>-ccharg = <scr9212>-ccharg.
        <gs_R9212>-num_of_alq = <scr9212>-num_of_alq.
        <gs_R9212>-mustverify = <scr9212>-mustverify.
        <scr9212>-canverify = <gs_R9212>-canverify.
      ENDIF.
    ENDIF.
  ENDIF.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module SPECIAL_FIELD_OUTPUT OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE special_field_output OUTPUT.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module SET_VALUES OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE set_values OUTPUT.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module SET_CURSOR OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE set_cursor OUTPUT.
  "Required to set cursor order
  PERFORM set_cursor_pos(sapllmob)
        USING line_no_step_loop CHANGING screen_fcode current_field.
  PERFORM set_scroll(sapllmob) USING tap_index tap_init_size tap_total_lines
                     CHANGING  temporary_index.
* Not for HUM
  PERFORM set_verify_fields_single(sapllmob).
  IF   current_field IS INITIAL.
    LOOP AT SCREEN.
      IF screen-invisible = option_off
         AND screen-input = option_on
         AND screen-group1 <> 1.
        SET CURSOR FIELD screen-name.
        EXIT.
      ENDIF.
    ENDLOOP.
  ENDIF.

ENDMODULE.
*&---------------------------------------------------------------------*
*&      Module  EXIT_COMMANDS  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE exit_commands INPUT.

  PERFORM exit_commands_form(sapllmob)
               CHANGING ok_code screen_fcode prev_screen int_table_name.

ENDMODULE.
*&---------------------------------------------------------------------*
*&      Module  MODIFY_TAP  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE modify_tap INPUT.
  "Required to pass enhanced screen data to main program
  CONSTANTS: lv_memory(25) TYPE c VALUE '(sapllmob)rlmob'.
  FIELD-SYMBOLS: <rlmob> TYPE any.
  ASSIGN (lv_memory) TO <rlmob>.
  IF <rlmob> IS ASSIGNED.
    <rlmob> = rlmob.
  ENDIF.

ENDMODULE.

*&---------------------------------------------------------------------*
*&      Module  USER_COMMANDS  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_commands INPUT.
ENDMODULE.

I have placed a piece data block in SAPLLMOB. That is because, we will need access screens GS_9212 data from other parts of call stack and SAPLLMOB  sits on top of call stack. Go to include  LLMOBTOP and add an enhancement at the end of include.

Code in LLMOBTOP;

*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 2  ZLLMOBF01.    "active version
"For Enhacement screen used in LM06
data: GS_9212 TYPE zwm_s_scr_9212.
ENDENHANCEMENT.

 

And below code includes of enhancement MWMRF212.

EXIT_SAPLLMOB_170 -> EXIT_SAPLLMOB_170 -> we are passing values to sub screen.

*&---------------------------------------------------------------------*
*& Include          ZXLRFU12
*&---------------------------------------------------------------------*

"Screen exit for 9212 CMOD:ZWM -> Enhancement :MWMRF212 for RF Menu LM06
ltap              = i_ltap.
ltak              = i_ltak.
rlmob             = i_rlmob.
rl02b             = i_rl02b.
tap_init_size     = i_tap_init_size.
tap_total_lines   = i_tap_total_lines.
tap_index         = i_tap_index.
temporary_index   = i_temporary_index.
line_no_step_loop = i_line_no_step_loop.
screen_fcode      = i_screen_fcode.
current_field     = i_current_field.

 

EXIT_SAPLLMOB_480 -> INCLUDE ZXLRFU43  -> We are checking if Batch is verified. If not verified we will add an error line to make sure user gets a verification warning.

*&---------------------------------------------------------------------*
*& Include          ZXLRFU43
*&---------------------------------------------------------------------*
"Screen exit for 9212 CMOD:ZWM -> Enhancement :MWMRF212 for RF Menu LM06
"Verify batch
REFRESH o_verification_errors[].
IF gs_9212-canverify IS NOT INITIAL AND ltap-charg IS NOT INITIAL
  AND ( gs_9212-ccharg IS INITIAL OR  gs_9212-ccharg NE ltap-charg ).

  CLEAR gs_9212-ccharg.

  DATA(error) = VALUE sprot_u( var1 = 'Batch' ) .
  APPEND error TO o_verification_errors.
ENDIF.

 

Enhancement code in function FIND_NEXT_KEY, add on top of existing code. We will prevent passing to next screen if batch is not verified!

FUNCTION FIND_NEXT_KEY.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Function Module FIND_NEXT_KEY, Start                                                                                                              A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1  ZWM_ENTER_KEY_ROUTES.    "active version
"LM06 Screen has batch field and that field needs to be filled if TO has batch
"This code is added to integrate custom batch field to enter navigation behaviour
    CONSTANTS: mem_R9212(25) TYPE c VALUE '(SAPLLMOB)GS_9212'.
    FIELD-SYMBOLS: <gs_R9212> TYPE zwm_s_scr_9212.
    ASSIGN (mem_R9212) TO <gs_R9212>.
    IF <gs_R9212> IS ASSIGNED.

      IF I_LAST_VERIF is NOT INITIAL or I_LAST_ITEM is NOT INITIAL.
        <gs_R9212>-canverify = abap_true.
      else.
        <gs_R9212>-canverify = abap_false.
      ENDIF.

      IF <gs_R9212>-mustverify is NOT INITIAL and <gs_R9212>-ccharg is INITIAL.
          clear : I_LAST_VERIF ,I_LAST_ITEM.
      ENDIF.
    ENDIF.


ENDENHANCEMENT.

 

That is all you need to do to add a new field and integrate it with WM verification and enter behavior.

 

Add new screen with a variant and change your LRFMD settings.

 

Set screen with variant.

 

Change LRFMD Screen variant.

 

Lets run LM06

I will fill first 2 verification fields and press enter without filling batch.

 

That is it. I hope that post will help somebody who is also looking for that information.

Feel free to add your own solutions and suggestions to comments.

Thanks for reading.

 

 

 

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Dominik Tylczynski
      Dominik Tylczynski

      Nice one!!!

      Author's profile photo Beyhan MEYRALI
      Beyhan MEYRALI
      Blog Post Author

      Thanks Dominik.

      A comment like that from such an expert as yourself is much appreciated!

      Regards