<?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: Generate pushbuttons with loops in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464161#M2000417</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;DO 6 TIMES.
  SELECTION-SCREEN BEGIN OF LINE.
  SELECTION-SCREEN PUSHBUTTON 1(20) l_btn USER-COMMAND cmd.
  SELECTION-SCREEN END OF LINE.
  NEW-LINE.
ENDDO.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;is identical to&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON 1(20) l_btn USER-COMMAND cmd.
SELECTION-SCREEN END OF LINE.
DO 6 TIMES.
  NEW-LINE.
ENDDO.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Selection-screen is declarative, like DATA. It can't be looped over.&lt;/P&gt;</description>
    <pubDate>Wed, 29 Sep 2021 10:46:22 GMT</pubDate>
    <dc:creator>matt</dc:creator>
    <dc:date>2021-09-29T10:46:22Z</dc:date>
    <item>
      <title>Generate pushbuttons with loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464158#M2000414</link>
      <description>&lt;P&gt;Hello &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
  &lt;P&gt;I'm new to ABAP and I have got a problem that I cannot solve on my own.&lt;/P&gt;
  &lt;P&gt;Is it possible to generate &lt;EM&gt;n&lt;/EM&gt; buttons (or any other elements) using a loop? My first attempt was:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;DO 6 TIMES.
  SELECTION-SCREEN BEGIN OF LINE.
  SELECTION-SCREEN PUSHBUTTON 1(20) l_btn USER-COMMAND cmd.
  SELECTION-SCREEN END OF LINE.
  NEW-LINE.
ENDDO.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;This one works fine for simple output:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;DATA l_btn TYPE string VALUE 'Button'.
DO 6 TIMES.
  WRITE: / l_btn &amp;amp;&amp;amp; sy-index.
  NEW-LINE.
ENDDO.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Any help is appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 10:20:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464158#M2000414</guid>
      <dc:creator>former_member769150</dc:creator>
      <dc:date>2021-09-29T10:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: Generate pushbuttons with loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464159#M2000415</link>
      <description>&lt;P&gt;Thank you for visiting SAP
Community to get answers to your questions. Since this is your first question, I
recommend that you familiarize yourself with &lt;U&gt;&lt;A href="https://community.sap.com/resources/questions-and-answers"&gt;Community
Q&amp;amp;A&lt;/A&gt;&lt;/U&gt; , as the overview provides tips for
preparing questions that draw responses from our members.&lt;/P&gt;&lt;P&gt;Should you wish, you can revise
your question by selecting Actions, then Edit.&lt;/P&gt;&lt;P&gt;By adding a picture to your Profile
you encourage readers to respond.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 10:20:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464159#M2000415</guid>
      <dc:creator>former_member763929</dc:creator>
      <dc:date>2021-09-29T10:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: Generate pushbuttons with loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464160#M2000416</link>
      <description>&lt;P&gt;it is not possible to loop in selection screen&lt;/P&gt;&lt;P&gt;Selection screen generate a dynpro&lt;/P&gt;&lt;P&gt;WRITE statement, is only an output  (it is not the same logicm, the same place)&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 10:28:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464160#M2000416</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2021-09-29T10:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Generate pushbuttons with loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464161#M2000417</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;DO 6 TIMES.
  SELECTION-SCREEN BEGIN OF LINE.
  SELECTION-SCREEN PUSHBUTTON 1(20) l_btn USER-COMMAND cmd.
  SELECTION-SCREEN END OF LINE.
  NEW-LINE.
ENDDO.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;is identical to&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON 1(20) l_btn USER-COMMAND cmd.
SELECTION-SCREEN END OF LINE.
DO 6 TIMES.
  NEW-LINE.
