2010 Apr 13 6:46 AM
i have to write code as per ECC 6.0
LOOP AT it_likp INTO wa_likp.
wa_output-werks = wa_likp-werks.
wa_output-vrkme = wa_likp-vrkme.
wa_output-lfimg = wa_likp-lfimg.
IF wa_output-werks <> ' '.
SELECT name1 FROM t001w INTO wa_output-plant1
WHERE werks = wa_output-werks
AND spras = sy-langu.
ENDSELECT. ""#EC CI_USE_WANTED
ENDIF.
append wa_output to it_output.
end loop.
now the above code is as per 4.6 version.
as per ECC 6.0 please tell how to write select statemnet out side the loop and read statement in side the loop..
please give coding for that
2010 Apr 13 7:02 AM
Hi..
try this..
it_tab, wa_tab are internal table nad work area respectively.
SELECT name1 FROM t001w INTO table it_tab
for all entries in it_likp
WHERE werks = it_likp-werks
AND spras = sy-langu.
LOOP AT it_likp INTO wa_likp.
move wa_likp-werks wa_output-werks .
move wa_likp-vrkme wa_output-vrkme.
move wa_likp-lfimg wa_output-lfimg .
if sy-subrc eq 0.
read table it_tab to wa_tab where werks = wa_likp-werks.
move wa_tab-name1 to wa_output-name1.
append wa_output to it_output.
endif.
endloop.
Regards,
Lokeswari.
i have to write code as per ECC 6.0
LOOP AT it_likp INTO wa_likp.
wa_output-werks = wa_likp-werks.
wa_output-vrkme = wa_likp-vrkme.
wa_output-lfimg = wa_likp-lfimg.
IF wa_output-werks <> ' '.
SELECT name1 FROM t001w INTO wa_output-plant1
WHERE werks = wa_output-werks
AND spras = sy-langu.
ENDSELECT. ""#EC CI_USE_WANTED
ENDIF.
append wa_output to it_output.
end loop.
now the above code is as per 4.6 version.
as per ECC 6.0 please tell how to write select statemnet out side the loop and read statement in side the loop..
please give coding for that
2010 Apr 13 6:52 AM
the above code is not limited to 4.6 c or ECC 6.0 but its generic code which needs abap enhancement .
get this in a internal table
//SELECT name1 FROM t001w INTO wa_output-plant1
WHERE werks = wa_output-werks
AND spras = sy-langu.
name1 werks should be in internal table.
sort the internal table holding the entries.
LOOP AT it_likp INTO wa_likp.
wa_output-werks = wa_likp-werks.
wa_output-vrkme = wa_likp-vrkme.
wa_output-lfimg = wa_likp-lfimg.
IF wa_output-werks ' '.
read table itab with key werks = wa_likp-serks binary search. " just this
if sy-subrc eq 0.
wa_output-plant1 = name ."check the entry
endif.
ENDIF.
append wa_output to it_output.
end loop.
you are expected to do this on your own ..
...........
br,
Vijay
2010 Apr 13 7:08 AM
actually in the loop statemnet only we are getting values from wa_likp to wa_output.
before the loop statement wa_output-werks is empty.
how can we write select statement depending on wa_output-werks???
please tell in detail
2010 Apr 13 7:11 AM
2010 Apr 13 7:12 AM
t001w table has less than 500 entries .. whats the big deal in taking all the entries from the table .
take a internal table with two fields in it and using select fill the entries .. i hope it is clear to you ..
---
vijay
2010 Apr 13 10:29 AM
one more doubt
after selecting name1.
i wanted to write
IF wa_likp-lfart = 'ZPFL'.
SELECT vbelv
posnv
posnn
vbeln
vbtyp_n
INTO wa_vbfa
FROM vbfa
WHERE vbelv = wa_likp-vbeln
AND posnv = wa_likp-posnr
AND vbtyp_n = 'M'.
ENDSELECT.
endif.
let me know how to write correctly
because my data is in it_likp...........if i give wa_likp its empty
if i tried to give it_likp-lfart its telling there is no header line so it does not exists
2010 Apr 13 7:02 AM
Hi..
try this..
it_tab, wa_tab are internal table nad work area respectively.
SELECT name1 FROM t001w INTO table it_tab
for all entries in it_likp
WHERE werks = it_likp-werks
AND spras = sy-langu.
LOOP AT it_likp INTO wa_likp.
move wa_likp-werks wa_output-werks .
move wa_likp-vrkme wa_output-vrkme.
move wa_likp-lfimg wa_output-lfimg .
if sy-subrc eq 0.
read table it_tab to wa_tab where werks = wa_likp-werks.
move wa_tab-name1 to wa_output-name1.
append wa_output to it_output.
endif.
endloop.
Regards,
Lokeswari.
2010 Apr 13 8:30 AM
Ur code is very helpful..
but i have declared
DATA: it_output TYPE STANDARD TABLE OF ty_output,
it_output1 TYPE STANDARD TABLE OF ty_output,
it_tab TYPE STANDARD TABLE OF ty_output.
it_tabe as just like ty_output.
as it is already defined.
and wa also like
DATA :wa_output LIKE LINE OF it_output,
wa_output1 LIKE LINE OF it_output1,
wa_tab type ty_output.
Ur code is working fine but at last when i am using read statemnet its not moving from it_tab to wa_tab.
if i am debugging for wa_tab its showing its non charlike structure??
can u tell me what to so
2010 Apr 13 8:39 AM
Hi..
try like this..
it_tab, wa_tab are internal table nad work area respectively.
SELECT *werks name1 * FROM t001w INTO table it_tab
for all entries in it_likp
WHERE werks = it_likp-werks
AND spras = sy-langu.
LOOP AT it_likp INTO wa_likp.
move wa_likp-werks wa_output-werks .
move wa_likp-vrkme wa_output-vrkme.
move wa_likp-lfimg wa_output-lfimg .
if sy-subrc eq 0.
read table it_tab to wa_tab where werks = wa_likp-werks.
move wa_tab-name1 to wa_output-name1.
append wa_output to it_output.
endif.
endloop.
Regards,
Lokeswari.
2010 Apr 13 8:41 AM
hi..
define it_tab like
types : begin of iy_tab,
werks type T001W-werks,
nem1 type T001W-name1,
end of iy_tab.
data : it_tab type standard table of iy_tab,
wa_tab type iy_tab.
2010 Apr 13 9:23 AM
hi,
As per ur code
if sy-subrc eq 0.
read table it_tab to wa_tab where werks = wa_likp-werks.
move wa_tab-name1 to wa_output-name1.
append wa_output to it_output.
endif.
endloop.
when i am using select statemnet i am getting data into it_tab.
but when i am using read statement it not moving to wa_tab
whats wrong in that???
2010 Apr 13 9:34 AM
Hi...
Check for the sy-subrc value before move statement and also check for values in it_likp table.
after moving it_likp values to wa_output only , we are able to move name field from wa_tab.
Regards,
Lokeswari.
2010 Apr 13 9:40 AM
Hi Deepthi,
Try this way:
If wa_likp-werks is not initial.
SELECT name1 FROM t001w INTO wa_output1-plant1
WHERE werks = wa_likp-werks
AND spras = sy-langu.
ENDSELECT.
endif.
LOOP AT it_likp INTO wa_likp.
read table itab with key werks = wa_likp-werks.
if sy-subrc = 0.
wa_output-werks = wa_likp-werks.
wa_output-vrkme = wa_likp-vrkme.
wa_output-lfimg = wa_likp-lfimg.
endif.
IF wa_output-werks ' '.
wa_output-werks = wa_output1-name1.
ENDIF.
append wa_output to it_output.
endloop.Press F1 help on read statemnt. Your syntax is wrong.
2010 Apr 13 9:44 AM
hi...
sorry for the previous replies..
try this code.. this time it will resolve your problem.
it_tab, wa_tab are internal table nad work area respectively.
SELECT name1 FROM t001w INTO table it_tab
for all entries in it_likp
WHERE werks = it_likp-werks
AND spras = sy-langu.
LOOP AT it_likp INTO wa_likp.
move wa_likp-werks wa_output-werks .
move wa_likp-vrkme wa_output-vrkme.
move wa_likp-lfimg wa_output-lfimg .
if sy-subrc eq 0.
read table it_tab to wa_tab with key werks = wa_likp-werks.
move wa_tab-name1 to wa_output-name1.
append wa_output to it_output.
endif.
endloop.
Regards,
Lokeswari.
2010 Apr 13 12:17 PM
Hi...
loop at it_likp to wa_likp
IF wa_likp-lfart = 'ZPFL'.
SELECT vbelv
posnv
posnn
vbeln
vbtyp_n
FROM vbfa
for all entries in it_likp
WHERE vbelv = it_likp-vbeln
AND posnv = it_likp-posnr
AND vbtyp_n = 'M'.
endif.
endloop.
Regards,
Lokeswari.
2010 Apr 13 12:18 PM
Hi...
loop at it_likp to wa_likp
IF wa_likp-lfart = 'ZPFL'.
SELECT vbelv
posnv
posnn
vbeln
vbtyp_n
FROM vbfa
WHERE vbelv = wa_likp-vbeln
AND posnv = wa_likp-posnr
AND vbtyp_n = 'M'.
endif.
endloop.
Regards,
Lokeswari.
2010 Apr 13 7:10 AM
{If wa_likp-werks is not initial.
SELECT name1 FROM t001w INTO wa_output1-plant1
WHERE werks = wa_likp-werks
AND spras = sy-langu.
ENDSELECT. ""#EC CI_USE_WANTED
endif.}
{LOOP AT it_likp INTO wa_likp.
wa_output-werks = wa_likp-werks.
wa_output-vrkme = wa_likp-vrkme.
wa_output-lfimg = wa_likp-lfimg.
IF wa_output-werks ' '.
wa_output-werks = wa_output1-name1.
ENDIF.
append wa_output to it_output.
end loop.}
Hope it will resolve ur problem..
2010 Apr 13 9:07 AM
HI Try my code,
you just need to do a simple change,
declare a work are wa_output1 same as wa_output.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |