<?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: Field value selection on a selection screen in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/field-value-selection-on-a-selection-screen/m-p/5741215#M1301660</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT Z_TEST .

tables tcurt.
DATA DYFIELDS LIKE DYNPREAD OCCURS 1 WITH HEADER LINE.
PARAMETERS: P_WAERS LIKE TCURT-WAERS, "Currency
P_LTEXT LIKE TCURT-LTEXT, "Long Text
P_KTEXT LIKE TCURT-KTEXT. "Short Text

*Example of updating value of another field on the screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_WAERS.
CLEAR: DYFIELDS[], DYFIELDS.
*select currency
CALL FUNCTION 'HELP_VALUES_GET'
EXPORTING
fieldname = 'WAERS'
tabname = 'TCURT'
IMPORTING
SELECT_VALUE = P_WAERS.

*get long text for the selected currency
SELECT SINGLE LTEXT FROM TCURT
INTO DYFIELDS-FIELDVALUE
WHERE SPRAS = SY-LANGU
AND WAERS = P_WAERS.
IF SY-SUBRC &amp;lt;&amp;gt; 0.
CLEAR DYFIELDS-FIELDVALUE.
ENDIF.

*update another field
DYFIELDS-FIELDNAME = 'P_LTEXT'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
tables
dynpfields = DYFIELDS .

*Example of reading value of another field
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_KTEXT.
*read another field
CLEAR: DYFIELDS[], DYFIELDS.
DYFIELDS-FIELDNAME = 'P_WAERS'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = DYFIELDS .
READ TABLE DYFIELDS INDEX 1.

*get short text and update current field
SELECT SINGLE KTEXT FROM TCURT
INTO P_KTEXT
WHERE SPRAS EQ SY-LANGU
AND WAERS EQ DYFIELDS-FIELDVALUE.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jun 2009 11:46:24 GMT</pubDate>
    <dc:creator>GauthamV</dc:creator>
    <dc:date>2009-06-10T11:46:24Z</dc:date>
    <item>
      <title>Field value selection on a selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/field-value-selection-on-a-selection-screen/m-p/5741212#M1301657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi expert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement. In a selection screen say there are 4 fields let say f1, f2, f3, f4.  Now If a select a value of f1 in the selection screen based on the value of f1,  other fields (f2, f3, f4 ) will be populated. How can i do that? All the fields are a part of the tables say Tab1 and Tab2 and they are related.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Abhijit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jun 2009 08:23:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/field-value-selection-on-a-selection-screen/m-p/5741212#M1301657</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-08T08:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Field value selection on a selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/field-value-selection-on-a-selection-screen/m-p/5741213#M1301658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;READ HELP and Search forum for Selection Screen EVENTS. &lt;/P&gt;&lt;P&gt;You will get the reply to it instantly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jun 2009 08:24:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/field-value-selection-on-a-selection-screen/m-p/5741213#M1301658</guid>
      <dc:creator>amit_khare</dc:creator>
      <dc:date>2009-06-08T08:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Field value selection on a selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/field-value-selection-on-a-selection-screen/m-p/5741214#M1301659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply. I have got several example but none is meeting my requirement. If possible provide me in details lcode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;P&gt;Abhijit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 11:41:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/field-value-selection-on-a-selection-screen/m-p/5741214#M1301659</guid>
      <dc:creator>Abhijit74</dc:creator>
      <dc:date>2009-06-10T11:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Field value selection on a selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/field-value-selection-on-a-selection-screen/m-p/5741215#M1301660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT Z_TEST .

tables tcurt.
DATA DYFIELDS LIKE DYNPREAD OCCURS 1 WITH HEADER LINE.
PARAMETERS: P_WAERS LIKE TCURT-WAERS, "Currency
P_LTEXT LIKE TCURT-LTEXT, "Long Text
P_KTEXT LIKE TCURT-KTEXT. "Short Text

