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

Selection Screen Field Changes

Former Member
0 Likes
988

Hi All,

I have a requirement as follows.

I am displaying a field A based on the radio buttom selection.

When I press the radio buttom R1 it should not be visible.(This functionality i did and it is working)

When I press the radio button R2 it should be visible but inactive status. I should NOT be able to enter the value but only i can Choose the value in F4 option. Please let me know how to achive this 2nd functionality.

Thanks,

Karthik

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
949

Hi,

please check this sample code:

REPORT  zsbablradio1                            .
                                                                        
DATA: xs_dynp        TYPE dynpread.
DATA: xt_dynp        TYPE TABLE OF dynpread.
                                                                        
PARAMETERS: xp_radi1 TYPE c RADIOBUTTON GROUP test DEFAULT 'X'
                            USER-COMMAND  rbut.
PARAMETERS: xp_radi2 TYPE c RADIOBUTTON GROUP test.
PARAMETERS: xp_auart TYPE vbak-auart.
                                                                        
AT SELECTION-SCREEN OUTPUT.
                                                                        
  PERFORM                           change_screen.
                                                                        
AT SELECTION-SCREEN.
                                                                        
  IF  sy-ucomm                  EQ  'RBUT'.
    PERFORM                         change_screen.
  ENDIF.
                                                                        
AT SELECTION-SCREEN ON VALUE-REQUEST FOR xp_auart.
                                                                        
  PERFORM                           select_auart.
                                                                        
START-OF-SELECTION.

  WRITE:  /1 xp_auart.
                                                                        
*&---------------------------------------------------------------------*
*&      Form  CHANGE_SCREEN
*&---------------------------------------------------------------------*
*       change AUART field
*----------------------------------------------------------------------*
FORM change_screen .
                                                                        
  LOOP                          AT  SCREEN.
    CHECK screen-name           CS  'XP_AUART'.
                                                                        
    CASE  'X'.
    WHEN  xp_radi1.
          screen-active          =  '0'.
    WHEN  xp_radi2.
          screen-output          =  '1'.
          screen-input           =  '0'.
    ENDCASE.
                                                                        
    MODIFY                          SCREEN.
  ENDLOOP.
                                                                        
ENDFORM.                    " CHANGE_SCREEN
                                                                        
*&---------------------------------------------------------------------*
*&      Form  SELECT_AUART
*&---------------------------------------------------------------------*
*       Value help for AUART
*----------------------------------------------------------------------*
FORM select_auart .
                                                                        
  CALL FUNCTION 'RV_HELP'
    EXPORTING
      key4                       =  '0'
      number                     =  '008'
    IMPORTING
      field                      =  xp_auart.
                                                                        
  CLEAR                             xt_dynp.
  CLEAR                             xs_dynp.
  xs_dynp-fieldname              =  'XP_AUART'.
  xs_dynp-fieldvalue             =  xp_auart.
  APPEND  xs_dynp               TO  xt_dynp.
                                                                        
  CALL FUNCTION 'DYNP_VALUES_UPDATE'
    EXPORTING
      dyname                     =  sy-repid
      dynumb                     =  sy-dynnr
    TABLES
      dynpfields                 =  xt_dynp
    EXCEPTIONS  OTHERS           =  0.

ENDFORM.                    " SELECT_AUART

Regards,

Klaus

7 REPLIES 7
Read only

Former Member
0 Likes
949

I think you have to use screen-input = 0 for making it visible in active state so that you can't edit it. But I doubt that it is possible to assign it a value on screen using search help after that.

Read only

Former Member
0 Likes
950

Hi,

please check this sample code:

REPORT  zsbablradio1                            .
                                                                        
DATA: xs_dynp        TYPE dynpread.
DATA: xt_dynp        TYPE TABLE OF dynpread.
                                                                        
PARAMETERS: xp_radi1 TYPE c RADIOBUTTON GROUP test DEFAULT 'X'
                            USER-COMMAND  rbut.
PARAMETERS: xp_radi2 TYPE c RADIOBUTTON GROUP test.
PARAMETERS: xp_auart TYPE vbak-auart.
                                                                        
AT SELECTION-SCREEN OUTPUT.
                                                                        
  PERFORM                           change_screen.
                                                                        
AT SELECTION-SCREEN.
                                                                        
  IF  sy-ucomm                  EQ  'RBUT'.
    PERFORM                         change_screen.
  ENDIF.
                                                                        
AT SELECTION-SCREEN ON VALUE-REQUEST FOR xp_auart.
                                                                        
  PERFORM                           select_auart.
                                                                        
START-OF-SELECTION.

  WRITE:  /1 xp_auart.
                                                                        
*&---------------------------------------------------------------------*
*&      Form  CHANGE_SCREEN
*&---------------------------------------------------------------------*
*       change AUART field
*----------------------------------------------------------------------*
FORM change_screen .
                                                                        
  LOOP                          AT  SCREEN.
    CHECK screen-name           CS  'XP_AUART'.
                                                                        
    CASE  'X'.
    WHEN  xp_radi1.
          screen-active          =  '0'.
    WHEN  xp_radi2.
          screen-output          =  '1'.
          screen-input           =  '0'.
    ENDCASE.
                                                                        
    MODIFY                          SCREEN.
  ENDLOOP.
                                                                        
ENDFORM.                    " CHANGE_SCREEN
                                                                        
*&---------------------------------------------------------------------*
*&      Form  SELECT_AUART
*&---------------------------------------------------------------------*
*       Value help for AUART
*----------------------------------------------------------------------*
FORM select_auart .
                                                                        
  CALL FUNCTION 'RV_HELP'
    EXPORTING
      key4                       =  '0'
      number                     =  '008'
    IMPORTING
      field                      =  xp_auart.
                                                                        
  CLEAR                             xt_dynp.
  CLEAR                             xs_dynp.
  xs_dynp-fieldname              =  'XP_AUART'.
  xs_dynp-fieldvalue             =  xp_auart.
  APPEND  xs_dynp               TO  xt_dynp.
                                                                        
  CALL FUNCTION 'DYNP_VALUES_UPDATE'
    EXPORTING
      dyname                     =  sy-repid
      dynumb                     =  sy-dynnr
    TABLES
      dynpfields                 =  xt_dynp
    EXCEPTIONS  OTHERS           =  0.

ENDFORM.                    " SELECT_AUART

Regards,

Klaus

Read only

Former Member
0 Likes
949

Hi Karthik,

Check Below sample code :

*----------------------------------------------------------------------*
* S E L E C T I O N - S C R E E N
*----------------------------------------------------------------------*
* Description
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: reg RADIOBUTTON GROUP rad0 USER-COMMAND con DEFAULT 'X',
            sit RADIOBUTTON GROUP rad0 .
SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003. " Region
PARAMETERS: p_regr TYPE XXX-regio  MODIF ID sg1 MATCHCODE OBJECT zYYY_rhlp.
SELECT-OPTIONS: s_matr FOR  XXX-matnr MODIF ID sg1.
PARAMETERS: p_datr TYPE sy-datum MODIF ID sg1 .
SELECTION-SCREEN END OF BLOCK b3.

SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-004. " Site
SELECT-OPTIONS: s_sits FOR III-werks  MODIF ID sg2,
                s_mats FOR  XXX-matnr MODIF ID sg2.
PARAMETERS: p_dats TYPE sy-datum MODIF ID sg2.
SELECTION-SCREEN END OF BLOCK b4.

SELECTION-SCREEN END OF BLOCK b1.

*----------------------------------------------------------------------*
* INITIALIZATION
*----------------------------------------------------------------------*
INITIALIZATION.

*----------------------------------------------------------------------*
* AT SELECTION SCREEN PBO
*----------------------------------------------------------------------*
AT SELECTION-SCREEN OUTPUT.

  IF reg = 'X'.
    LOOP AT SCREEN.
      IF screen-group1 EQ 'SG2'.
        screen-active = 0.
        MODIFY SCREEN.
*          continue.
      ELSEIF screen-group1 EQ 'SG1'.
        screen-active = 1.
        MODIFY SCREEN.
*          continue.
      ENDIF.
    ENDLOOP.
  ENDIF.

  IF sit = 'X'.
    LOOP AT SCREEN.
      IF screen-group1 EQ 'SG1'.
        screen-active = 0.
        MODIFY SCREEN.
*        continue.
      ELSEIF screen-group1 EQ 'SG2'.
        screen-active = 1.
        MODIFY SCREEN.
*          continue.
      ENDIF.
    ENDLOOP.
  ENDIF.


*----------------------------------------------------------------------*
* AT SELECTION SCREEN
*----------------------------------------------------------------------*
AT SELECTION-SCREEN.

  IF reg = 'X'.
    IF p_regr IS INITIAL .
* Error Message
    ELSEIF p_regr IS NOT INITIAL.
      SELECT regio
             FROM XXX
         INTO TABLE i_XXX
             WHERE regio EQ p_regr.
      IF sy-subrc <> 0.
* Error Message
      ENDIF.
    ENDIF.
    IF p_datr IS INITIAL.
* Error Message
    ENDIF.
  ENDIF.

  IF sit = 'X'.
    IF s_sits IS INITIAL .
* Error Message
    ELSEIF s_sits IS NOT INITIAL.
      SELECT werks
             FROM XXX
         INTO TABLE i_XXX
             WHERE werks IN s_sits.
      IF sy-subrc <> 0.
* Error Message
      ENDIF.
    ENDIF.
    IF p_dats IS INITIAL.
* Error Message
    ENDIF.
  ENDIF.

BR

Dep

Edited by: DeepakNandikanti on Aug 12, 2011 10:27 AM

Read only

0 Likes
949

Hi,

Please follow the code provided by DeepakNandikanti

Read only

0 Likes
949

Hi Tanmoy,

can you please explain your statement?

Deepak's code may be right, but is a dummy code which can't be checked without changes. My sample code above Deepak's is a fully checked and usable sample program developed and checked today.

Why do you prefer Deepak's sample? Just for my interest.

Regards,

Klaus

Read only

0 Likes
949

Well, Klaus got a point!!!! Tanmoy can you please explain? .

Edited by: karunsud on Aug 12, 2011 2:14 PM

Read only

0 Likes
949

Common guys!!:)) (also @karunsud ) Lets not push any one into embarrassment and stop shooting >>'?' KA-BOOM!!.

Might be he was more famliar and expected the thread initiator to be familiar and would grasp the intent of my code easily.And it is only a 'MIGHT BE'..

Anything contrary then @Tanmoy wolud come up with.

)

BR

Dep