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

enter the value in selection screen's field dynamically

Former Member
0 Likes
1,949

Hi all,

I have two parameters on my selection screen, i am taking the value of first parameter from F4 help and now i want to populate the value dynamically in second parameter depending upon the value selected by the user in first parameter.

i am using the following code.

at selection-screen on value request p_first.

call the FM to get F4 help.

loop at screen.

if screen-name = P_SECOND.

p_scond = desired value.

modify screen.

endif.

endloop.

but this is not working.

Please let me know how to achieve this.

Thanks in adv.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,233

Hi Sheelesh,

You can use the following code to achieve your goal :



TABLES : d020s.
*  Name of the program from which the function module is called
DATA: dyname LIKE d020s-prog VALUE 'TESTPROG',
* Number of the screen, from which the call was made. sy-dynnr can be set here
      dynumb LIKE d020s-dnum VALUE '100'.

DATA: BEGIN OF dynpfields OCCURS 3.
        INCLUDE STRUCTURE dynpread.
DATA: END OF dynpfields.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_kunnr.
* Place the code to populate contents for your F4 Value field here.
<...>

* Populate all the fields for which you want default 
* value along with the value in dynpfields internal table.

* Move the screen fileld name in fieldname column.
  MOVE 'G_NAME' TO dynpfields-fieldname.
* Move the field value in fieldvalue column.
  MOVE 'Testtable' TO dynpfields-fieldvalue.
  APPEND dynpfields.

* You can append more screen field names and there values in this internal table.
  
* Call this FM.
  CALL FUNCTION 'DYNP_VALUES_UPDATE'
    EXPORTING
      dyname               = dyname
      dynumb               = dynumb
    TABLES
      dynpfields           = dynpfields
    EXCEPTIONS
      invalid_abapworkarea = 01
      invalid_dynprofield  = 02
      invalid_dynproname   = 03
      invalid_dynpronummer = 04
      invalid_request      = 05
      no_fielddescription  = 06
      undefind_error       = 07.

This function module should be used in the user-programmed help if one or more screen fields are to be given selected values, e.g. if the values are to be reset after calling HELP_VALUES_GET_WITH_TABLE_EXT. automatic value reset, as performed e.g. by the function module HELP_VALUES_GET_EXTEND, can also be overwritten.

You can use this function module to reset selected help processor field contents in the corresponding screen fields w/o caling PBO.

Screen field contents are read by the function module DYNP_VALUES_READ.

Thanks

Ashwani

Hi Sheelesh,

You can use the following code to achieve your goal :



TABLES : d020s.
*  Name of the program from which the function module is called
DATA: dyname LIKE d020s-prog VALUE 'TESTPROG',
* Number of the screen, from which the call was made. sy-dynnr can be set here
      dynumb LIKE d020s-dnum VALUE '100'.

DATA: BEGIN OF dynpfields OCCURS 3.
        INCLUDE STRUCTURE dynpread.
DATA: END OF dynpfields.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_kunnr.
* Place the code to populate contents for your F4 Value field here.
<...>

* Populate all the fields for which you want default 
* value along with the value in dynpfields internal table.

* Move the screen fileld name in fieldname column.
  MOVE 'G_NAME' TO dynpfields-fieldname.
* Move the field value in fieldvalue column.
  MOVE 'Testtable' TO dynpfields-fieldvalue.
  APPEND dynpfields.

* You can append more screen field names and there values in this internal table.
  
* Call this FM.
  CALL FUNCTION 'DYNP_VALUES_UPDATE'
    EXPORTING
      dyname               = dyname
      dynumb               = dynumb
    TABLES
      dynpfields           = dynpfields
    EXCEPTIONS
      invalid_abapworkarea = 01
      invalid_dynprofield  = 02
      invalid_dynproname   = 03
      invalid_dynpronummer = 04
      invalid_request      = 05
      no_fielddescription  = 06
      undefind_error       = 07.

This function module should be used in the user-programmed help if one or more screen fields are to be given selected values, e.g. if the values are to be reset after calling HELP_VALUES_GET_WITH_TABLE_EXT. automatic value reset, as performed e.g. by the function module HELP_VALUES_GET_EXTEND, can also be overwritten.

You can use this function module to reset selected help processor field contents in the corresponding screen fields w/o caling PBO.

Screen field contents are read by the function module DYNP_VALUES_READ.

Thanks

Ashwani

3 REPLIES 3
Read only

Former Member
0 Likes
1,233

To set the value in your dynpro use this FM:

DYNP_VALUES_UPDATE.

Give me some point if you found usefull my answer.

Thanks.

Read only

Former Member
0 Likes
1,233

Hi,

use

AT SELECTION-SCREEN.

loop at screen.

if screen-name = P_SECOND.

p_scond = desired value.

modify screen.

endif.

endloop.

Regards

Akshay

Read only

Former Member
0 Likes
1,234

Hi Sheelesh,

You can use the following code to achieve your goal :



TABLES : d020s.
*  Name of the program from which the function module is called
DATA: dyname LIKE d020s-prog VALUE 'TESTPROG',
* Number of the screen, from which the call was made. sy-dynnr can be set here
      dynumb LIKE d020s-dnum VALUE '100'.

DATA: BEGIN OF dynpfields OCCURS 3.
        INCLUDE STRUCTURE dynpread.
DATA: END OF dynpfields.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_kunnr.
* Place the code to populate contents for your F4 Value field here.
<...>

* Populate all the fields for which you want default 
* value along with the value in dynpfields internal table.

* Move the screen fileld name in fieldname column.
  MOVE 'G_NAME' TO dynpfields-fieldname.
* Move the field value in fieldvalue column.
  MOVE 'Testtable' TO dynpfields-fieldvalue.
  APPEND dynpfields.

* You can append more screen field names and there values in this internal table.
  
* Call this FM.
  CALL FUNCTION 'DYNP_VALUES_UPDATE'
    EXPORTING
      dyname               = dyname
      dynumb               = dynumb
    TABLES
      dynpfields           = dynpfields
    EXCEPTIONS
      invalid_abapworkarea = 01
      invalid_dynprofield  = 02
      invalid_dynproname   = 03
      invalid_dynpronummer = 04
      invalid_request      = 05
      no_fielddescription  = 06
      undefind_error       = 07.

This function module should be used in the user-programmed help if one or more screen fields are to be given selected values, e.g. if the values are to be reset after calling HELP_VALUES_GET_WITH_TABLE_EXT. automatic value reset, as performed e.g. by the function module HELP_VALUES_GET_EXTEND, can also be overwritten.

You can use this function module to reset selected help processor field contents in the corresponding screen fields w/o caling PBO.

Screen field contents are read by the function module DYNP_VALUES_READ.

Thanks

Ashwani