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

Is there a way to remove static code reference (for declarations)?

former_member367551
Participant
0 Likes
864

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
827

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

7 REPLIES 7
Read only

Former Member
0 Likes
828

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

Read only

0 Likes
827

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

Read only

0 Likes
827

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).

Read only

0 Likes
827

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

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
827

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

Read only

0 Likes
827

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

Read only

0 Likes
827

>

> 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.