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

Database table extract - fields for selection

Former Member
0 Likes
2,766

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.

16 REPLIES 16
Read only

former_member259807
Active Participant
0 Likes
2,674

Hi Adrian,

Are you not using ALV? Because there the user can pick any column he/she wants (and save it as an variant).

Read only

0 Likes
2,674

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?

Read only

0 Likes
2,674

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.

Read only

0 Likes
2,674

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

Read only

0 Likes
2,674

You can create a number of display variants and then let the user select the variant to be used on the selection screen.

Rob

Read only

0 Likes
2,674

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,

Read only

0 Likes
2,674

Yest that should be doable. Have the field catalog pick all fields, but only display those on the selection screen.

Rob

Read only

0 Likes
2,674

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.

Read only

0 Likes
2,674

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

Read only

0 Likes
2,674

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,

Read only

0 Likes
2,674

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

Read only

0 Likes
2,674

Anyone with any thoughts on gettings the database table fields as check boxes on selection screen? Please help.

Read only

0 Likes
2,674

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.

Read only

0 Likes
2,674

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,

Read only

Former Member
0 Likes
2,674

Anyone please.....

Read only

0 Likes
2,674

Wrong answer - locked.

Rob