Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Display a variable in a SELECTION-SCREEN?

Former Member
0 Likes
2,039

Hi all,

I have, based on a user's entry in a SELECTION-SCREEN, constructed a (hard-coded) list of the names of SAP_tables. Then, before that list is actually used for the further process, I want to give the user the opportunity of adding to that list the names of any SAP tables that he thinks are important yet missing. That in itself is easy to do - I can simply generate another SELECTION-SCREEN and ask him for a list of any additional table(s) he wants and append those to the list I have using CONCATENATE.

The more difficult part is this: When I ask the user to enter any additional tables, I have of course to display the list such as it currently exists so the user can have a look at it and decide whether any table is missing or not. I have to do this in the same step as asking the user for input on additional tables.

AfaIk, I can use the COMMENT command to refer either to a text-symbol or give an arbitrary name, causing the system to generate a variable which I can then fill with a value in the AT SELECTION-SCREEN OUTPUT event-block.

The issue is, the list I want to display is really long - with that variable set to a length of 83, I have to use three variables to hold the entire list - and what is more, the list may not always be the same, so I cannot actually hard-code it at all: There might be one of several different lists (depending on the user's choice in the first SELECTION-SCREEN) which differ in length.

Is there any way I can have an existing variable displayed in a SELECTION-SCREEN?

Thanks a lot!

Best regards,

Sapperdapper

4 REPLIES 4
Read only

Former Member
0 Likes
1,265

Hi,

I am one step further now, but not there yet: I can, in the AT SELECTION-SCREEN OUTPUT event-block, simply fill the newly created variable with the value of the existing one.

That works, but it does not solve the length-issue I have: That variable is far longer than 80 whatever's, so I only get approx. 1/3 of it.

Is there some option that I can add so that when the length of the value to be put into a variable is longer than the variable, the rest of the value is automatically put into a new variable and displayed in the next line?

To specify this, the current list is:

TabList = 'T582A T527X T554T T501 T503 T503K T510N T549A T750X PA0001 PA0002 PA0003 PA0004 PA0005 PA0006 PA0007 PA0008 PA0009 PA0010 PA0011 PA0012 PA0013 PA0014 PA0015 PA0016 PA0105 PA1007 PA1035 PA2001 BNKA REGUH REGUP'

When I write >> Tabs_pre = TabList <<, it is there up to PA0004 - and the rest is missing because the 83 characters are up.

Read only

0 Likes
1,265

Hi all,

well, I have sort of fixed this for now. I simply employ several variables. Since the lists are hard-coded, it's easy to split them into pieces 80 whatchamacallits long. Currently I have three variables.

That is still not optimal, but it does the job. It is not very much effort, when one of my table_lists becomes too long and I have to introduce a fourth variable, to modify the SELscreen to show all four and since there's no harm in the list being empty, I don't have to edit anything about the other lists.

An option to automatically split the lists would be more elegant, but nothing the user would notice anyway, so I won't bother.

Best regards,

Sapperdapper

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
1,265

Oh boy, I am afraid to ask what this program is doing...

But why can't the users just use a selection option? If you want to have some kind of a pre-defined list, that can be built in INITIALIZATION.

If some tables are "hardcoded" in the program and you just want to provide an option for the users to select some additional tables, then just have a button to display the list of existing tables (this could be simply put in documentation for the program) and a selection option to enter just the additional ones. You can even have the selection limited to the specific set of tables (otherwise if users enter BSEG - what happens?) and do any kinds of validations easily.

Read only

0 Likes
1,265

Hi Jelena,

the program in total is basically fetching data from a SAP system - a set of data that is, according to the requirements of the user from a set of n tables which are automatically linked.

The thing is, I have hard-coded several different lists of tables - different scenarios, so to speak, built in the program, I don't know by heart which event-block.

The user shall have the possibility of adding any tables he thinks are important, yet missing from the list I provide - I haven't yet found a complete listing online, so my lists are my own creation and cannot claim to be complete. That is why I have to display the list such as it is - true, that might be done in documentation, but I am trying to make the code "document itself" so anyone trying to edit it can simply read my comments in the code and understand what's happening.

Then, once the user has added any tables to the list and the list is thus final, it is enriched with texts on the tables, all the fields and field-texts and displayed in a GUI where the user can choose which of these (like, 2000?) fields he actually needs.

Currently, I am displaying all the tables in the predefined list using three variables since each one can hold text up to 80 bytes only. The second SELscreen thus has three lines, each displaying one of those variables, and a field where the user can enter one or several additional tables.

The reason I am looking for a way of automatically splitting the variable holding the list is simply that it would save me the effort of establishing the three-or-more variables in the SELscreen and the DEClarations and it would also make it easier and more error-proof for any future maintenance.

Best regards,

Sapperdapper

P.S.: Currently whenever one of the lists_of_SAP_tables gets too long and "flows over" so I have to create a new 80-byte-variable to display, I have to change the code in four places: I have to declare that variable, then set another variable (to use in the SELscreen) equal to that, actually write it in the SELscreen and include it in a CONCAT command to make it all into one long list. That is why. Perhaps, however, it is not worthwhile since I am trying to render that second SELscreen obsolete anyway, it just looks - well, SAP-style, not very appetizing.