SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Using MACROS



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Mon Sep 10, 2007 7:39 pm    Post subject: Using MACROS Reply with quote

DEFINE:
Code:
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:
Code:
add_comma &1 &2.


DEFINE:
Code:
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:
Code:
create_string date I E.


DEFINE:
Code:
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:
Code:
write_string date.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.