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

Problem with read table

Former Member
0 Likes
1,013

Hi guys,

I used READ TABLE statement...

I have the code below... does it need to for the key to have the same data type? i_reqitem2 has not header line... does it need to have header line? Thanks!

READ TABLE i_reqitem2 into x_reqitem2

WITH KEY material = x_eban-matnr

plant = x_eban-werks

unit = x_eban-meins

deliv_date = x_eban-lfdat

item_cat = x_eban-pstyp

quantity = x_eban-menge

fixed_vend = x_eban-flief.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,000

The fields you are testing with the KEY list should all be of the same data type and what you are comparing to.

9 REPLIES 9
Read only

Former Member
0 Likes
1,000

that is not compulsary for table i_reqitem2 to have header line

while it is necessary for the key to have the same data type

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Apr 23, 2008 9:48 AM

Read only

0 Likes
1,000

Hi,

What would be the alternative for READ TABLE if the key has not same data type? Thanks

Read only

0 Likes
1,000

There is no alternative but doing a type conversion of the fields having a different type

Read only

0 Likes
1,000

Hi

declare another internal table(itab2) with the same structure of the itab u r reading(itab1) except for the field which is not matching..... declare that field as the one which matches with taht of itab u loop at(itab3),......

now move all entries of this internal table itab1 to itab2 ( by looping at itab1 and moving field by field to itab2) and use itab2 for reading....!!!!

Regards

Vasu

Read only

0 Likes
1,000

HOw am i going to convert the type? Thanks!

Read only

0 Likes
1,000

In most cases, moving from one data type to another will do the conversion for you in ABAP

Read only

0 Likes
1,000

Hi,

How is it being done in abap? Thanks!

Read only

0 Likes
1,000

The compiler will take care of it in resolving the move.


DATA:
  fld1 TYPE p VALUE '1000',
  fld2(10) TYPE c.

fld2 = fld1.    " fld 2 will now contain 1000 right justified.

WRITE:/1 fld2.

Read only

Former Member
0 Likes
1,001

The fields you are testing with the KEY list should all be of the same data type and what you are comparing to.