Application Development and Automation 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: 
Read only

Issue with read statement with one more key missing in mapping

Former Member
0 Likes
652

Hi All ,

I have such data in two internals table :

IT_bdc
vbeln            posnr
90000593	10
90000576	10
90000672	10
90000672	20
90000672	30

it_konv
kbetr		vbeln
6250		90000576
12160000		90000593
500000		90000672
600000		90000672
700000		90000672

My current program statement is :

LOOP AT it_bdc.
READ TABLE it_konv WITH KEY
      vbeln = it_bdocs-vbeln.
  currency =   it_konv-waers.
*******
endloop.

as you can see the posnr is missing in it_konv how can i modify this read statement so

that vbeln posnr from it_bdc should get correct kbetr from it_konv.

Kindly help in this mapping.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
626

Hi,

KONV-KPOSN = VBRP-POSNR.

So add KPOSN in your IT_KONV and modify your read statement as


READ TABLE it_konv WITH KEY
      vbeln = it_bdocs-vbeln
      kposn = it_bdocs-posnr.

.

Thanks & Regards,

Faheem.

Hi All ,

I have such data in two internals table :

IT_bdc
vbeln            posnr
90000593	10
90000576	10
90000672	10
90000672	20
90000672	30

it_konv
kbetr		vbeln
6250		90000576
12160000		90000593
500000		90000672
600000		90000672
700000		90000672

My current program statement is :

LOOP AT it_bdc.
READ TABLE it_konv WITH KEY
      vbeln = it_bdocs-vbeln.
  currency =   it_konv-waers.
*******
endloop.

as you can see the posnr is missing in it_konv how can i modify this read statement so

that vbeln posnr from it_bdc should get correct kbetr from it_konv.

Kindly help in this mapping.

3 REPLIES 3
Read only

Former Member
0 Likes
626

Hi

sort it_konv by vbeln

then

loop at it_bdc.

read table it_konv with key vbeln = it_bdc-vbeln binary search.

if sy-subrc = 0.

perform your logic/task.

endif.

endloop.

also it depends what you want to do after reading it_konv.

in my logic if there is a vbeln in it_konv which s present in it_bdc then sy-subrc will be 0

and you can perform your logic.

and if there will be no matching vbeln in it_konv then sy-subrc will not be 0.

check the values in debugging.

Thanks

Lalit

Read only

Former Member
0 Likes
627

Hi,

KONV-KPOSN = VBRP-POSNR.

So add KPOSN in your IT_KONV and modify your read statement as


READ TABLE it_konv WITH KEY
      vbeln = it_bdocs-vbeln
      kposn = it_bdocs-posnr.

.

Thanks & Regards,

Faheem.

Read only

0 Likes
626

Thanks all, I made kposn available just as mentioned in one of internal table and problem is solved now.