Hi All,
Iam getting problem when i was using select queiry based on vbak,vbap and konv tables.
Error is i am not able to get all condition types but i am getting only first record
Example...
number of the document condition which is KNUMV
condition item number which is KPOSN
condition type which is kshcl
knumv kposn kshcl
00000002 000100 zpro
00000002 000100 zdsc
00000002 000100 zima
00000002 000100 zpak
but iam getting only first fecord not getting all the records
like
000000002 000100 zpro
code is ..........
*select Sales Document: Header Data and Item Data from vbak and vbap
select avbeln aerdat aernam aauart avkorg avtweg aspart akunnr avkbur avkgrp alifsk afaksk aaugru aknumv
bposnr bmatnr bwerks blgort bkwmeng bpstyv babgru bbedae blprio bvstel bntgew bbrgew
bvolum bfaksp bktgrm btaxm1 babfor bkalsm_k bmatkl bkondm bgsber bprctr
into corresponding fields of table it_vbak
from vbak as a inner join vbap as b on avbeln = bvbeln
where a~vbeln in lr_vbeln and
a~vkorg in lr_vkorg and
a~vtweg in lr_vtweg and
a~spart in lr_spart and
b~werks in lr_plant and
a~auart in lr_auart and
a~erdat in lr_erdat.
Move all the data to it_sorder
IF sy-subrc = 0.
LOOP AT it_vbak.
MOVE-CORRESPONDING it_vbak TO it_sorder.
APPEND it_sorder.
CLEAR it_sorder.
ENDLOOP.
ENDIF.
*select Conditions from konv
IF NOT it_sorder[] IS INITIAL.
SELECT knumv kposn STUNR KAPPL ZAEHK kschl kbetr KAWRT
INTO CORRESPONDING FIELDS OF TABLE it_konv
FROM konv FOR ALL ENTRIES IN it_sorder
WHERE knumv = it_sorder-knumv and
kposn = it_sorder-posnr.
ENDIF.
Read Conditions from it_konv move it to it_sorder
sort it_konv by knumv .
sort it_sorder by knumv .
LOOP AT it_sorder.
READ TABLE it_konv WITH KEY knumv = it_sorder-knumv
kposn = it_sorder-POSNr binary search.
IF sy-subrc = 0.
it_sorder-Kposn = it_konv-kposn.
it_sorder-STUNR = it_konv-STUNR.
it_sorder-KAPPL = it_konv-KAPPL.
it_sorder-ZAEHK = it_konv-ZAEHK.
it_sorder-kschl = it_konv-kschl.
it_sorder-kbetr = it_konv-kbetr.
MODIFY it_sorder.
CLEAR it_sorder.
ENDIF.
CLEAR it_konv.
ENDLOOP.
pls can you help me
thanks
mars