‎2009 Apr 22 8:24 AM
hi,
can we write select on structure?.........i hav to get condition record from konv(which is a structure) based on ekpo-ebeln.
for this i hav written code like this
IF NOT it_ekpo IS INITIAL.
SELECT knumv
kposn
kschl
kbetr
waers
KWERT
FROM konv
INTO TABLE it_konv
FOR ALL ENTRIES IN it_ekpo
WHERE knumv = it_ekpo-ebeln
and kposn = it_ekpo-ebelp
AND ( kschl EQ 'ZPF3' OR kschl EQ 'ZVAT'
OR kschl EQ 'ZCSR' OR kschl EQ 'ZFR3' ).
IF sy-subrc EQ 0.
SORT it_konv BY knumv kposn.
ENDIF.
ENDIF.
‎2009 Apr 22 8:28 AM
Hi
U can't write a select statement on structures/internal tables it's valid only for database tables/views.
Regards,
Sreeram
‎2009 Apr 22 8:33 AM
Hi
You cannot write the Select statement on Structures but yo have a table for that structure where you will get the same data.
You can use komv & konp table instead of structure .
IF NOT IT_EKPO IS INITIAL.
SELECT KNUMV
KPOSN
KSCHL
KBETR
WAERS
KWERT
FROM KONV
INTO TABLE IT_KONP
FOR ALL ENTRIES IN IT_EKPO
WHERE KNUMV = IT_EKPO-EBELN
AND ( KSCHL EQ 'ZPF3' OR KSCHL EQ 'ZVAT'
OR KSCHL EQ 'ZCSR' OR KSCHL EQ 'ZFR3' ).
ENDIF.
Thanks & regards,,
Dileep .C
‎2009 Apr 22 8:42 AM
Structures contain data only at run time .
Select statement is not meant for structures.
‎2009 Apr 22 8:44 AM
Select statement that you have mentioned is correct and is using database table.
‎2009 Apr 22 8:48 AM
‎2009 Apr 22 8:53 AM
In ur where condition of select query U r comparing KNUMV = it_ekpo-ebeln which is wrong
it SHOULD BE:-
KNUMV = IT_EKKO_KNUMV.(in ur where condition of select query). KNUMV field is in EKKO the header table for PO not EKPO.
Edited by: vijetasap on Apr 22, 2009 9:53 AM
‎2009 Apr 22 9:02 AM
but i m not getting into variables.
LOOP AT it_konv INTO wa_konv.
IF wa_konv-kschl = 'ZPF3'.
v_pacnfwd = wa_konv-kWERT.
ELSEIF wa_konv-kschl = 'ZVAR'.
v_tax = wa_konv-kWERT.
ELSEIF wa_konv-kschl = 'ZCSR'.
v_cst = wa_konv-kWERT.
ELSEIF wa_konv-kschl = 'ZFR3'.
v_freight = wa_konv-kWERT.
ENDIF.
ENDLOOP.
‎2009 Apr 22 9:07 AM
have u changed ur code from EKPO table to EKKO table
IF NOT it_ekko IS INITIAL.
SELECT knumv
kposn
kschl
kbetr
waers
KWERT
FROM konv
INTO TABLE it_konv
FOR ALL ENTRIES IN it_ekpo
WHERE knumv = it_ekko-knumv
AND ( kschl EQ 'ZPF3' OR kschl EQ 'ZVAT'
OR kschl EQ 'ZCSR' OR kschl EQ 'ZFR3' ).
IF sy-subrc EQ 0.
SORT it_konv BY knumv kposn.
ENDIF.
ENDIF.
‎2009 Apr 22 9:11 AM
‎2009 Apr 22 9:11 AM
Structure contains data at runtime only.
Select statement won't work for Structures.
Regards,
Joan
‎2009 Apr 22 9:12 AM
‎2009 Apr 22 9:16 AM
u r getting the data bcoz KONV is a table as well. Now what is ur problem plz explain....
Thanks
Vijeta
‎2009 Apr 22 10:49 AM
while looping over it_konv........the data is not getting and filled in work areas
‎2009 Apr 22 11:31 AM
please debug at loop atatement and see whether work area is populated or not and see whether ur table itab is table with header line or without header line.
‎2009 Apr 22 11:39 AM
work area data is not populating and internal table is without header line............
‎2009 Apr 22 11:45 AM
‎2009 Apr 22 12:03 PM
‎2009 Apr 22 9:14 AM
Hi,
select statement cannot be used on structures as they are meant to point the table rows and hold data only at runtime. Even if you want to fetch data from the structure, do it using table which the structure represents...
Mac.
‎2009 Apr 22 11:02 AM
Hi,
You cannot put select query on any
structure, you have to find out the
table name from the database that
have all your required fields then put
select query on that.
Hope it helps
Regards
Mansi