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

Validating LIKP records

Former Member
0 Likes
1,617

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@

1 ACCEPTED SOLUTION
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,540

use for all entries in TY_VBELN on LIKP tables for VBELN.

10 REPLIES 10
Read only

Former Member
0 Likes
1,540

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

Read only

0 Likes
1,540

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@

Read only

0 Likes
1,540

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

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,541

use for all entries in TY_VBELN on LIKP tables for VBELN.

Read only

Former Member
0 Likes
1,540

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....

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,540

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

Read only

0 Likes
1,540

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@

Read only

0 Likes
1,540

BASICS !!!!

instead of select * use select vbeln

and in your internal table

declare vbeln type likp-vbeln

Read only

0 Likes
1,540

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

Read only

Former Member
0 Likes
1,540

Issue is solved.

I really want to thank Vikrath, Keshu and Abhii for there guidance.

Regards

VEnk@