*Example of updating value of another field on the screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_WAERS.
CLEAR: DYFIELDS[], DYFIELDS.
*select currency
CALL FUNCTION 'HELP_VALUES_GET'
EXPORTING
fieldname = 'WAERS'
tabname = 'TCURT'
IMPORTING
SELECT_VALUE = P_WAERS.

*get long text for the selected currency
SELECT SINGLE LTEXT FROM TCURT
INTO DYFIELDS-FIELDVALUE
WHERE SPRAS = SY-LANGU
AND WAERS = P_WAERS.
IF SY-SUBRC &amp;lt;&amp;gt; 0.
CLEAR DYFIELDS-FIELDVALUE.
ENDIF.

*update another field
DYFIELDS-FIELDNAME = 'P_LTEXT'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
tables
dynpfields = DYFIELDS .

*Example of reading value of another field
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_KTEXT.
*read another field
CLEAR: DYFIELDS[], DYFIELDS.
DYFIELDS-FIELDNAME = 'P_WAERS'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = DYFIELDS .
READ TABLE DYFIELDS INDEX 1.

*get short text and update current field
SELECT SINGLE KTEXT FROM TCURT
INTO P_KTEXT
WHERE SPRAS EQ SY-LANGU
AND WAERS EQ DYFIELDS-FIELDVALUE.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 11:46:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/field-value-selection-on-a-selection-screen/m-p/5741215#M1301660</guid>
      <dc:creator>GauthamV</dc:creator>
      <dc:date>2009-06-10T11:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Field value selection on a selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/field-value-selection-on-a-selection-screen/m-p/5741216#M1301661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 11:49:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/field-value-selection-on-a-selection-screen/m-p/5741216#M1301661</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-10T11:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: Field value selection on a selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/field-value-selection-on-a-selection-screen/m-p/5741217#M1301662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks goutham,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I want to display both the fields(LTEXT, KTEXT) after selecting the WAERS how can i do that?. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Abhijit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 11:51:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/field-value-selection-on-a-selection-screen/m-p/5741217#M1301662</guid>
      <dc:creator>Abhijit74</dc:creator>
      <dc:date>2009-06-10T11:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Field value selection on a selection screen</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/field-value-selection-on-a-selection-screen/m-p/5741218#M1301663</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;Read the values of LTEXT, KTEXT in the F4 help of the WAERS and usnig the FM 'DYNP_VALUES_UPDATE' set the values in LTEXT, KTEXT parameters&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{codeAT SELECTION-SCREEN ON VALUE-REQUEST FOR P_KTEXT.&lt;/P&gt;&lt;P&gt;CLEAR: DYFIELDS[], DYFIELDS.&lt;/P&gt;&lt;P&gt;DYFIELDS-FIELDNAME = 'P_WAERS'.&lt;/P&gt;&lt;P&gt;APPEND DYFIELDS.&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'DYNP_VALUES_READ'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;DYNAME = SY-CPROG&lt;/P&gt;&lt;P&gt;DYNUMB = SY-DYNNR&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;DYNPFIELDS = DYFIELDS .&lt;/P&gt;&lt;P&gt;READ TABLE DYFIELDS INDEX 1.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;" Select L_KTEXT and L_LTEXT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DYFIELDS-FIELDVALUE = L_LTEXT.&lt;/P&gt;&lt;P&gt;DYFIELDS-FIELDNAME = 'P_LTEXT'.&lt;/P&gt;&lt;P&gt;APPEND DYFIELDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DYFIELDS-FIELDVALUE = L_KTEXT.&lt;/P&gt;&lt;P&gt;DYFIELDS-FIELDNAME = 'P_KTEXT'.&lt;/P&gt;&lt;P&gt;APPEND DYFIELDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'DYNP_VALUES_UPDATE'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;DYNAME = SY-CPROG&lt;/P&gt;&lt;P&gt;DYNUMB = SY-DYNNR&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;dynpfields = DYFIELDS .{code}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 11:57:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/field-value-selection-on-a-selection-screen/m-p/5741218#M1301663</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-10T11:57:59Z</dc:date>
    </item>
  </channel>
</rss>

