Application Development 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: 

moving data to an Internal table key field

Former Member
0 Kudos
77

Hi experts

I've a field wich is declared as a key, but when I assign value always is empty, how can I do to move key field value to another field?


DATA: BEGIN OF itab OCCURS 0,
  BEGIN OF ekkey,
    *ebeln LIKE eket-ebeln,*
    ebelp LIKE eket-ebelp,
  END OF ekkey,
  udate LIKE cdhdr-udate,
  utime LIKE cdhdr-utime,
  username LIKE cdhdr-username,
  user LIKE bapiaddr3-fullname,
END OF itab.

Assigning value

ITAB-EBELN   = IT_EKKO-EBELN.

Thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
55

try

ITAB-EKKEY-EBELN = IT_EKKO-EBELN.

6 REPLIES 6

Former Member
0 Kudos
56

try

ITAB-EKKEY-EBELN = IT_EKKO-EBELN.

0 Kudos
55

Nanda, thanks for answering

I've tried before but value showed in ALV is 50000007120000000, instead of 5000000712.

0 Kudos
55

mgg,

What said earlier by Nanda Kishore works.

DATA: BEGIN OF itab OCCURS 0,

BEGIN OF ekkey,

ebeln LIKE eket-ebeln,

ebelp LIKE eket-ebelp,

END OF ekkey,

udate LIKE cdhdr-udate,

utime LIKE cdhdr-utime,

username LIKE cdhdr-username,

user LIKE bapiaddr3-fullname,

END OF itab.

data : ws_eket type eket.

select single * from eket into ws_eket.

itab-ekkey-ebeln = ws_eket-ebeln.

write / : itab-ekkey-ebeln.

Pl. check.

0 Kudos
55

BOBBY thanks for answering, I agree that works but my problem is, when value is showed on ALV, you see 50000007120000000 instead of 5000000712. How can I do for not showing on ALV all zeros.

Regards.

former_member212653
Active Contributor
0 Kudos
55

DATA: BEGIN OF itab OCCURS 0,
  BEGIN OF ekkey,
    ebeln LIKE eket-ebeln,
    ebelp LIKE eket-ebelp,
  END OF ekkey,
  udate LIKE cdhdr-udate,
  utime LIKE cdhdr-utime,
  username LIKE cdhdr-username,
  user LIKE bapiaddr3-fullname,
END OF itab.

loop at it_ekko.
clear itab.
ITAB-EBELN   = IT_EKKO-EBELN.
append itab.
endloop.

loop at itab.
 write: /1 itab-ebeln.
endloop.

Former Member
0 Kudos
55

Thanks to all, It was solved following your suggestions

MOVE IT_EKKO-EBELN TO ITAB-EKKEY-EBELN.