Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to write a module pool (M) program for the DEMO_DYNPRO_TABSTRIP_server

Former Member
0 Likes
567

Hi,

How does someone write a module pool program (type m ) like the one which is given as an example for tabstrip control (paging through the app.server which is a report program). Please check the code given in the abap tutorial by sap below.

REPORT DEMO_DYNPRO_TABSTRIP_server.

CONTROLS MYTABSTRIP TYPE TABSTRIP.

DATA: OK_CODE TYPE SY-UCOMM,

SAVE_OK TYPE SY-UCOMM.

DATA NUMBER TYPE SY-DYNNR.

MYTABSTRIP-ACTIVETAB = 'PUSH2'.

NUMBER = '0120'.

CALL SCREEN 100.

MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'SCREEN_100'.

ENDMODULE.

MODULE CANCEL INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE USER_COMMAND INPUT.

SAVE_OK = OK_CODE.

CLEAR OK_CODE.

IF SAVE_OK = 'OK'.

MESSAGE I888(SABAPDOCU) WITH 'MYTABSTRIP-ACTIVETAB ='

MYTABSTRIP-ACTIVETAB.

ELSE.

MYTABSTRIP-ACTIVETAB = SAVE_OK.

CASE SAVE_OK.

WHEN 'PUSH1'.

NUMBER = '0110'.

WHEN 'PUSH2'.

NUMBER = '0120'.

WHEN 'PUSH3'.

NUMBER = '0130'.

ENDCASE.

ENDIF.

ENDMODULE.

I am finding the problem with the below statements .

MYTABSTRIP-ACTIVETAB = 'PUSH2'.

NUMBER = '0120'.

CALL SCREEN 100.

how do I write them in a module and how I can ensure that the functionality is not changed?

Thanks in advance,

Ajith c

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
513

Hi

All Tabstribs use the same subarea SUB (see the dynpro 100), in PBO it needs to indicate the program and subscreen number have to be loaded in that subarea.

In PBO of screen 100 you can see the line:

CALL SUBSCREEN SUB INCLUDING SY-REPID NUMBER.

The variable NUMBER is managed in the USER_COMMAND:

  save_ok = ok_code.
  CLEAR ok_code.
  IF save_ok = 'OK'.
    MESSAGE i888(sabapdocu) WITH 'MYTABSTRIP-ACTIVETAB ='
                                  mytabstrip-activetab.
  ELSE.
    mytabstrip-activetab = save_ok.
    CASE save_ok.
      WHEN 'PUSH1'.
        number = '0110'.
      WHEN 'PUSH2'.
        number = '0120'.
      WHEN 'PUSH3'.
        number = '0130'.
    ENDCASE.
  ENDIF.

But this module is triggered as soon as you press a button on screen 100 (you have to considere the label of tabstrip is a pushbutton),

so it needs to initialize the variable NUMBER for the first time screen 100 is called, that mean it needs to indicate which is the first tab has to be shown at the beginning, so you have the code:

mytabstrip-activetab = 'PUSH2'.   
number = '0120'.

CALL SCREEN 100.

The same code can be included in the PBO in the following way:

PROCESS BEFORE OUTPUT.
  MODULE STATUS_0100.
  MODULE INIT_TABSTRIP. "<--- New Module
  CALL SUBSCREEN SUB INCLUDING SY-REPID NUMBER.

PROCESS AFTER INPUT.
  MODULE CANCEL AT EXIT-COMMAND.
  CALL SUBSCREEN SUB.
  MODULE USER_COMMAND.
MODULE INIT_TABSTRIP.
  IF NUMBER IS INITIAL.
    mytabstrip-activetab = 'PUSH2'.   
    number = '0120'.
  ENDIF.
ENDMODULE.

The line:

mytabstrip-activetab = 'PUSH2'.

is to indicate which tabstrip has to be placed in foreground (remember every tabstrip is a pushbutton, so every tabstrip has an own ok_code)

Max

Hi,

