‎2010 Feb 22 7:02 AM
Dear forumers,
I've been asked to make a report's program codes to be more dynamic - so, static references to a specific table (i.e. ZZGLV) should be eliminated.
Is there a way to remove static code references for declaration statements?
For example:
parameters: p_dat type zzglv-budat.
I will need to remove the static code reference to the table ZZGLV here. Is there a way for me to use dynamic programming techniques to achieve this?
Please help. Thank you.
‎2010 Feb 22 7:14 AM
Hi,
You can simply use data elements in declarations. In your example zzglv-budat, check the data element related to BUDAT in ZZGLV DB table and declare it as the data element type.
Regards,
Ganga
‎2010 Feb 22 7:14 AM
Hi,
You can simply use data elements in declarations. In your example zzglv-budat, check the data element related to BUDAT in ZZGLV DB table and declare it as the data element type.
Regards,
Ganga
‎2010 Feb 22 7:18 AM
Oooops, sorry.. Was just too silly. Got what you mean now.
But this obviously will not work for SELECT-OPTIONS. What can I do for this, then?
Example:
SELECT-OPTIONS s_carrid FOR zzglv-carrid.
I've tried the following, but I still have "Generic Selection Option" shown on the selection screen:
TABLES spfli.
DATA n_carrid TYPE spfli-carrid.
SELECT-OPTIONS s_carrid FOR (n_carrid).
How may I correct this further?
Edited by: Deborah Tan on Feb 22, 2010 8:52 AM
‎2010 Feb 22 9:22 AM
I've tried this as well, but to no avail. Could someone please, please help me out here?
DATA:
ta_mara TYPE STANDARD TABLE OF mara,
wa_mara LIKE LINE OF ta_mara.
DATA: selopt_name TYPE string VALUE 'WA_MARA-MATNR'.
TRANSLATE selopt_name TO UPPER CASE.
SELECT-OPTIONS: so_sel FOR (SELOPT_NAME).
‎2010 Feb 22 9:29 AM
Hi,
You can simply follow this way.
DATA : v_matnr TYPE matnr. (define variable with data element)
SELECT-OPTIONS : s_matnr FOR v_matnr. (use the variable defined here)
Regards,
Ganga
‎2010 Feb 22 9:35 AM
Hi,
Try the below code, it wil work:-
DATA: v_matnr TYPE mara-matnr.
SELECT-OPTIONS: s_matnr FOR v_matnr.
Hope this helps you.
Regards,
Tarun
‎2010 Feb 22 10:10 AM
Hi,
You can change value of selopt_name in INITIALIZATION or AT SELECTION-SCREEN....
Did you check your code didn't gave systax-error?
I haven't use dynamic coding in such a way...
Although, there is another way...You keep your Selection Screen in an include and write some control program to populate that include with your selection screen code before you submit your main program...
If you try to modify your selection screen from current program if may not work as code is already loaded for your program context in memory....(That is the reason I doubt whether code mentioned by you will work..)
Regards,
Mohaiyuddin
‎2010 Feb 23 3:35 AM
>
> Hi,
>
> You can simply follow this way.
>
> DATA : v_matnr TYPE matnr. (define variable with data element)
> SELECT-OPTIONS : s_matnr FOR v_matnr. (use the variable defined here)
>
> Regards,
> Ganga
Hi Ganga,
This works perfectly. THANKS a lot for your help here!
I can create the select-option well by just using refering to the variable defined with data element (no table references needed).
And for everyone, thanks a lot for the ideas and suggestions too. Appreciate that.