Shared Top Border

Enterprise Resource
Planning Portal

 

Advertise | Founder BLOG

ERPGenie.COM ABAP Tips and Tricks Database

THE ultimate
ERP website

 

Forums | Vote for us |

Google    Other Search Options

Login

Login to view more content!!!





Lost Password?
No account yet? Register

Registered Access

Poll

What area of ABAP are you interested in?
 
Home arrow Sample Code arrow ABAP Reports arrow Defining Macros
Defining Macros PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Anon.   
Tuesday, 13 February 2007

3 examples of how to define and use macros.

 

DEFINE:

define add_comma.

* add comma for selection criteria output string

 

    if offset > 0.

      &1_string_&2+offset(1) = ','.

      offset = offset + 2.

    endif.

 

END-of-definition.                    " add_comma

USAGE: add_comma &1 &2.

 

DEFINE:

DEFINE create_string.

* loop for inclusions

  loop at s_&1.

    offset = strlen( &1_string_&2 ).

    c_low = s_&1-low.

    c_high = s_&1-high.

    shift c_low left deleting leading '0'.

    shift c_high left deleting leading '0'.

    shift c_low left deleting leading space.

    shift c_high left deleting leading space.

    if '&1' = 'date'.

      concatenate c_low+4(2) '/' c_low+6(2) '/'

                  c_low+2(2) into c_low.

      if not c_high is initial.

        concatenate c_high+4(2) '/' c_high+6(2) '/'

                    c_high+2(2) into c_high.

      endif.

    endif.

    case s_&1-option.

      when 'EQ'.

        check s_&1-sign = '&2'.

        add_comma &1 &2.

        &1_string_&2+offset = c_low.

      when 'NE'.

        check s_&1-sign = '&3'.

        add_comma &1 &2.

        &1_string_&2+offset = c_low.

      when 'GT'.

        check s_&1-sign = '&2'.

        add_comma &1 &2.

        &1_string_&2+offset = 'Greater than'.

        offset = offset + 13.

        &1_string_&2+offset = c_low.

      when 'LE'.

        check s_&1-sign = '&2'.

        add_comma &1 &2.

        &1_string_&2+offset = 'Less than or equal to'.

        offset = offset + 22.

        &1_string_&2+offset = c_low.

      when 'LT'.

        check s_&1-sign = '&2'.

        add_comma &1 &2.

        &1_string_&2+offset = 'Less than'.

        offset = offset + 10.

        &1_string_&2+offset = c_low.

      when 'BT'.

        check s_&1-sign = '&2'.

        add_comma &1 &2.

        concatenate &1_string_&2 c_low '-' c_high

             into &1_string_&2 separated by space.

      when 'NB'.

        check s_&1-sign = '&3'.

        add_comma &1 &2.

        concatenate &1_string_&2 c_low '-' c_high

             into &1_string_&2 separated by space.

    endcase.

  endloop.

END-OF-DEFINITION.                    " create_string

USAGE: create_string date I E.

 

DEFINE:

DEFINE WRITE_STRING.

 

  if ( &1_string_I is initial and

       &1_string_E is initial ).

    &1_string_I = 'All'.

  endif.

  if not &1_string_I is initial.

    write: /05 h_tag,

            22 'include:',

            31 &1_string_I.

    if not &1_string_E is initial.

      write: /22 'exclude:',

              31 &1_string_E.

    endif.

  elseif not &1_string_E is initial.

    write: /05 h_tag,

            22 'exclude:',

            31 &1_string_E.

  endif.

END-OF-DEFINITION.                    " write_string

USAGE: write_string date.


Related Items:

 
< Prev   Next >

Google Search

Statistics

Contribution Activity
Utilities: 39
Tips and Tricks: 337
Sample Code: 170
Total Contributions: 561

Member Activity
Members: 6341 since 2/1/2007!
New: 1 since yesterday!
Visitors: 1238856

Newest Members

Welcome our newest members:

Google Ads

Shared Bottom Border

Contact Us | Polls | Add URL | Contribute | Privacy | Terms | Feedback

Discussion Forum | BLOG | Consultants: Post your resume | Companies: Advertise on ERPGenie.COM | Post Job
Financials Consultant | Consultant Review | Gallia Consulting | Supply Chain Project | SAP Financials Forum
GenieHoldings.COM, Inc. | Genie Press | WorkflowGenie | ESAGenie | ERPTopSites | ABAP Tips and Tricks | SAP Solutions Database

EDIGenie | Searching Survivor