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

Macro Issue

Former Member
0 Likes
335

Hello,

I am writing one report, in which I am using macors.

  • Macro definition

define _sel.

select-options: &1 for &2.

end-of-definition.

loop at lt_dfies into ls_dfies.

  • For testing purposes,

concatenate ls_dfies-tabname ls_dfies-fieldname into lv_field separated by '-'.

sel lvsel lv_field.

endloop.

when i check this code.. it says lv_sel is already declared, whereas it is not ?

can you tell me where the error is ?

I have made sure that there is NO Include in the report and there is no place the data has been declared ...

any pointers if we have to do something special with macro's

1 REPLY 1
Read only

RaymondGiuseppi
Active Contributor
0 Likes
300

Before the program execute, macro is resolved once and only once as

SELECT-OPTIONS LV_SEL FOR LV_FIELD.

Try to execute in debug, you will get a select-options parameter at the beginning of your program.

Abap doesn't resolve this declaration dynamically.

If you want to dynamically set select-options, look at <a href="http://sap.ittoolbox.com/code/archives.asp?i=10&d=3038&a=s">Source: Dynamic Table Maintenance (enhanced)</a>, there you will find a program which maintain a table dynamically defined with denamic selections like in logical database.

Regards