<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Change the selection-screen field attributes dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/change-the-selection-screen-field-attributes-dynamically/m-p/6703007#M1452656</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Ipsita De&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ADRC table has got 88 fields, so according your solution I would have to create lot of fields, and theh hide/unhide them. But it seems to be a solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECTION-SCREEN BEGIN OF BLOCK main WITH FRAME TITLE text-001.
  ..
  PARAMETERS :   p_vnew LIKE (ftype) .
SELECTION-SCREEN END OF BLOCK main .


AT SELECTION-SCREEN .
* Here I re-load a ftype variable each time user changes field, something like this
  READ TABLE it_dfies INTO wa_dfies WITH KEY fieldname = p_fname .
  IF sy-subrc = 0 .
    CLEAR ftype .
    CONCATENATE 'ADRC-' wa_dfies-fieldname INTO ftype .
  ENDIF .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It works! But only once!! Why? &lt;/P&gt;&lt;P&gt;Debugger steps into AT SELECTION-SCREEN each time change field name in field A. But changes type of field B only once &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Venkat.O&lt;/STRONG&gt;    	&lt;/P&gt;&lt;P&gt;Unfortunately I can't change screen field's type using &lt;STRONG&gt;DYNP_VALUES_UPDATE&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Feb 2010 16:44:33 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-02-23T16:44:33Z</dc:date>
    <item>
      <title>Change the selection-screen field attributes dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/change-the-selection-screen-field-attributes-dynamically/m-p/6703003#M1452652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there dear SDN members.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to prepare such functionality.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the selection screen I have got 2 fields.&lt;/P&gt;&lt;P&gt;In field &lt;STRONG&gt;A&lt;/STRONG&gt; user specifies some field name of table ADRC (Field A has got a searchhelp with ADRC fields list assigned. I use DDIF_FIELDINFO_GET FModule to get field parameters).&lt;/P&gt;&lt;P&gt;After user choses a field name, then Field &lt;STRONG&gt;B&lt;/STRONG&gt; should change it's type to the chosen field's datatype.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;So for example:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I choose in field A 'DATE_TO' value.&lt;/P&gt;&lt;P&gt;Then Field B should become of type 'DATS' dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;( Further issue is a searchhelp, or control table of the new B field chosen. But it would be probably my next topic to discuss &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will be thankful for help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, P.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 15:26:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/change-the-selection-screen-field-attributes-dynamically/m-p/6703003#M1452652</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T15:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: Change the selection-screen field attributes dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/change-the-selection-screen-field-attributes-dynamically/m-p/6703004#M1452653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Declare screen fields for all the Data type.&lt;/P&gt;&lt;P&gt;In the event AT SELECTION-SCREEN OUTPUT, depending on the value chosen for FIELD A, display the relevant screen-field, and hide others&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: s_fld1 FOR mara-matnr modif ID M1.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: s_fld2 FOR vbak-vbeln modif ID M2.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: s_fld3 FOR vbak-erdat modif ID M3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN OUTPUT.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Perform to modify the screen.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  PERFORM f_modify_screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  F_modify_screen                                        *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Subroutine to modify screen                                    *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM f_modify_screen .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Check the Type of field chosen for FIELD-A&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; IF &amp;lt;Field-A date-type&amp;gt; = &amp;lt;date&amp;gt;.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    LOOP AT SCREEN.&lt;/P&gt;&lt;P&gt;      IF screen-group1 = 'M1'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Make File field invisible&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        screen-active = 0.&lt;/P&gt;&lt;P&gt;        MODIFY SCREEN.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " F_modify_screen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 16:30:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/change-the-selection-screen-field-attributes-dynamically/m-p/6703004#M1452653</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T16:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Change the selection-screen field attributes dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/change-the-selection-screen-field-attributes-dynamically/m-p/6703005#M1452654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;Hi, 
&amp;lt;li&amp;gt;You might have used &lt;STRONG&gt;AT SELECTION-SCREEN ON VALUE-REQUEST field_a&lt;/STRONG&gt; for search help for field_a. Under this event finally you call &lt;STRONG&gt;DYNP_VALUES_UPDATE&lt;/STRONG&gt; function module and populate that second field with the data type. 
&amp;lt;li&amp;gt;Check the below sample program given by me . 
&lt;SPAN __jive_macro_name="message" id="7840859"&gt;&lt;/SPAN&gt; 

I hope that it helps you. 

Thanks
Venkat.O&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 16:36:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/change-the-selection-screen-field-attributes-dynamically/m-p/6703005#M1452654</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2010-02-23T16:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Change the selection-screen field attributes dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/change-the-selection-screen-field-attributes-dynamically/m-p/6703006#M1452655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this way....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  refresh t_dynpfields.
  t_dynpfields-fieldname  = p_value.  "p_value is the DDIF_FIELDINFO_GET FModule to get field parameters
  append t_dynpfields.
  w_repid = sy-repid.
