2014 Apr 25 3:35 PM
hi, how I can create 100 buttons on a cycle so dynamic?
example:
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON (4) TEXT-001 USER-COMMAND but1.
SELECTION-SCREEN PUSHBUTTON (4) TEXT-002 USER-COMMAND but2.
SELECTION-SCREEN PUSHBUTTON (4) TEXT-003 USER-COMMAND but3.
SELECTION-SCREEN PUSHBUTTON (4) TEXT-004 USER-COMMAND but4.
SELECTION-SCREEN END OF LINE.
.....must be dynamic and they can be 100 and just 10
thanks in advance.
goudden.
2014 Apr 25 3:41 PM
Define macro for creation of selection-screen lines. Then you can do it dynamically.
Regards
Łukasz
2014 Apr 25 7:16 PM
Hi, thanks for replying, I do not work with macros as well the selection-screen tries to create the new variable and gives me error.
DEFINE CREATEB.
DATA a(2) TYPE C.
a = 'a1'.
SELECTION-SCREEN PUSHBUTTON (4) a USER-COMMAND but1.
END-OF-DEFINITION.
SELECTION-SCREEN BEGIN OF LINE.
CREATEB.
SELECTION-SCREEN END OF LINE.
2014 Apr 25 8:17 PM
It gives you an error cause the macro is wrong. Try like this:
define create_line.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON (4) TEXT-&1 USER-COMMAND b&1.
SELECTION-SCREEN PUSHBUTTON (4) TEXT-&2 USER-COMMAND b&2.
SELECTION-SCREEN PUSHBUTTON (4) TEXT-&3 USER-COMMAND b&3.
SELECTION-SCREEN PUSHBUTTON (4) TEXT-&4 USER-COMMAND b&4.
SELECTION-SCREEN END OF LINE.
end-of-definition.
selection-screen begin of block b01.
create_line: 001 002 003 004, 005 006 007 008.
selection-screen end of block b01.
2014 Apr 25 3:43 PM
and what is the condition that drives the dynamism...
i can think of a couple of ways
you could have 100 buttons defined as in your question and then have a
at selection-screen processsing...
loop at screen
...apply an inactive status for the field after a certain number is reached so they are suppressed when dynpro is displayed
or use of if statements around each pushbutton but that would be long handed
the previous suggestion to also use a macro would keep coding tidy for whichever solution you go with as 100 buttons is a lot...
unusual requirement - why do you want this - whats the end goal?
2014 Apr 25 7:24 PM
2014 Apr 26 5:00 AM
As far as I am aware, you cannot dynamically create selection screens, except via dynamic generation of an ABAP program. Where I've had a similar requirement, I've created the maximum, and used LOOP AT SCREEN to hide the ones I didn't need.
Alternatively, develop it in Web Dynpro (which can run in SAPGui - see transaction SOAMANAGER to see how it can be done), and use the WDR_SELECT_OPTIONS component, which does allow fully dynamic select options.