‎2008 Apr 22 8:26 AM
Hi ,
i have this code that return 7 times maybe i can do one perform
for all this code?
i new with this Topic
Regards
*---------first time-------*
CONCATENATE : eff_per_begin+2(4) eff_per_begin+0(2) INTO eff_per_begin,
eff_per_end+2(4) eff_per_end+0(2) INTO eff_per_end.
LOOP AT it_tab ASSIGNING <it_tab>
WHERE dim0calmonth GE eff_per_begin
AND dim0calmonth LE eff_per_end.
APPEND <it_tab> TO efficiency_tab.
ENDLOOP.
LOOP AT efficiency_tab ASSIGNING <efficiency_tab>.
MOVE-CORRESPONDING <efficiency_tab> TO wa_eff_tmp.
APPEND wa_eff_tmp TO eff_tmp.
CLEAR wa_eff_tmp.
ENDLOOP.
LOOP AT eff_tmp INTO wa_eff_tmp.
COLLECT wa_eff_tmp INTO eff_col.
ENDLOOP.
*----------seconed-------*
CONCATENATE : over_per_beg+2(4) over_per_beg+0(2) INTO over_per_beg,
over_per_end+2(4) over_per_end+0(2) INTO over_per_end.
LOOP AT it_tab ASSIGNING <it_tab>
WHERE dim0calmonth GE over_per_beg
AND dim0calmonth LE over_per_end.
APPEND <it_tab> TO overtime_tab.
ENDLOOP.
LOOP AT effi_tab ASSIGNING <effi_tab>.
MOVE-CORRESPONDING <effi_tab> TO wa_over_tmp.
APPEND wa_over_tmp TO over_tmp.
CLEAR wa_over_tmp.
ENDLOOP.
LOOP AT over_tmp INTO wa_over_tmp.
COLLECT wa_over_tmp INTO over_col.
ENDLOOP.and so on.... 7 times
Regards
‎2008 Apr 22 8:33 AM
Hi,
Yes you can put this in a subroutine.
Any variable name that will be different each time it is called or any that is changed by the subroutine need to be defined as parameters of the subroutine.
Regards,
Nick
‎2008 Apr 22 8:33 AM
Hi,
Yes you can put this in a subroutine.
Any variable name that will be different each time it is called or any that is changed by the subroutine need to be defined as parameters of the subroutine.
Regards,
Nick
‎2008 Apr 22 8:34 AM
Hi,
1.Define a form like this.
Form form_name using tables it_tab type yours_table,
efficiency_tab type
eff_tmp type .
CONCATENATE : eff_per_begin2(4) eff_per_begin0(2) INTO eff_per_begin,
eff_per_end2(4) eff_per_end0(2) INTO eff_per_end.
LOOP AT it_tab ASSIGNING <it_tab>
WHERE dim0calmonth GE eff_per_begin
AND dim0calmonth LE eff_per_end.
APPEND <it_tab> TO efficiency_tab.
ENDLOOP.
LOOP AT efficiency_tab ASSIGNING <efficiency_tab>.
MOVE-CORRESPONDING <efficiency_tab> TO wa_eff_tmp.
APPEND wa_eff_tmp TO eff_tmp.
CLEAR wa_eff_tmp.
ENDLOOP.
LOOP AT eff_tmp INTO wa_eff_tmp.
COLLECT wa_eff_tmp INTO eff_col.
ENDLOOP.
Endform.
2.Call this form by perform form_name using tables it_tab
eff_effieciency
eff_tmp .
Regards,
Shiva.