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

Change the Input Fields Dynamically in a Screen

Former Member
0 Likes
2,807

Hello all,

I have a dialog screen and i created some inputs and radio buttons in this screen.

I want to make some input fields not available, according to the radio buttons.

i know i i will do it by loop at screen. But where will i put this loop?

If i put it this pbo it executes just one time and when i hit radio button it doesnt execute pbo again.

How can i do this with my dialog screen?

Thanks.

1 ACCEPTED SOLUTION
Read only

former_member209703
Active Contributor
0 Likes
1,370

You're almost right

If i put it this pbo it executes just one time and when i hit radio button it doesnt execute pbo again.

That's because you need to assign a user-command to the radiobutton


  PARAMETERS: P_one RADIOBUTTON GROUP G1 USER-COMMAND COMM,
              P_Two RADIOBUTTON GROUP G1.

4 REPLIES 4
Read only

former_member209703
Active Contributor
0 Likes
1,371

You're almost right

If i put it this pbo it executes just one time and when i hit radio button it doesnt execute pbo again.

That's because you need to assign a user-command to the radiobutton


  PARAMETERS: P_one RADIOBUTTON GROUP G1 USER-COMMAND COMM,
              P_Two RADIOBUTTON GROUP G1.

Read only

0 Likes
1,370

adding user-command solved the question

Thanks.

Read only

Former Member
0 Likes
1,370

Hello,

"If i put it this pbo it executes just one time and when i hit radio button it doesnt execute pbo again.

.

The above statement is not true. When you click the button, It executes the PAI first, and then comes to the PBO. Without that, you'll be seeing the screen at all.

You'll still put the Loop statement at the PBO only. Based on your condition/flag, you can hide/edit/display only etc in the screen fields. The fields you want to hide must be assigned to a group in the layout.

Below is the sample code: Here I'm making few fields Non-editable based on the screen group. In your case, you can capture the function code values and can perform the screen actions.

Hope this helps.

Thnx,

G

PROCESS BEFORE OUTPUT.

*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TC_AUDITNG_SCRE'

MODULE: TC_AUDITNG_SCRE_CHANGE_TC_ATTR.

*&SPWIZARD: MODULE TC_AUDITNG_SCRE_CHANGE_COL_ATTR.

LOOP AT GT_FIELDS

INTO WA_FIELDS

WITH CONTROL TC_AUDITNG_SCRE

CURSOR TC_AUDITNG_SCRE-CURRENT_LINE.

*-Getting the Current Line.--

MODULE: TC_AUDITNG_SCRE_GET_LINES,

*---If the Current line has a Blank line indicator set, Make the fields

*-'Results' and 'Status' as display only.

MODIFY_SCREEN_FIELDS.

ENDLOOP.

MODULE MODIFY_SCREEN_FIELDS OUTPUT.

LOOP AT SCREEN.

*-Forcing Results & Status Combo/List Box to Display mode.-

IF Screen-group2 = 'G2' or

Screen-group2 = 'G3'.

Screen-VALUES_IN_COMBO = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

*-If the Current line has a Blank line indicator value set.-

If WA_FIELDS-Blank_Line_Ind = 'X'.

LOOP AT SCREEN.

*-Make the fields 'Results' and 'Status' as Display only.---

*-Line numbers 2 &3 for each Step No.-

IF Screen-group1 = 'G1'.

screen-input = 0.

Screen-VALUES_IN_COMBO = 0. "Display

MODIFY SCREEN.

ENDIF.

IF Screen-group1 = 'F1'.

Screen-VALUES_IN_COMBO = 0.

MODIFY SCREEN.

ENDIF.

*-Making the 2nd and 3rd lines of all THREE text fields Display only mode.-

IF Screen-group1 = 'T1'.

screen-input = 0. "Display(Not Editable)

MODIFY SCREEN.

ENDIF.

ENDLOOP.

*-If the Current Line has the Step No. displayed; First line for each Step.-

Else.

LOOP AT SCREEN.

*-Activating the Combo/List Box for the first line of each Step No.-

IF Screen-group2 = 'G2' or

Screen-group2 = 'G3'.

Screen-VALUES_IN_COMBO = 1.

ENDIF.

*-Making the First line of each Step No. bright.-

Screen-INTENSIFIED = 1.

MODIFY SCREEN.

ENDLOOP.

Endif.

  • Endif.

ENDMODULE. " MODIFY_SCREEN_FIELDS OUTPUT

.

Read only

Former Member
0 Likes
1,370

Hi,

try this short code:


TABLES: MARA, LFA1, SCREEN.
*
SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS:       X_MATNR RADIOBUTTON GROUP PRI1 DEFAULT 'X'
                        USER-COMMAND DUMMY.
SELECT-OPTIONS:   S_MATNR FOR MARA-MATNR MODIF ID DS0.
SELECTION-SCREEN: END   OF LINE.

SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS:       X_LIFNR RADIOBUTTON GROUP PRI1.
SELECT-OPTIONS:   S_LIFNR FOR LFA1-LIFNR MODIF ID DS0.
SELECTION-SCREEN: END   OF LINE.
*
AT SELECTION-SCREEN OUTPUT.
*
  LOOP AT SCREEN.
*
    IF SCREEN-GROUP1 EQ 'DS0'.
*
      SCREEN-INPUT     = '0'.
      SCREEN-INVISIBLE = '1'.
*
      IF  SCREEN-NAME(3) = 'S_M' AND X_MATNR = 'X'.
        SCREEN-INPUT     = '1'.
        SCREEN-INVISIBLE = '0'.
      ENDIF.
*
      IF  SCREEN-NAME(3) = 'S_L' AND X_LIFNR = 'X'.
        SCREEN-INPUT     = '1'.
        SCREEN-INVISIBLE = '0'.
      ENDIF.
*
      MODIFY SCREEN.
*
    ENDIF.
*
  ENDLOOP.
*

regards, Dieter