2008 Jun 19 11:16 AM
hi,
can any one tell me, this is correct or not..?
check not itab2[] is initial.
select konh~knumh
konh~kosrt from konh join konp
on konhknumh = konpknumh
into corresponding fields of
table itab3
for all entries in itab2
where konh~knumh = itab2-knumh and
kosrt in srchterm and
konp~loevm_ko = 'X'.
loop at itab3 into wa_itab3.
read table itab2 into wa_itab2 with key knumh = wa_itab3-knumh.
if sy-subrc = 0.
move:
wa_itab2-vbeln to wa_itab4-vbeln,
wa_itab2-posnr to wa_itab4-posnr,
wa_itab2-matnr to wa_itab4-matnr,
wa_itab3-knumh to wa_itab4-knumh,
wa_itab3-kosrt to wa_itab4-kosrt.
append wa_itab4 to itab4.
endif.
endloop.
thanks
2008 Jun 19 11:19 AM
2008 Jun 19 11:19 AM
2008 Jun 19 11:21 AM
Hi Santisini,
check not itab2[] is initial.
select konh~knumh
konh~kosrt from konh join konp
on konh~knumh = konp~knumh
into corresponding fields of
table itab3
for all entries in itab2
where konh~knumh = itab2-knumh and
kosrt in srchterm and
konp~loevm_ko = 'X'.Why are u joining KONP and KONH.
u are only selecting KONH fields .
Best regards,
raam
2008 Jun 19 11:23 AM
Hi Reddy,
He is using konp table in where condition konp~loevm_ko = 'X'. thats why he used join statement.
Thanks
Vikranth
2008 Jun 19 11:28 AM
Hi,
ooh sorry i dint check that...
check not itab2[] is initial.
select konh~knumh
konh~kosrt from konh join konp
on konh~knumh = konp~knumh
into corresponding fields of
table itab3
for all entries in itab2
where konh~knumh = itab2-knumh and
kosrt in srchterm and
konp~loevm_ko = 'X'.One more thing
Its better to check the internal table ITAB3 before processing.
check not itab2[] is initial.
select konh~knumh
konh~kosrt from konh join konp
on konh~knumh = konp~knumh
into corresponding fields of
table itab3
for all entries in itab2
where konh~knumh = itab2-knumh and
kosrt in srchterm and
konp~loevm_ko = 'X'.
If not itab3[] is initial.
loop at itab3 into wa_itab3.
read table itab2 into wa_itab2 with key knumh = wa_itab3-knumh.
if sy-subrc = 0.
move:
wa_itab2-vbeln to wa_itab4-vbeln,
wa_itab2-posnr to wa_itab4-posnr,
wa_itab2-matnr to wa_itab4-matnr,
wa_itab3-knumh to wa_itab4-knumh,
wa_itab3-kosrt to wa_itab4-kosrt.
append wa_itab4 to itab4.
endif.
endif.
endloop.Best regards,
raam
2008 Jun 19 11:22 AM
Hi,
Noting wrong in the code. but use Clear: itab4, wa_itab4. after append.
wa_itab2-vbeln to wa_itab4-vbeln,
wa_itab2-posnr to wa_itab4-posnr,
wa_itab2-matnr to wa_itab4-matnr,
wa_itab3-knumh to wa_itab4-knumh,
wa_itab3-kosrt to wa_itab4-kosrt.
append wa_itab4 to itab4.
Clear: itab4, wa_itab4.Thanks
Vikranth
2008 Jun 19 11:31 AM
2008 Jun 19 12:21 PM
2008 Jun 19 12:29 PM
hi,
i am not getting any syntax error but its not fetching records...
2008 Jun 19 1:06 PM
Hi.
Please have a look into the [rules of engagement|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] of all SDN forums. Threads not following the rules will be deleted. See Michael Schwandt's [blog about strict moderation|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/10047] [original link is broken] [original link is broken] [original link is broken]; for details. As these strict moderation policy is quite new I will not delete this thread but lock it.
Best regards,
Jan Stallkamp