‎2006 Nov 02 9:25 AM
i wont to do a report of <b>list of error</b> and i put in itab the value in the call function.(see the function) my problem is that i dont now how to do the loop and the select that i can select values from itab where the if statment (y1,y2,y3) to be valid and i do the select and put it in other record.
please help
IF file_ser IS INITIAL.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
filename = l_name
FILETYPE = 'ASC'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = itab
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
OTHERS = 11
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
OPEN DATASET file_ser IN TEXT MODE
ENCODING DEFAULT FOR INPUT.
IF sy-subrc NE 0.
MESSAGE e002(yhr) .
ENDIF.
DO.
READ DATASET file_ser INTO wa_itab.
IF sy-subrc NE 0.
EXIT.
ENDIF.
APPEND wa_itab TO itab.
ENDDO.
ENDIF.
-
<b>CLEAR wa_itab.
LOOP AT itab INTO wa_itab.
IF wa_itab-action = 'y1'
OR wa_itab-action = 'y2'
OR wa_itab-action = 'y3'.
ENDIF.
ENDLOOP.
SELECT *
FROM t542a
WHERE molga ='IL'
AND ansvh = wa_itab-contract.
append itab_job.
endselect.
SELECT *
FROM t0001p
WHERE molga ='IL'
AND werks = wa_itab-personnel_area
AND btrtl = wa_itab-personnel_subarea.
select *
from hrp 1000
where otype ='s'
and plans = wa_itab-plans.
ENDSELECT.</b>
‎2006 Nov 02 9:52 AM
Hi Tomer,
1. get yr itab first.
2. loop at itab.
check condition.
get values into itab2.
apend itab2.
endloop.
3. use for all entries from itab2 and get the records like
if not itab2[] is initial.
SELECT *
FROM t542a
into table itab_job
for all entries in itab2
WHERE molga ='IL'
AND ansvh = itab2-contract.
endif.
note- using select statements in loop is not advisable.
-Anu
Message was edited by: Anupama Reddy
‎2006 Nov 02 9:34 AM
Hi,
try to do like this..
LOOP AT itab.
IF itab-action <> 'y1'
and itab-action <> 'y2'
and itab-action <>'y3'.
continue.
else.
append contents of itab to aothet internal table(in_itab)with same structure of itab.
ENDIF.
endloop.
SELECT *
FROM t542a
into table it_job
for all entries in in_itab.
WHERE molga ='IL'
AND ansvh = in_itab-contract
and same with other selects....
Madhavi
‎2006 Nov 02 9:38 AM
Hi Tomer,
You can try this:
CLEAR wa_itab.
LOOP AT itab INTO wa_itab where wa_itab-action = 'y1'
OR wa_itab-action = 'y2'
OR wa_itab-action = 'y3'.
SELECT *
FROM t542a
*into wa_t542a or into table i_t542a
WHERE molga ='IL'
AND ansvh = wa_itab-contract.
SELECT *
FROM t0001p
*into wa_t0001p or into table i_t0001p
WHERE molga ='IL'
AND werks = wa_itab-personnel_area
AND btrtl = wa_itab-personnel_subarea.
select *
from hrp 1000
*into wa_hrp 1000 or into table i_hrp 1000
where otype ='s'
and plans = wa_itab-plans.
append the
endloop.
Reward points if this Helps.
Manish
Message was edited by: Manish Kumar
‎2006 Nov 02 9:52 AM
Hi Tomer,
1. get yr itab first.
2. loop at itab.
check condition.
get values into itab2.
apend itab2.
endloop.
3. use for all entries from itab2 and get the records like
if not itab2[] is initial.
SELECT *
FROM t542a
into table itab_job
for all entries in itab2
WHERE molga ='IL'
AND ansvh = itab2-contract.
endif.
note- using select statements in loop is not advisable.
-Anu
Message was edited by: Anupama Reddy