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

need help to understand this code

Former Member
0 Likes
505

HI,

how this code is working?

Regards

RANGES: r_pernr FOR pa0000-pernr.

DEFINE create_ranges.
  &1-sign = 'I' .
  &1-option = 'EQ' .
  &1-low = &2.
  append &1 .

  IF pernr IS NOT INITIAL.
    create_ranges r_pernr pernr.
  ENDIF.

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
488

DEFINE create_ranges.
  &1-sign = 'I' .
  &1-option = 'EQ' .
  &1-low = &2.
  append &1 .
ENDDEFINE.

The above piece of defines a macro named "create_ranges". As you know, macro acts nothing like a subroutine whereas &1 and &2 are formal parameters passed while calling the macro. &1 is the first parameter passed and &2 is the second parameter passed while calling the macro.


IF pernr IS NOT INITIAL.
  create_ranges r_pernr pernr.
ENDIF.

The above code calls the "create_ranges" macro with the parameters r_pernr (&1) and pernr (&2).


DEFINE <marco-name>

 <<Set of statements>>

ENDDEFINE.

"The above DEFINE... statement defines a macro named <marco-name>.

Hope this helps.

Thanks,

Balaji

3 REPLIES 3
Read only

Former Member
0 Likes
488

Hi,

If pernr is initial in the selection screen, then it will create a range and will be used in the code.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
488

  IF NOT pernr IS INITIAL.
    create_ranges r_pernr pernr.
  ENDIF.

if the field pernr is not empty it calls the DEFINEd macro CREATE_RANGES passing the range R_PERNR and the value to add to it, PERNR.

The range would then be used in other statements like:



  SELECT * INTO IT_PERSONS FROM PA001
     WHERE PERNR in R_PERNR.

Read only

Former Member
0 Likes
489

DEFINE create_ranges.
  &1-sign = 'I' .
  &1-option = 'EQ' .
  &1-low = &2.
  append &1 .
ENDDEFINE.

The above piece of defines a macro named "create_ranges". As you know, macro acts nothing like a subroutine whereas &1 and &2 are formal parameters passed while calling the macro. &1 is the first parameter passed and &2 is the second parameter passed while calling the macro.


IF pernr IS NOT INITIAL.
  create_ranges r_pernr pernr.
ENDIF.

The above code calls the "create_ranges" macro with the parameters r_pernr (&1) and pernr (&2).


DEFINE <marco-name>

 <<Set of statements>>

ENDDEFINE.

"The above DEFINE... statement defines a macro named <marco-name>.

Hope this helps.

Thanks,

Balaji