Application Development 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 Parameter

raja_narayanan2
Active Participant
0 Kudos

Hi all,

I have a requirement that.... the parameter field should be in display mode and

it has an F4 help and i can select the value from that.

user can not edit the value what ever i selected in F4 help.

i have already tried with this code.. but i can able to select the values from F4 help... but selected values is not listing in the parameter as though it is in display mode....

PARAMETERS: p_file TYPE string MODIF ID GRP.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-group1 = 'GRP'.

screen-active = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

How to achive this... pls help me....

Thanks in advance

Regards

Raja

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi

inside loop instead of setting active = 0

try

input = 0

8 REPLIES 8

Former Member
0 Kudos

Hi

How are u managing the F4 help?

U should use the event AT SELECTION-SCREEN ON VALUE-REQUEST

Max

0 Kudos

Hi max,

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL METHOD cl_gui_frontend_services=>directory_browse

EXPORTING

initial_folder = lv_folder

CHANGING

selected_folder = p_file

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

not_supported_by_gui = 3

OTHERS = 4.

when i select some folder and click on ok button that selected folder is not setting in the parameter field...

hope you understand the issue....

regards

Raja

former_member188829
Active Contributor
0 Kudos

Try this for disable mode.

PARAMETERS: p_file TYPE string.

AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'P_FILE'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.

Former Member
0 Kudos

hi

inside loop instead of setting active = 0

try

input = 0

0 Kudos

Hi all,

I tried with all screen setting paramters

Screen-input

screen-output

screen-active.....etc

but not able to achive it...

regards

Raja

0 Kudos

Hi

Try this, it works:

PARAMETERS: P_FILE TYPE STRING MODIF ID GRP LOWER CASE.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF SCREEN-GROUP1 = 'GRP'.
*      SCREEN-ACTIVE = '0'.
      SCREEN-INPUT   = 0.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
  DATA: LV_FOLDER TYPE STRING,
        SEL_FOLDER TYPE STRING.


  CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE
    EXPORTING
      INITIAL_FOLDER       = LV_FOLDER
    CHANGING
      SELECTED_FOLDER      = SEL_FOLDER
    EXCEPTIONS
      CNTL_ERROR           = 1
      ERROR_NO_GUI         = 2
      NOT_SUPPORTED_BY_GUI = 3
      OTHERS               = 4.


  DATA: DYNAME LIKE  D020S-PROG,
        DYNUMB LIKE  D020S-DNUM.

  DATA: DYNPFIELDS TYPE TABLE OF DYNPREAD WITH HEADER LINE.

  DYNPFIELDS-FIELDNAME = 'P_FILE'.
  MOVE SEL_FOLDER TO DYNPFIELDS-FIELDVALUE.
  APPEND DYNPFIELDS.

  CALL FUNCTION 'DYNP_VALUES_UPDATE'
    EXPORTING
      DYNAME     = DYNAME
      DYNUMB     = DYNUMB
    TABLES
      DYNPFIELDS = DYNPFIELDS.

Max

0 Kudos

Hi Max,

Issues solved....

Thanks a lot .....

regards

Raja

MarcinPciak
Active Contributor
0 Kudos

Once I had the same issue and after struggling with this a lot I realized that this is not possible. If parameter is in read-only mode you will not be able to pick value from input help and return it to you screen field.

I found an alternative solution though:

- create input/ouptun field on screen layout

- select output only mode - you will get a field which doens't have this icon at the end which allows to pick value after F4 is pressed

- just next to this field place a litte button (this will show your input help once you click on this pushbutton - simulation of F4)

- now place your custom coding for this button (either Search help created in Dictionary or using fm F4IF_FIELD_VALUE_REQUEST ) and return picked value directly to this read-only screen field like this


"in PAI
    DATA: ret_tab TYPE TABLE OF ddshretval,
          wa_ret  like line of ret_tab.

if ok_code = 'FC_PUSHBUTTON'. "your pushbutton code

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
      EXPORTING
        tabname           = 'TRDIR'  "example table and field to pick value from
        fieldname         = 'NAME'
        searchhelp        = 'ZGLXX_HLP_COL_REPORTS_PMI'  "and search help if any exists
      TABLES
        return_tab        = ret_tab
      EXCEPTIONS
        field_not_found   = 1
        no_help_for_field = 2
        inconsistent_help = 3
        no_values_found   = 4
        OTHERS            = 5.

READ TABLE ret_tab into wa_ret INDEX 1.
CHECK sy-subrc = 0.
trdir-name = wa_ret-fieldval.  "here TRDIR-NAME is name of read-only field
endif.

Regards

Marcin