‎2006 Jul 20 8:26 AM
Hi,
I declared intrnal table with 4 fields and I filled the internal table with the data. I wnat to read the internal table using with 2 key fields. How can I do it thies.
If I am writing like below, its giving error.
'Read table i_vbrp WITH TABLE KEY
vbeln = i_sub_table-vbeln
posnr = i_sub_table-posnr.'
It is giving error like below
The declaration for the key field "VKBUR" is incomplete. However,"VKBUR" is is contained in the key of table "I_VBRP". and must be filled.
here VKBUR is also a internal table field.
Please give Idea, How can I resolve this problem.
Thanks & Regards
Venkat
‎2006 Jul 20 8:29 AM
Hi Venkat,
Can you post the declaration of the internal table I_VBRP ?
Regards,
Anand Mandalika.
‎2006 Jul 20 8:31 AM
May be you can try this -
READ TABLE I_VBRP WITH KEY
VBELN = I_SUB_TABLE-VBELN
POSNR = I_SUB_TABLE-POSN.Regards,
Anand Mandalika.
‎2006 Jul 20 9:06 AM
HI Anand Mandalika,
Its working fine.
If I want to chek non blank value like below
READ TABLE I_VBRP WITH KEY VBELN = I_SUB_TABLE-VBELN
POSNR = I_SUB_TABLE-posnr
VKGRP <> ''
VKBUR <> ''.
How can I do it this.
Thanks & Regards
Venkat
‎2006 Jul 20 9:11 AM
Hi Venkata,
You cannot do that in READ statement. But you can use that in your select statement so when you read your internal table, you are sure that you will not get any VKGRP and VKBUR that are blank.
Hope this helps...
P.S. Please award points if found useful.
‎2006 Jul 20 8:29 AM
If you use TABLE kEY statment all fields of KEY must be used with the same order as declaration of the key!!
Read table i_vbrp WITH TABLE KEY
Vkbur = something
vbeln = i_sub_table-vbeln
posnr = i_sub_table-posnr.'
BR< JAcek
‎2006 Jul 20 8:36 AM
hi venkat,
if u are using table key in reading that internal table,
then u need to pass all the keys of table.
if u want to read with only 2 keys then try this
'Read table i_vbrp WITH KEY
vbeln = i_sub_table-vbeln
posnr = i_sub_table-posnr.
u can use binary search also to improve performance but by sorting the table .
‎2006 Jul 20 8:42 AM
Hi Venkat,
I am assuming you declared your table as sorted table, then it should be like this.
TYPES:Begin of type_vbrp,
vbeln type vbeln_vf,
posnr type posnr,
vkbur type vkbur,
meins type meins_d,
End of type_vbrp.
TYPES : TYPE_VBRP_TBL TYPE SORTED TABLE OF TYPE_VBRP
WITH UNIQUE KEY VBELN POSNR.
....
Read table i_vbrp WITH TABLE KEY
vbeln = i_sub_table-vbeln
posnr = i_sub_table-posnr
binary search.
Regards,
Raghav
‎2006 Jul 20 8:47 AM
Hi,
Change your READ statement as:
READ TABLE I_VBRP WITH KEY VBELN = I_SUB_TABLE-VBELN
POSNR = I_SUB_TABLE-POSNR.
You can use WITH TABLE KEY if you declared your itab as HASHED.
Regards!
P.S> Please award points for useful answers
‎2006 Jul 20 9:00 AM
Instead of this 'Read table i_vbrp WITH TABLE KEY
you have to use 'Read table i_vbrp WITH KEY .
Regards
Abhishek