‎2010 Jun 16 1:55 PM
Hello experts,
I have a custom report to extract all fields of a database table. Now the user wants to select the fields that he would like to extract from the database table (ex. using check boxes on the selection screen) like the OUTPUT column feature we have in SE16N or in SE11 once we display a table records SETTINGS -> FORMAL LIST -> CHOOSE FIELDS feature.
Any thoughts? Please help.
‎2010 Jun 16 2:43 PM
Hi Adrian,
Are you not using ALV? Because there the user can pick any column he/she wants (and save it as an variant).
‎2010 Jun 16 2:54 PM
Hello,
Thanks for the quick response. It is an ALV but in our case we will not see the ALV output as we are writing the output directly to the application server once the report is executed. So the output field selection has to be performed at the selection screen level.
Any thoughts?
‎2010 Jun 16 3:02 PM
Yep. Because of the fact you are using ALV, you will be able to set the fieldcatalog based on a subselection of fields (columns) made by the user on the selection screen. Please check ALV reporting help for details.
‎2010 Jun 16 4:07 PM
Thanks for the response.
In my case there wont be any user interaction at any point except at selection screen. Is there a way (quick way if possible) to get the list of fields of a database table at selection screen so that we can select the one's we need for output.
Thanks and waiting
‎2010 Jun 16 4:13 PM
You can create a number of display variants and then let the user select the variant to be used on the selection screen.
Rob
‎2010 Jun 16 4:39 PM
Hello Rob,
Thanks for the response. Variant idea sounds reasonable. Not sure if our users would like that approach. Will give it a try. They instead on having fields check box selections on the selection screen. Is that something do-able? Please let me know your thoughts.
Thanks,
‎2010 Jun 16 4:56 PM
Yest that should be doable. Have the field catalog pick all fields, but only display those on the selection screen.
Rob
‎2010 Jun 17 2:21 PM
Rob,
I am thinking of taking the display variant approach but the issue I have is, my program PROG1 calls another program PROG2 through SUBMIT which actually returns the ALV list. So I think we need to save the display variants for PROG2. If that is the case, can we access PROG2 variants with PROG1?
Please let me know. Thanks.
‎2010 Jun 17 2:25 PM
I don't think you can "access" the variant from PROG1, but you can pass it a s a parameter to PROG2 (so long at it is on the selection screen of PROG2).
Rob
‎2010 Jun 17 2:38 PM
OK. In that case I think display variant is not going to work for me. Here's what I need exactly.
I am extracting LFA1 table records when I execute my program. User would like to see the LFA1 table fields on the selection screen with check boxes so that he can select what all fields he needs to extract. Eventually we would like to save a report variant so that we can run the program in background. What options do we have to get the table fields on selection screen? Is there any easy way to achieve this? Is it do-able? Please let me know.
Thanks,
‎2010 Jun 17 2:43 PM
Rob,
Earlier you said "Yest that should be doable. Have the field catalog pick all fields, but only display those on the selection screen.
" in reponse to one of my question. Can you please shed more light on this for my understanding? Thanks.
Edited by: Adrian Vlasan on Jun 17, 2010 3:43 PM
‎2010 Jun 17 3:51 PM
Anyone with any thoughts on gettings the database table fields as check boxes on selection screen? Please help.
‎2010 Jun 17 4:01 PM
Adrian,
This is what I would do.
In the selection screen I would add a button. Either as a parameter or in the tool bar. I'm assuming you know how to do that. If not, we can talk about it.
When the user clicks on the button, display an ALV that lists all the fields of the table. Make the ALV list interactive, so that the user can select or delete the fields that he does not want. When the user comes out of the ALV, copy the fields that the user has selected into a hidden select-option (this will allow you to create a variant, so you can run it in the background).
In your program, use the hidden select-option to know what fields you have to extract. They you can create an internal table with the field names you want and make a dynamic select query (check F1 on select statement).
Then extract the fields that you selected, into a file.
You will need to create a field symbol dynamically that has only the fields that the user selected, so that the select query can put the data into the same.
Is there a specific table you are writing this for? Or are you trying to create a generic program for any table?
Good luck!
Salai.
‎2010 Jun 17 5:11 PM
Hello,
Thanks for your response. Displaying the fields as ALV for selection is not going to work in our case. We want them on selection screen so that we can save a report variant for later use.
Please let me know your thoughts.
Thanks,
‎2010 Jun 17 5:26 PM
‎2010 Jun 17 5:33 PM