<?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 Showing field dynamically based on dropdown value in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/showing-field-dynamically-based-on-dropdown-value/m-p/12517298#M2004443</link>
    <description>&lt;P&gt;Goodmorning,&lt;/P&gt;
  &lt;P&gt;I am new to SAP and ABAP programming and I am trying to make field visible dynamically, but only when a dropdown menu has a certain value, but I cant get it to work.&lt;/P&gt;
  &lt;P&gt;So first i set the field inactive in the PBO:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;LOOP AT SCREEN.
  CASE SCREEN-NAME.
     WHEN 'FIELD A'.
        SCREEN-INPUT = 0.
        MODIFY SCREEN.
     WHEN 'FIELD B'.
       SCREEN-ACTIVE = 0.
       MODIFY SCREEN.
    ENDCASE.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;And then in the PAI i read the value of the dropdown and if its the correct value, set them to active again.&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;IF dropdown-field = 1.
    LOOP AT SCREEN.
      CASE SCREEN-NAME.
        WHEN 'FIELD A'.
          SCREEN-INPUT = 1.
          MODIFY SCREEN.
        WHEN 'FIELD B'.
          SCREEN-ACTIVE = 1.
          MODIFY SCREEN.
      ENDCASE.
    ENDLOOP.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I tried with a error message, and that shows perfectly, but the fields just won't show up, what am I doing wrong??&lt;/P&gt;
  &lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Mon, 07 Mar 2022 10:11:28 GMT</pubDate>
    <dc:creator>kwiznix90</dc:creator>
    <dc:date>2022-03-07T10:11:28Z</dc:date>
    <item>
      <title>Showing field dynamically based on dropdown value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/showing-field-dynamically-based-on-dropdown-value/m-p/12517298#M2004443</link>
      <description>&lt;P&gt;Goodmorning,&lt;/P&gt;
  &lt;P&gt;I am new to SAP and ABAP programming and I am trying to make field visible dynamically, but only when a dropdown menu has a certain value, but I cant get it to work.&lt;/P&gt;
  &lt;P&gt;So first i set the field inactive in the PBO:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;LOOP AT SCREEN.
  CASE SCREEN-NAME.
     WHEN 'FIELD A'.
        SCREEN-INPUT = 0.
        MODIFY SCREEN.
     WHEN 'FIELD B'.
       SCREEN-ACTIVE = 0.
       MODIFY SCREEN.
    ENDCASE.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;And then in the PAI i read the value of the dropdown and if its the correct value, set them to active again.&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;IF dropdown-field = 1.
    LOOP AT SCREEN.
      CASE SCREEN-NAME.
        WHEN 'FIELD A'.
          SCREEN-INPUT = 1.
          MODIFY SCREEN.
        WHEN 'FIELD B'.
          SCREEN-ACTIVE = 1.
          MODIFY SCREEN.
      ENDCASE.
    ENDLOOP.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I tried with a error message, and that shows perfectly, but the fields just won't show up, what am I doing wrong??&lt;/P&gt;
  &lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 10:11:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/showing-field-dynamically-based-on-dropdown-value/m-p/12517298#M2004443</guid>
      <dc:creator>kwiznix90</dc:creator>
      <dc:date>2022-03-07T10:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: Showing field dynamically based on dropdown value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/showing-field-dynamically-based-on-dropdown-value/m-p/12517299#M2004444</link>
      <description>&lt;P&gt;Let's start with a reproducible example, you can see that FIELD_A is changed into an input field:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PARAMETERS p_number TYPE i.
PARAMETERS field_a TYPE i.
PARAMETERS field_b TYPE i.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    CASE screen-name.
      WHEN 'FIELD_A'.
        screen-input = 0.
        MODIFY SCREEN.
      WHEN 'FIELD_B'.
        screen-active = 0.
        MODIFY SCREEN.
    ENDCASE.
  ENDLOOP.

AT SELECTION-SCREEN.
  IF p_number = 1.
    LOOP AT SCREEN.
      CASE screen-name.
        WHEN 'FIELD_A'.
          screen-input = 1.
          MODIFY SCREEN.
        WHEN 'FIELD_B'.
          screen-active = 1.
          MODIFY SCREEN.
      ENDCASE.
    ENDLOOP.
    MESSAGE 'error' TYPE 'E'.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Mar 2022 12:28:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/showing-field-dynamically-based-on-dropdown-value/m-p/12517299#M2004444</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-03-07T12:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: Showing field dynamically based on dropdown value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/showing-field-dynamically-based-on-dropdown-value/m-p/12517300#M2004445</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;kwiznix&lt;/SPAN&gt;&lt;/P&gt;1. So first you need to add your code(which you have written in PBO) in AT SELECTION-SCREEN OUTPUT event. This will help you see FIELD_A read only and FIELD_B as active on selection screen.2. When you want to modify the screen dynamically you will write your code(written by you in PAI) into AT SELECTION-SCREEN event. Here you can dynamically show fields based on whatever your dropdown value is.Regards,Anurag</description>
      <pubDate>Mon, 07 Mar 2022 15:29:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/showing-field-dynamically-based-on-dropdown-value/m-p/12517300#M2004445</guid>
      <dc:creator>former_member793384</dc:creator>
      <dc:date>2022-03-07T15:29:23Z</dc:date>
    </item>
  </channel>
</rss>