How does someone write a module pool program (type m ) like the one which is given as an example for tabstrip control (paging through the app.server which is a report program). Please check the code given in the abap tutorial by sap below.

REPORT DEMO_DYNPRO_TABSTRIP_server.

CONTROLS MYTABSTRIP TYPE TABSTRIP.

DATA: OK_CODE TYPE SY-UCOMM,

SAVE_OK TYPE SY-UCOMM.

DATA NUMBER TYPE SY-DYNNR.

MYTABSTRIP-ACTIVETAB = 'PUSH2'.

NUMBER = '0120'.

CALL SCREEN 100.

MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'SCREEN_100'.

ENDMODULE.

MODULE CANCEL INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE USER_COMMAND INPUT.

SAVE_OK = OK_CODE.

CLEAR OK_CODE.

IF SAVE_OK = 'OK'.

MESSAGE I888(SABAPDOCU) WITH 'MYTABSTRIP-ACTIVETAB ='

MYTABSTRIP-ACTIVETAB.

ELSE.

MYTABSTRIP-ACTIVETAB = SAVE_OK.

CASE SAVE_OK.

WHEN 'PUSH1'.

NUMBER = '0110'.

WHEN 'PUSH2'.

NUMBER = '0120'.

WHEN 'PUSH3'.

NUMBER = '0130'.

ENDCASE.

ENDIF.

ENDMODULE.

I am finding the problem with the below statements .

MYTABSTRIP-ACTIVETAB = 'PUSH2'.

NUMBER = '0120'.

CALL SCREEN 100.

how do I write them in a module and how I can ensure that the functionality is not changed?

Thanks in advance,

Ajith c

2 REPLIES 2
Read only

Former Member
0 Likes
514

Hi

All Tabstribs use the same subarea SUB (see the dynpro 100), in PBO it needs to indicate the program and subscreen number have to be loaded in that subarea.

In PBO of screen 100 you can see the line:

CALL SUBSCREEN SUB INCLUDING SY-REPID NUMBER.

The variable NUMBER is managed in the USER_COMMAND:

  save_ok = ok_code.
  CLEAR ok_code.
  IF save_ok = 'OK'.
    MESSAGE i888(sabapdocu) WITH 'MYTABSTRIP-ACTIVETAB ='
                                  mytabstrip-activetab.
  ELSE.
    mytabstrip-activetab = save_ok.
    CASE save_ok.
      WHEN 'PUSH1'.
        number = '0110'.
      WHEN 'PUSH2'.
        number = '0120'.
      WHEN 'PUSH3'.
        number = '0130'.
    ENDCASE.
  ENDIF.

But this module is triggered as soon as you press a button on screen 100 (you have to considere the label of tabstrip is a pushbutton),

so it needs to initialize the variable NUMBER for the first time screen 100 is called, that mean it needs to indicate which is the first tab has to be shown at the beginning, so you have the code:

mytabstrip-activetab = 'PUSH2'.   
number = '0120'.

CALL SCREEN 100.

The same code can be included in the PBO in the following way:

PROCESS BEFORE OUTPUT.
  MODULE STATUS_0100.
  MODULE INIT_TABSTRIP. "<--- New Module
  CALL SUBSCREEN SUB INCLUDING SY-REPID NUMBER.

PROCESS AFTER INPUT.
  MODULE CANCEL AT EXIT-COMMAND.
  CALL SUBSCREEN SUB.
  MODULE USER_COMMAND.
MODULE INIT_TABSTRIP.
  IF NUMBER IS INITIAL.
    mytabstrip-activetab = 'PUSH2'.   
    number = '0120'.
  ENDIF.
ENDMODULE.

The line:

mytabstrip-activetab = 'PUSH2'.

is to indicate which tabstrip has to be placed in foreground (remember every tabstrip is a pushbutton, so every tabstrip has an own ok_code)

Max

Read only

0 Likes
513

Thanks a lot,

I got it!!!!!

Ajith