gram77
gram77

Reputation: 531

Access and Assign values into a text box contained within a Tabstrip Control

In ABAP, I have built 3 screens: 0100, 0110, 0120

Screen 0100 is a Tabstrip Control with 2 tabs (each containing a Subscreen). Screen 0100 calls Screen 0110

Screen 0110 contains two textboxes: value1, value2 and a pushbutton Pressing the pushbutton takes me to tab2 of the tabstrip containing textbox result.

I want to add values of textbox: value1 and textbox: value2 and assign the result into textbox: result.

Question) How do i access values present in TabstripControlTab1-Subscreen-Textbox1(value1) and TabstripControlTab1-Subscreen-Textbox2(value2) and assign the calculated value into TabstripControlTab2-Subscreen-Textbox1(result)?

I have declared variables of same names as the textbox controls in TopInclude of the program: value1, value2, result all of integer type, but somehow values in the textboxs are not getting reflected into ABAP program variables.

Screen0110:

enter image description here

Screen0120:

enter image description here


Code:***

Main Program: 

INCLUDE Z_DEMOSCREEN_TOP.    " global Data

*Screen 110 Include:
INCLUDE Z_DEMOSCREEN_STATUS_0100O01.
INCLUDE Z_DEMOSCREEN_USER_COMD_010I01.

*Screen 120 Include:
INCLUDE Z_DEMOSCREEN_STATUS_0110O01.
INCLUDE Z_DEMOSCREEN_USER_CMD_011I01.

START-OF-SELECTION.

CALL SCREEN 100.

*&---------------------------------------------------------------------*
*& Include Z_DEMOSCREEN_TOP          Module Pool      Z_DEMOSCREEN
*&
*&---------------------------------------------------------------------*

PROGRAM  Z_DEMOSCREEN.
DATA:
FIRST_VALUE TYPE C,
SECOND_VALUE TYPE I,
RESULT TYPE I,
ok_code LIKE sy-ucomm.
CONTROLS tabstrip TYPE TABSTRIP.

*****Screen 100:*****
PROCESS BEFORE OUTPUT.
 MODULE STATUS_0100.
 CALL SUBSCREEN TABSTRIP_TAB1_SUBSCR INCLUDING sy-cprog '0110'.


PROCESS AFTER INPUT.
 MODULE USER_COMMAND_0100.

module USER_COMMAND_0100 input.
  CLEAR: ok_code.
  ok_code = sy-ucomm.

  CASE ok_code.
    WHEN 'TAB1' OR 'TAB2'.
      tabstrip-activetab = ok_code.
    WHEN 'ADD'.
      tabstrip-activetab = 'TAB2'.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
    WHEN 'CANCEL'.
      LEAVE TO SCREEN 0.
    WHEN 'EXIT'.
      LEAVE TO SCREEN 0.
  ENDCASE.
endmodule.     

*** Screen 110***
PROCESS BEFORE OUTPUT.
 MODULE STATUS_0200.
*
PROCESS AFTER INPUT.
 MODULE USER_COMMAND_0200.

Upvotes: 0

Views: 1094

Answers (2)

gram77
gram77

Reputation: 531

I had to call both subscreens 110 and 120 at PBO And at PAI I had to call subscreen 110

I am assuming, since just calling the subscreens at PBO (without a call statement at PAI) will call the subscreen 110 again each time I hit the push button PUSH, erasing previous entries.

Code for Screen 100

PROCESS BEFORE OUTPUT.
  MODULE status_0100.
  CALL SUBSCREEN tabstrip_tab1_subscr INCLUDING sy-cprog '0110'.
  CALL SUBSCREEN tabstrip_tab2_subscr INCLUDING sy-cprog '0120'.




PROCESS AFTER INPUT.
  MODULE user_command_0100.
  CALL SUBSCREEN tabstrip_tab1_subscr.

The global variables were shifted to TOP include.

Screens 110 and 120 will have no new menus or code.

Screen 120 PBO will have the calculation: Result = First_Value + Second_Value

At PAI I could not use full call subscreen method:

CALL SUBSCREEN tabstrip_tab1_subscr INCLUDING sy-cprog '0110'.

Why?

Upvotes: 1

mkysoft
mkysoft

Reputation: 5758

You need to give element name as global variable such as GV_VALUE1 and GV_VALUE2. GUI automatically display variable values and it assign entered values to these variables.

Upvotes: 0

Related Questions