‎2008 Nov 12 6:39 PM
Hi,
I do have the following code:
FORM read_authemployee.
EXEC SQL PERFORMING loop.
SELECT employee_id,
employee_group,
personnel_area,
exempt_ind,
work_state,
personnel_subarea,
employee_groupid
INTO :line_authemployee
FROM ath_employee
ENDEXEC.
ENDFORM.
FORM loop.
WRITE:/ line_authemployee-employee_id,
line_authemployee-employee_groupid.
ENDFORM.
When I execute the line_authemployee seems to have data in it. The problem I am having is I cannot loop with line_authemployee.. it seems like it is a structure. I also tried to create an internal table instead but still I couldnt loop through it. What I want to do is to have access to this data line by line and output it in a report format.
So if anyway could show me how to create a table in SQL that I could use to loop or show me how to loop this structure I will be very grateful.
Thanks,
Val.
‎2008 Nov 12 6:49 PM
check this example.
you can loop thru using wa1.
DATA: BEGIN OF wa,
connid TYPE spfli-connid,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto,
END OF wa.
DATA : wa1 LIKE wa OCCURS 0 WITH HEADER LINE.
DATA c1 TYPE spfli-carrid VALUE 'LH'.
EXEC SQL PERFORMING loop_output.
SELECT connid, cityfrom, cityto
INTO :wa
FROM spfli
WHERE carrid = :c1
ENDEXEC.
FORM loop_output.
WRITE: / wa-connid, wa-cityfrom, wa-cityto.
APPEND wa TO wa1.
ENDFORM.
‎2008 Nov 12 6:49 PM
You need to use a cursor to retrieve multiple lines.
This is documented in the F1 help for EXEC SQL.
Rob
Edited by: Rob Burbank on Nov 12, 2008 1:50 PM
‎2008 Nov 12 6:49 PM
check this example.
you can loop thru using wa1.
DATA: BEGIN OF wa,
connid TYPE spfli-connid,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto,
END OF wa.
DATA : wa1 LIKE wa OCCURS 0 WITH HEADER LINE.
DATA c1 TYPE spfli-carrid VALUE 'LH'.
EXEC SQL PERFORMING loop_output.
SELECT connid, cityfrom, cityto
INTO :wa
FROM spfli
WHERE carrid = :c1
ENDEXEC.
FORM loop_output.
WRITE: / wa-connid, wa-cityfrom, wa-cityto.
APPEND wa TO wa1.
ENDFORM.
‎2008 Nov 12 10:22 PM