* reading Screen variables and Values
  call function 'DYNP_VALUES_READ'
       exporting
            dyname     = w_repid
            dynumb     = sy-dynnr
       tables
            dynpfields = t_dynpfields
       exceptions
            others.
  read table t_dynpfields index 1.
  p_w_value = t_dynpfields-fieldvalue.     "if you select date_to it will return date_to
                                                                  "or you you select werks it will act as werks


  call function 'HELP_VALUES_GET'
       exporting
            display      = ' '
            fieldname    = fieldname "pass p_w_value
            tabname      = tabname  "pass the table
       importing
            select_value = p_waers
       exceptions
            others       = 0.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Prabhudas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 16:40:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/change-the-selection-screen-field-attributes-dynamically/m-p/6703006#M1452655</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T16:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: Change the selection-screen field attributes dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/change-the-selection-screen-field-attributes-dynamically/m-p/6703007#M1452656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Ipsita De&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ADRC table has got 88 fields, so according your solution I would have to create lot of fields, and theh hide/unhide them. But it seems to be a solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECTION-SCREEN BEGIN OF BLOCK main WITH FRAME TITLE text-001.
  ..
  PARAMETERS :   p_vnew LIKE (ftype) .
SELECTION-SCREEN END OF BLOCK main .


AT SELECTION-SCREEN .
* Here I re-load a ftype variable each time user changes field, something like this
  READ TABLE it_dfies INTO wa_dfies WITH KEY fieldname = p_fname .
  IF sy-subrc = 0 .
    CLEAR ftype .
    CONCATENATE 'ADRC-' wa_dfies-fieldname INTO ftype .
  ENDIF .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It works! But only once!! Why? &lt;/P&gt;&lt;P&gt;Debugger steps into AT SELECTION-SCREEN each time change field name in field A. But changes type of field B only once &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Venkat.O&lt;/STRONG&gt;    	&lt;/P&gt;&lt;P&gt;Unfortunately I can't change screen field's type using &lt;STRONG&gt;DYNP_VALUES_UPDATE&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2010 16:44:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/change-the-selection-screen-field-attributes-dynamically/m-p/6703007#M1452656</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-23T16:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: Change the selection-screen field attributes dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/change-the-selection-screen-field-attributes-dynamically/m-p/6703008#M1452657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Run this code Then after DBTAB = ADRC AND EXECUTE &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PARAMETERS dbtab TYPE tabname DEFAULT 'ADRC'.

TYPE-POOLS rsds.

DATA tadir_wa  TYPE tadir.
DATA selid     TYPE  rsdynsel-selid.
DATA field_tab TYPE TABLE OF rsdsfields.
DATA table_tab TYPE TABLE OF rsdstabs.
DATA table     LIKE LINE OF table_tab.
DATA cond_tab  TYPE  rsds_twhere.
DATA cond      LIKE LINE OF cond_tab.
DATA dref      TYPE REF TO data.
DATA alv       TYPE REF TO cl_salv_table.

FIELD-SYMBOLS &amp;lt;table&amp;gt; TYPE STANDARD TABLE.

SELECT SINGLE *
       FROM tadir
       INTO tadir_wa
       WHERE pgmid = 'R3TR' AND
             object = 'TABL' AND
             obj_name = dbtab.
IF sy-subrc &amp;lt;&amp;gt; 0.
  MESSAGE 'Database not found' TYPE 'I' DISPLAY LIKE 'E'.
  LEAVE PROGRAM.
ENDIF.

table-prim_tab = dbtab.
APPEND table TO table_tab.
CALL FUNCTION 'FREE_SELECTIONS_INIT'
  EXPORTING
    kind         = 'T'
  IMPORTING
    selection_id = selid
  TABLES
    tables_tab   = table_tab
  EXCEPTIONS
    OTHERS       = 4.
IF sy-subrc &amp;lt;&amp;gt; 0.
  MESSAGE 'Error in initialization' TYPE 'I' DISPLAY LIKE 'E'.
  LEAVE PROGRAM.
ENDIF.

CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
  EXPORTING
    selection_id  = selid
    title         = 'Free Selection'
    as_window     = ' '
  IMPORTING
    where_clauses = cond_tab
  TABLES
    fields_tab    = field_tab
  EXCEPTIONS
    OTHERS        = 4.
IF sy-subrc &amp;lt;&amp;gt; 0.
  MESSAGE 'No free selection created' TYPE 'I'.
  LEAVE PROGRAM.
ENDIF.

READ TABLE cond_tab WITH KEY tablename = dbtab INTO cond.
IF sy-subrc &amp;lt;&amp;gt; 0.
  MESSAGE 'Error in condition' TYPE 'I' DISPLAY LIKE 'E'.
  LEAVE PROGRAM.
ENDIF.

CREATE DATA dref TYPE TABLE OF (dbtab).
ASSIGN dref-&amp;gt;* TO &amp;lt;table&amp;gt;.

TRY.
    SELECT *
           FROM (dbtab)
           INTO TABLE &amp;lt;table&amp;gt;
           WHERE (cond-where_tab).
  CATCH cx_sy_dynamic_osql_error.
    MESSAGE 'Error in dynamic Open SQL' TYPE 'I' DISPLAY LIKE 'E'.
    LEAVE PROGRAM.
ENDTRY.

TRY.
    cl_salv_table=&amp;gt;factory(
      IMPORTING r_salv_table = alv
      CHANGING  t_table      = &amp;lt;table&amp;gt; ).
    alv-&amp;gt;display( ).
  CATCH cx_salv_msg.
    MESSAGE 'Error in ALV display' TYPE 'I' DISPLAY LIKE 'E'.
ENDTRY.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Krupaji on Feb 25, 2010 11:19 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 10:19:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/change-the-selection-screen-field-attributes-dynamically/m-p/6703008#M1452657</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-25T10:19:24Z</dc:date>
    </item>
  </channel>
</rss>