ENDDO.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Selection-screen is declarative, like DATA. It can't be looped over.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 10:46:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464161#M2000417</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2021-09-29T10:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: Generate pushbuttons with loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464162#M2000418</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;matthew.billingham&lt;/SPAN&gt; you think ABAP kernel will accept this loop ?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 10:52:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464162#M2000418</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2021-09-29T10:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Generate pushbuttons with loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464163#M2000419</link>
      <description>&lt;P&gt;How simple it is... unbelievable.&lt;/P&gt;&lt;P&gt;Thank you, guys &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 13:26:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464163#M2000419</guid>
      <dc:creator>former_member769150</dc:creator>
      <dc:date>2021-09-29T13:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Generate pushbuttons with loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464164#M2000420</link>
      <description>&lt;P&gt;You cannot use this kind of syntax, even when program is activated only one pushbutton will be displayed (the selection-screen dynpros are created and activated with the main program.)&lt;/P&gt;&lt;P&gt;You could&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;define 6 pushbuttons&lt;/LI&gt;&lt;LI&gt;(adv) define a dynpro with a table control and a subscreen area, use this dynpro at the start of the report/transaction, create the buttons in an internal table, displayed with the table control and define the &lt;A href="https://help.sap.com/viewer/search?q=selection-screen%20as%20subscreen"&gt;selection-screen as subscreen&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;(adv) use a &lt;A href="https://launchpad.support.sap.com/#/solutions/scnforums/?q=%252522CL_GUI_DOCKING_CONTAINER%252522%252520%252522SELECTION-SCREEN%252522"&gt;docking container to attach a container to the selection-screen&lt;/A&gt;, fill the internal table with your buttons defined as icon with hotspot and display an ALV grid in this container&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;In the advanced solutions (aka funny solutions) you have to handle the click on button either with function code and GET CURSOR or handling event on_click.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;NB: NEW-LINE is related to classic list (spool) not selection-screen, you have confused with SELECTION-SCREEN SKIP.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 13:36:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464164#M2000420</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2021-09-29T13:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Generate pushbuttons with loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464165#M2000421</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;frdric.girod&lt;/SPAN&gt; Do I think it will be accepted? I know it will. I tried it.&lt;/P&gt;&lt;P&gt;Both are syntactically correct, both run with the same result. But not what the OP wanted.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 19:22:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464165#M2000421</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2021-09-29T19:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Generate pushbuttons with loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464166#M2000422</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;as said it has to be somehow static to generate the selection screen. Depending on the amount of "nearly" identical resp. similar elements on the selection screen it could be an approach to use a macro. See example below. For 6 occurrences I would not do it, but it could make sense for a higher amount to shorten the code and avoid redundancy. But one might ask whether this is good code or terrible...&lt;BR /&gt;However, I just want to give the hint for the possibility to use a macro in the selection screen. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;program Z_PB_TEST.&lt;BR /&gt;define SELECTION_PUSHBTN.&lt;BR /&gt;  selection-screen begin of line.&lt;BR /&gt;  selection-screen pushbutton 1(20) BUTTON&amp;amp;1 user-command CMD&amp;amp;1.&lt;BR /&gt;  selection-screen end of line.&lt;BR /&gt;end-of-definition.&lt;BR /&gt;constants: PBTNCNT type i value 6.&lt;BR /&gt;SELECTION_PUSHBTN: 1,2,3,4,5,6.&lt;BR /&gt;initialization.&lt;BR /&gt;  data: btnName type char20.&lt;BR /&gt;  field-symbols: &amp;lt;btn&amp;gt; type any.&lt;BR /&gt;  do PBTNCNT times.&lt;BR /&gt;    btnName = | BUTTON { sy-index } |.&lt;BR /&gt;    condense btnName no-gaps.&lt;BR /&gt;    assign (btnName) to &amp;lt;btn&amp;gt;.&lt;BR /&gt;    &amp;lt;btn&amp;gt; = | Button { sy-index } |.&lt;BR /&gt;  enddo.&lt;BR /&gt;at selection-screen.&lt;BR /&gt;  case sy-ucomm.&lt;BR /&gt;    when 'CMD1'.&lt;BR /&gt;      message i398(00) with 'BUTTON1 pressed'.&lt;BR /&gt;    when 'CMD2'.&lt;BR /&gt;      message i398(00) with 'BUTTON2 pressed'.&lt;BR /&gt;    when 'CMD3'.&lt;BR /&gt;      message i398(00) with 'BUTTON3 pressed'.&lt;BR /&gt;    when 'CMD4'.&lt;BR /&gt;      message i398(00) with 'BUTTON4 pressed'.&lt;BR /&gt;    when 'CMD5'.&lt;BR /&gt;      message i398(00) with 'BUTTON5 pressed'.&lt;BR /&gt;    when 'CMD6'.&lt;BR /&gt;      message i398(00) with 'BUTTON6 pressed'.&lt;BR /&gt;  endcase.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Sep 2021 12:03:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/generate-pushbuttons-with-loops/m-p/12464166#M2000422</guid>
      <dc:creator>jmodaal</dc:creator>
      <dc:date>2021-09-30T12:03:02Z</dc:date>
    </item>
  </channel>
</rss>

