2009 Nov 12 8:03 AM
Hi all,
data: BEGIN OF ty_vbeln occurs 10,
vbeln TYPE char30,
END OF ty_vbeln.
<code continues>
LOOP AT T_FPR_DATA INTO FS_FPR_DATA.
ty_vbeln-VBELN = FS_FPR_DATA-field1.
collect ty_vbeln.
ty_vbeln-VBELN = FS_FPR_DATA-field2.
collect ty_vbeln.
ty_vbeln-VBELN = FS_FPR_DATA-field3.
collect ty_vbeln.
ENDLOOP.
SORT TY_VBELN BY VBELN.
Now in TY_VBELN i am having records , to this records i want to validate with LIKp(VBELN) records.
Suppose in my ty_vbeln internal table i am having 1,2,3,4,5(delivery numbers) records and in LIKP table have
1,3,4 records so i should fetch only 1,3,4 delivery numbers into another internal table how to achieve this?
Regards
VEnk@
2009 Nov 12 8:17 AM
2009 Nov 12 8:15 AM
Hello Venkat,
Just write a select query on LIKP with the internal table values and get the vaild records in the another table
select vbeln
into table itab
from likp
for all entries in ty_vbeln
where vbeln = ty_vbeln-vbeln.
Now itab will have the valid records. Will this not be sufficient?
Vikranth
2009 Nov 12 8:31 AM
Hi Vikranth,
I have declared the Itab and as shown below
data: BEGIN OF ty_vbeln occurs 10,
vbeln TYPE char30,
END OF ty_vbeln.
data: BEGIN OF t_vbeln occurs 10,
vbeln TYPE char30,
END OF t_vbeln.
and used your select query
select vbeln into table t_vbeln from likp
for all entries in ty_vbeln
where vbeln = ty_vbeln-vbeln.
Now the problem is as i am using "FOR ALL ENTRIES" the field VBELN and TY_VBELN-VBELN should
have same type and length but LIKp-VBELn is of type CHAR length 10 where as my TY_VBELN-VBELN
is of type CHAR and length - 30.
How to over come from this error.
Regards
VEnk@
2009 Nov 12 8:50 AM
Hello Venkat,
The best option would be to change the declaration of the internal table ty_vbeln to likp-vbeln. If you are not permitted to do that,
declare another internal table and append lines to it.
data: BEGIN OF ty_vbeln occurs 10,
vbeln TYPE char30,
END OF ty_vbeln.
data: BEGIN OF t_vbeln occurs 10,
vbeln TYPE char30,
END OF t_vbeln.
data: BEGIN OF t_temp occurs 10,
vbeln TYPE char10,
END OF t_temp.
append lines of ty_vbeln to t_temp. " If you are sure that the vbeln length doesnot increase more than 10
select vbeln into table t_vbeln from likp
for all entries in t_temp
where vbeln = t_temp-vbeln.
Vikranth
2009 Nov 12 8:17 AM
2009 Nov 12 8:19 AM
Hi Venkat,
First define a ranges table with your values. Then select the data from LIKP table into an internal table based on ranges ex: TY_LIKP.
Now LOOP over TY_LIKP & then READ table TY_VBELN where VBELN = TY_LIKP-VBELN.
if sy-subrc = 0.
APPEND it to another internal table.
I hope it helps you.
Please set to resolved if that helps you.
Regards
Abhii....
2009 Nov 12 8:53 AM
reference to
So you have chnged the code using ranges as i said,
change it like this
data:ra_likp type range of likp-vbeln.
data:wa_likp like line of ra_likp.
LOOP AT T_FPR_DATA INTO FS_FPR_DATA.
wa_likp-low = FS_FPR_DATA-field1.
collect wa_likp into ra_likp.
wa_likp-low = FS_FPR_DATA-field2.
collect wa_likp into ra_likp.
wa_likp-low = FS_FPR_DATA-field3.
collect wa_likp into ra_likp.
ENDLOOP.
select * from likp into table it_likp where vbeln in ra_likp.
It will get you the matching records
2009 Nov 12 9:02 AM
HI,
I have tried to use your suggestion here is my internal table
data: BEGIN OF t_vbeln occurs 10,
vbeln TYPE char30,
END OF t_vbeln.
<loop code >
select * from likp into table t_vbeln where vbeln in ra_likp.
Error is throwing as "The workarea T_VBELN is not long enough"
Regards
VEnk@
2009 Nov 12 9:05 AM
BASICS !!!!
instead of select * use select vbeln
and in your internal table
declare vbeln type likp-vbeln
2009 Nov 12 9:12 AM
Hi Venkat,
Obviously it will throw an error because when you say SELECT * it will fetch all the fields of table LIKP but you internal table is having only one field which is VBELN.
Thats why it says T_VBELN is not long enough to hold the records...
Hence select only VBELN as its the only field in your internal table T_VBELN.
Regards
Abhii...
Edited by: Abhii on Nov 12, 2009 10:12 AM
2009 Nov 12 9:21 AM
Issue is solved.
I really want to thank Vikrath, Keshu and Abhii for there guidance.
Regards
VEnk@