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

Help with READ statement

Former Member
0 Likes
576

Hi,

In the work area Wa_index name= store storeno=3997 first 3 characters are not comming properly, it is comming as

field1 name = re 399 - this has to be 'store'

field2 storeno = 7 sup - this has to be '3997'

field3 name_2 = er center - this has to be 'super center'

First 3 characters of field2 is attaching at the end of field1 and so on. Please help me to solve this.

DESCRIBE TABLE itab_output LINES lv_cnt.

DO lv_cnt TIMES.

lv_index = sy-index.

READ LINE lv_index FIELD VALUE chk.

IF chk = 'X'.

READ TABLE itab_output INTO wa_index INDEX sy-index.

IF sy-subrc EQ 0.

wa_index-index = sy-index.

APPEND wa_index TO itab_output2.

CLEAR wa_index.

ENDIF.

ENDIF.

CLEAR chk.

ENDDO.

Thanks,

Veni.

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
555

Hi Veni

check the select statement which is populating itab_output.. the is a miss match in the order in the decleration of itab_output and order of field in the select statement..

or you can do a select f1 f2 f3

into corresponding fields of table itab_output

where....

but this will be a issue on performance...

5 REPLIES 5
Read only

former_member156446
Active Contributor
0 Likes
556

Hi Veni

check the select statement which is populating itab_output.. the is a miss match in the order in the decleration of itab_output and order of field in the select statement..

or you can do a select f1 f2 f3

into corresponding fields of table itab_output

where....

but this will be a issue on performance...

Read only

0 Likes
555

Hi Jay,

Itab_output is comming properly, I am getting the checked row information into itab_output2. Both table fields are same.

Thanks,

Veni.

TYPES: BEGIN OF ty_zoutput,

chk TYPE C,

name(17) TYPE C,

storeno(9) TYPE C,

name_2(35) TYPE C,

name_3 LIKE e1bpad1vl-name_3,

name_4(15) TYPE C,

city LIKE e1bpad1vl-city,

city_no LIKE e1bpad1vl-city_no,

postl_cod1 LIKE e1bpad1vl-postl_cod1,

transpzone LIKE e1bpad1vl-transpzone,

street LIKE e1bpad1vl-street,

str_suppl1 LIKE e1bpad1vl-str_suppl1,

country LIKE e1bpad1vl-country,

extens_1 LIKE e1bpad1vl-extens_1,

END OF ty_zoutput.

TYPES: BEGIN OF ty_zsindex,

index TYPE sy-index,

name(17) TYPE C,

storeno(9) TYPE C,

name_2(35) TYPE C,

name_3 LIKE e1bpad1vl-name_3,

name_4(15) TYPE C,

city LIKE e1bpad1vl-city,

city_no LIKE e1bpad1vl-city_no,

postl_cod1 LIKE e1bpad1vl-postl_cod1,

transpzone LIKE e1bpad1vl-transpzone,

street LIKE e1bpad1vl-street,

str_suppl1 LIKE e1bpad1vl-str_suppl1,

country LIKE e1bpad1vl-country,

extens_1 LIKE e1bpad1vl-extens_1,

END OF ty_zsindex.

DATA: BEGIN OF itab_e1bpad1vl.

INCLUDE STRUCTURE e1bpad1vl.

DATA: END OF itab_e1bpad1vl.

DATA: wa TYPE ty_zoutput,

wa2 TYPE ty_zoutput,

wa_index TYPE ty_zsindex,

itab_output TYPE TABLE OF ty_zoutput WITH HEADER LINE,

itab_output2 TYPE TABLE OF ty_zsindex WITH HEADER LINE.

at user-command.

case sy-ucomm.

when 'SELE'.

set pf-status 'NORM'.

LOOP AT itab_output INTO wa.

if wa-chk = 'X'.

wa-chk = ' '.

elseif wa-chk = ' '.

wa-chk = 'X'.

endif.

MODIFY itab_output FROM wa INDEX sy-tabix.

CLEAR wa.

ENDLOOP.

perform output.

when 'UPDATE'.

DESCRIBE TABLE itab_output LINES lv_cnt.

DO lv_cnt TIMES.

lv_index = sy-index.

READ LINE lv_index FIELD VALUE chk.

IF chk = 'X'.

READ TABLE itab_output INTO wa_index INDEX sy-index.

IF sy-subrc EQ 0.

wa_index-index = sy-index.

APPEND wa_index TO itab_output2.

CLEAR wa_index.

ENDIF.

ENDIF.

CLEAR chk.

ENDDO.

Read only

0 Likes
555

Hi Veni

As per your code, both internal tables are not same.

First field in first internal table is of data type char and length 1, whereas your second internal table the first field is Index and both differ in lengths.

So when moving data, move data explicitly or with addition corresponding from one work area to another.

Regards

Eswar

Read only

0 Likes
555

Thank you Jay and Eswar.

I changed CHK and INDEX to the end and it worked, now I have itab_output and itab_output2 has same values.

Regards,

Veni.

Read only

0 Likes
555

Thank you.