Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

plz...chk this.

Former Member
0 Kudos
124

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

1 ACCEPTED SOLUTION

former_member188827
Active Contributor
0 Kudos
74

its correct

9 REPLIES 9

former_member188827
Active Contributor
0 Kudos
75

its correct

Former Member
0 Kudos
74

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

0 Kudos
74

Hi Reddy,

He is using konp table in where condition konp~loevm_ko = 'X'. thats why he used join statement.

Thanks

Vikranth

0 Kudos
74

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

Former Member
0 Kudos
74

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

Former Member
0 Kudos
74

thanks a lot to all of you.

Former Member
0 Kudos
74

This is correct .

Are you getting any problems .

0 Kudos
74

hi,

i am not getting any syntax error but its not fetching records...

JanStallkamp
Employee
Employee
0 Kudos
74

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