Supply Chain Management Blogs by Members
Learn about SAP SCM software from firsthand experiences of community members. Share your own post and join the conversation about supply chain management.
cancel
Showing results for 
Search instead for 
Did you mean: 
joachimrees1
Active Contributor
Situation:
When programming (for me it's EWM but surely it applies in my fields), I sometimes use ranges.
I use logging (SLG1) and want those ranges' content to also be logged.
I want clean code and not so much typing.

So this is what I use:
*Definition:
METHODS log_selection_range IMPORTING iv_name TYPE string
ir_range TYPE rseloption.

*Implementation:
METHOD log_selection_range.
*Selection / range for &1:
MESSAGE s014 WITH iv_name.
log->add_message( ).
LOOP AT ir_range ASSIGNING FIELD-SYMBOL(<range>).
*&1 &2 &3 &4.
MESSAGE s015 WITH <range>-sign
<range>-option
<range>-low
<range>-high.
log->add_message( ).
ENDLOOP.
ENDMETHOD.

And this is how I use it:
    "(1. fill ranges - not in picture)
"2. log ranges:
log_selection_range( iv_name = 'MATNR' ir_range = lr_matnr ).
log_selection_range( iv_name = 'LGTYP' ir_range = lr_lgtyp ).
"3. use ranges:
srv_hu->hu_select_gen( EXPORTING ir_matnr = lr_matnr
ir_lgtyp = lr_lgtyp
IMPORTING et_huitm = DATA(lt_hu_item) ).

What do you think?
How do you handle logging and ranges?

best
Joachim
2 Comments
Labels in this area