‎2007 Sep 03 11:21 AM
hi max
i have loop for tmp_emp_day and i wont to do the loop target_hours_exp just one time (fill cnt_days just one time) in all the big loop (tmp_emp_day) how i do that?
LOOP AT tmp_emp_day ASSIGNING <fs_emp>.
CALL FUNCTION 'Z_EMP_CAP'
EXPORTING
pernr = <fs_emp>-pernr
begda = fir_day
endda = last_day
IMPORTING
target_hrs = target_hrs
TABLES
target_hours_exp = target_hours_exp
work_hours = work_hours.
<b>LOOP AT target_hours_exp ASSIGNING <target_hours_exp> WHERE stdaz = '0.5' .
ADD 1 TO cnt_days.
ENDLOOP.</b>
<fs_emp>-miss_days = <fs_emp>-miss_days - cnt_days.
APPEND <fs_emp> TO emp_miss_days.
ENDLOOP.
Regards
‎2007 Sep 03 11:27 AM
try
LOOP AT tmp_emp_day ASSIGNING <fs_emp>.
CALL FUNCTION 'Z_EMP_CAP'
EXPORTING
pernr = <fs_emp>-pernr
begda = fir_day
endda = last_day
IMPORTING
target_hrs = target_hrs
TABLES
target_hours_exp = target_hours_exp
work_hours = work_hours.
if sy-tabix = 1.
LOOP AT target_hours_exp ASSIGNING <target_hours_exp> WHERE stdaz = '0.5' .
ADD 1 TO cnt_days.
ENDLOOP.
endif.
plz reward points if it helps
‎2007 Sep 03 11:25 AM
put an EXIT command in between
loop...
ur code..
EXIT.
ENDLOOP.
‎2007 Sep 03 11:27 AM
Hi,
Use your loop inside these statements
LOOP AT...
IF sy-index EQ 1.
LOOP AT..
ENDLOOP. The inner loop that u want to execute once
ENDIF.
ENDLOOP.
Thanks and Best Regards,
Vikas Bittera.
‎2007 Sep 03 11:27 AM
try
LOOP AT tmp_emp_day ASSIGNING <fs_emp>.
CALL FUNCTION 'Z_EMP_CAP'
EXPORTING
pernr = <fs_emp>-pernr
begda = fir_day
endda = last_day
IMPORTING
target_hrs = target_hrs
TABLES
target_hours_exp = target_hours_exp
work_hours = work_hours.
if sy-tabix = 1.
LOOP AT target_hours_exp ASSIGNING <target_hours_exp> WHERE stdaz = '0.5' .
ADD 1 TO cnt_days.
ENDLOOP.
endif.
plz reward points if it helps
‎2007 Sep 03 11:29 AM
Hello Tal,
Use this logic.
loop at itab.
if sy-tabix = 1.
"your statements which has to execute only one time.
else.
exit.
endif.
endloop.
Reward If Useful
-
Sasi.