2007 Nov 26 8:19 AM
Dear All
What is the Syntax for Loop At Statment and where statment
Thanks and Regards
Suresh
LOOP AT itab INTO wa <condn>.
endloop.
for example,
data: begin of wa,
itemno type i,
end of wa.
data: itab like table of wa.
loop at itab into wa where itemno = 1.
endloop.
http://help.sap.com/saphelp_nw70/helpdata/en/9f/db9f1f35c111d1829f0000e829fbfe/frameset.htm
Message was edited by:
Muthurajan Ramkumar
2007 Nov 26 8:21 AM
loop at itab into wa where field = ''.
endloop.
PARAMETERS p_name TYPE scarr-carrname DEFAULT '*'.
DATA: scarr_tab TYPE SORTED TABLE OF scarr
WITH UNIQUE KEY carrname,
spfli_tab TYPE SORTED TABLE OF spfli
WITH NON-UNIQUE KEY carrid.
FIELD-SYMBOLS LIKE LINE OF scarr_tab.
DATA spfli_line LIKE LINE OF spfli_tab.
SELECT *
FROM scarr
INTO TABLE scarr_tab.
SELECT *
FROM spfli
INTO TABLE spfli_tab.
LOOP AT scarr_tab ASSIGNING
WHERE carrname CP p_name.
LOOP AT spfli_tab INTO spfli_line
WHERE carrid = -carrid.
WRITE: / spfli_line-carrid,
spfli_line-connid.
ENDLOOP.
ENDLOOP.
Example
The following loop deletes all lines of an internal table since - through the short form of the DELETE statement - the current first line is always deleted.
DATA itab TYPE TABLE OF i.
DATA wa LIKE LINE OF itab.
LOOP AT itab INTO wa TO 6.
DELETE itab.
ENDLOOP.
2007 Nov 26 8:21 AM
LOOP AT itab INTO wa <condn>.
endloop.
for example,
data: begin of wa,
itemno type i,
end of wa.
data: itab like table of wa.
loop at itab into wa where itemno = 1.
endloop.
http://help.sap.com/saphelp_nw70/helpdata/en/9f/db9f1f35c111d1829f0000e829fbfe/frameset.htm
Message was edited by:
Muthurajan Ramkumar
2007 Nov 26 8:22 AM
Hi,
loop at itab into wa_itab where <condition>.
endloop.
Regards,
Vani.
2007 Nov 26 8:23 AM
Hi..
Consider <b>ITAB</b>, is ur internal table having two fields.
<b>LOOP AT ITAB WHERE FIELD1 = 'ABC' and
FIELD2 = 'DEF'.
~~~~~~~~~~~~
~~~~~~~~~~~~~~~
ENDLOOP</b>.
With Rgds,
S.BARANI
2007 Nov 26 8:30 AM
Dear All
Thanks
LOOP AT ITAB WHERE FIELD1 = 'ABC' and
FIELD2 = 'DEF'.
In this above examble field1,field2 values are assign directly but i want same internal table values how?
Regards
Suresh
2007 Nov 26 8:23 AM
Hi,
Loop at itab into wa where <condition>
....
...
endloop.
Hope it is useful.
Thanks,
Sandeep.
2007 Nov 26 8:24 AM
Hi,
Example
LOOP AT ITAB INTO STRUC WHERE BLNCE <> 0.
WRITE: STRUC-NAME, STRUC-BLNCE.
ENDLOOP.
2007 Nov 26 8:34 AM
Hi,
I think you can do it this way:
sort itab by f1 f2.
loop at itab into wa.
read table itab into wa2
with key f1 = wa-f1
f2 = wa-f2.
endloop.
Hope it works,
Thanks,
Sandeep.
2007 Nov 26 8:38 AM
Hi,
Refer this code
LOOP AT it_t510 INTO wa_t510
WHERE trfar EQ 'UN'.
*
IF ( wa_t510-begda GE wa_pa0008-begda ) AND
( wa_t510-begda LE wa_pa0008-endda ).
*
wa_final-bet01 = wa_t510-betrg.
*
ENDIF.
*
ENDLOOP.
Regards,
PRashant
2007 Nov 26 8:51 AM
Hi,
Please take a look at the example below:
PARAMETERS p_name TYPE scarr-carrname DEFAULT '*'.
DATA: scarr_tab TYPE SORTED TABLE OF scarr
WITH UNIQUE KEY carrname,
spfli_tab TYPE SORTED TABLE OF spfli
WITH NON-UNIQUE KEY carrid.
FIELD-SYMBOLS LIKE LINE OF scarr_tab.
DATA spfli_line LIKE LINE OF spfli_tab.
SELECT *
FROM scarr
INTO TABLE scarr_tab.
SELECT *
FROM spfli
INTO TABLE spfli_tab.
LOOP AT scarr_tab ASSIGNING
WHERE carrname CP p_name.
LOOP AT spfli_tab INTO spfli_line
WHERE carrid = -carrid.
WRITE: / spfli_line-carrid,
spfli_line-connid.
ENDLOOP.
ENDLOOP.
Hope it helps...
P.S. Please award points if it helps...
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |