Application Development 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: 

Loading a range using macro

Former Member
0 Kudos
687

Hello,

I have once come across a technique of loading a range using a macro that was stored in table TRMAC. Has anyone seen anything similar to this? I copied the code to a jump drive but have misplaced it. It was really a cool way to load a range with individual values.

Thanks,

Joe

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
147

You don't have to store it in that TABLE. You can define the macro in your program.

ranges: r_datum for sy-datum.

Define build_range.
r_datum-sign = 'I'.
r_datum-option = 'EQ'.
r_datum-low = &1.
append r_datum.
end-of-definition.


* Now use the macro

build_range sy-datum.

Regards,

Rich Heilman

Message was edited by: Rich Heilman

7 REPLIES 7

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
148

You don't have to store it in that TABLE. You can define the macro in your program.

ranges: r_datum for sy-datum.

Define build_range.
r_datum-sign = 'I'.
r_datum-option = 'EQ'.
r_datum-low = &1.
append r_datum.
end-of-definition.


* Now use the macro

build_range sy-datum.

Regards,

Rich Heilman

Message was edited by: Rich Heilman

Former Member
0 Kudos
147

Hi Joe;

Rich is right, you don't have to store it globally - you can just define it right in the program.

However, if you might want to check out this thread; it explains how to lock programs using a global macro.

Cheers,

John

Former Member
0 Kudos
147

Thanks guys. One more thing. If I wanted to send a list of individual dates to that macro, what would the syntax look like? Would it be macro_name: date1,

date2,

date3.

I think this is what I saw once before.

0 Kudos
147

Yes, but without the commas. Here is an example:

set_fldcat_typ 'BLDAT' 'C' '13' 'Vend Doc Date' ' ' ' '.

-John

0 Kudos
147

ranges: r_datum for sy-datum.

[code]Define build_range.

r_datum-sign = 'I'.

r_datum-option = 'EQ'.

<b>r_datum-low = &1.

r_datum-high = &2.</b>

append r_datum.

end-of-definition.

  • Now use the macro

build_range <b>sy-datum sy-datum.[/</b>code]

Regards.

Rich Heilman

Former Member
0 Kudos
147

Thanks again guys. Got it. I wanted to pass numerous single values to the macro and accomplished it like:

Build_macro: '64', '65', '66'.

This loaded the range with those three values.

0 Kudos
147

Oh, I misunderstood what you meant. I was think that you wanted to pass multiple values at one time to the range.

Regards,

Rich Heilman