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 needed

Former Member
0 Likes
490

Hi all

I have two fiedls it_hbank-hkont and it_skat1-txt50 and i want to pass them into one table am using the below piece of code but both the fields are npt getting passed into the one table.

LOOP AT it_skat1.

READ table it_skat1 WITH key saknr = it_sele-hkont.

LOOP at it_hbank.

READ TABLE it_hbank WITH KEY bukrs = p_bukrs.

it_sele-txt50 = it_skat1-txt50.

it_sele-hkont = it_hbank-hkont.

APPEND it_sele.

CLEAR it_sele.

endloop.

endloop.

Please make the necessary changes and get back to me..

With Regards

Vijay

3 REPLIES 3
Read only

Former Member
0 Likes
466

Hi,

The READ statements in your code seems wrong.

First one it_sele-hkont would be empty and it_skat1-txt50 would be empty. So change it accordingly. Second READ can be avoided too.

Use this code : Hopefully this works.

LOOP AT it_skat1 where SAKNR = p_saknr. ( use appropriate filter or leave it).

LOOP at it_hbank where bukrs = p_bukrs.

it_sele-txt50 = it_skat1-txt50.

it_sele-hkont = it_hbank-hkont.

APPEND it_sele.

CLEAR it_sele.

endloop.

endloop.

Cordially,

Shankar Narayanan.

Read only

Former Member
0 Likes
466

can u tell me fields in the tables,

it_skat1,

it_hbank with detialed structures . it mean structure of these tables.

Read only

Former Member
0 Likes
466

Try:

SORT it_hbank BY hkont.

LOOP AT it_skat1.
  READ TABLE it_hbank WITH KEY hkont = it_skat1-hkont
    BINARY SEARCH.
  it_sele-txt50 = it_skat1-txt50.
  it_sele-hkont = it_hbank-hkont.
  APPEND it_sele.
  CLEAR it_sele.
ENDLOOP.

rob