4 Replies Latest reply: Nov 2, 2011 4:48 PM by aydin buyukkoyuncu RSS

Change the Input Fields Dynamically in a Screen

aydin buyukkoyuncu
Currently Being Moderated

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.

  • Re: Change the Input Fields Dynamically in a Screen
    Jose Maria Otero
    Currently Being Moderated

    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.

     

  • Re: Change the Input Fields Dynamically in a Screen
    GOPA KUMAR
    Currently Being Moderated

    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

    .

  • Re: Change the Input Fields Dynamically in a Screen
    Dieter Gröhn
    Currently Being Moderated

    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

Actions