2010 Nov 01 1:51 PM
Hello.
I am making a program where, in the selection-screen, I ask for a table name and a field name to be able to update some data in the table using those. I have too a criteria section where you enter the name of the field of the restriction where you want to change datas in your table and a select-options to write the infos about the restrictions.
For example: I want to change data X in field Y in table Z where the field "name" into table Z is between L and S.
Though, my problem actually is when I write my select-options, I don't have yet the table name and its field in and it becomes really problematic when it comes to write the "for" in "select-options so_crit for (here)".
I tried with field-symbol but it doesn't work considerating that the user has to enter a table and a field name first unless there is something tricky that I don't understand...
Or maybe there is a way to not use the "for" and make the select-options usable for any kind of datas?
Any suggestions?
Thank you
Edited by: SBenoit on Nov 1, 2010 2:51 PM
Edited by: SBenoit on Nov 1, 2010 2:56 PM
Moderator message: please use more descriptive subject lines.
Edited by: Thomas Zloch on Nov 1, 2010 3:42 PM
2010 Nov 01 2:03 PM
Hi,
I think you can dynamically give the table and field name for select-options,
SELECT-OPTIONS : S_FLD FOR (DYNFLD).
it will create a generic select-option for these dynamic fields.
Thanks,
ANmol.
2010 Nov 01 2:03 PM
Hi,
I think you can dynamically give the table and field name for select-options,
SELECT-OPTIONS : S_FLD FOR (DYNFLD).
it will create a generic select-option for these dynamic fields.
Thanks,
ANmol.
2010 Nov 01 2:05 PM
HI
Yuo need a parameter fir the table name and a select-option for the field name, but I don't understand if you need a selecti-option tio insert the criteria for selecting the record to be updated.
Max
2010 Nov 01 2:11 PM
Max:
What I have in my selection-screen is this:
Parameter for table
Parameter for the field of the table used for the criteria
Select-options for the datas used to fill the criteria (like the equivalent of the "where" in a "Select" from a table).
Parameter for the field of the table the modification will be done.
Parameter for the new data.
And ANmol, I have to go to a meeting but I'll try your solution and I'll give you an update.
2010 Nov 01 2:47 PM
This sounds like a very dangerous weapon in the hand of the wrong people. Will you block SAP standard tables from being updated with your tool?
As for your actual question, almost all Open SQL statements allow dynamic field lists, table names and where-conditions, you might be able to solve this by studying ABAP online help.
Thomas
2010 Nov 01 2:54 PM
Yes Thomas, there are serious validations made to only change the Z tables. And don't worry, I have a supervisor knowing SAP way more than me that is watching to be sure that everything is made properly. Also, I'm sorry for not having been clear on the subject line.
And ANmol, I have tried what you suggested and it works Thank you very much for your help