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

Adding data to internal table

Former Member
0 Likes
856

Hello ppl,

Can anyone tell me how to add data to internal table.

I created a work area. added values to the work area. Then appended to internal table.But it did not work.

Can someone give me the code extract ?

Thanks in advance,

Chithra.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
828

chk following code...

data : ls_vbak like VBAK,

lt_vbak type table of vbak.

clear ls_vbak.

ls_vbak-vbeln = '1234'.

ls_vbak-mandt = sy-mandt.

append ls_vbak to lt_vbak.

6 REPLIES 6
Read only

Former Member
0 Likes
828

Hi,

After appending the data to the internal table clear the work area.Also,check whether u have that internal table already filled.If it is already filled then use 'MODIFY' statement

Read only

Former Member
0 Likes
828

hi,

do this way ...


data : wa_mara like mara,
          it_mara like mara occurs 0 with header line.

 wa_mara-matnr = '00000000001'.
 
 it_mara = wa_mara.
 append it_mara.
 clear   it_mara.

Read only

Former Member
0 Likes
829

chk following code...

data : ls_vbak like VBAK,

lt_vbak type table of vbak.

clear ls_vbak.

ls_vbak-vbeln = '1234'.

ls_vbak-mandt = sy-mandt.

append ls_vbak to lt_vbak.

Read only

Former Member
0 Likes
828

Hi,

Can you plz post your code here? Then I let you know whats the error.

Regards,

Raghu

Read only

Former Member
0 Likes
828

Hi,

After appending the data to work area ,

use

appned work area to internal table.

Ex:

data : wa_vbak like vbak,

it_vbak like vbak occurs 0 with header line.

wa_vbak-vbeln = '00000000001'.

it_vbak = wa_vbak.

append it_vbak.

clear it_vbak.

Pls. reward for useful answers.

Read only

Former Member
0 Likes
828

Hi

this is sample code..check this...

parameter p_x type i. "no of records

types : begin of st_knc1,

kunnr type knc1-kunnr, "Customer Number

bukrs type knc1-bukrs, "Company Code

um01u type knc1-um01u, "Sales In Posting Period

end of st_knc1.

data : it_knc1 type standard table of st_knc1,

wa_knc1 type st_knc1 .

start-of-selection.

clear it_knc1[].

if p_x is not initial.

select kunnr bukrs um01u

from knc1

into table it_knc1

up to p_x rows.

wa_knc1-kunnr = 1111.

wa_knc1-bukrs = 1200.

wa_knc1-um01u = '1000.50'.

append wa_knc1 to it_knc1.

write:/ text-004.

loop at it_knc1 into wa_knc1 .

write:/ wa_knc1-kunnr, wa_knc1-bukrs,wa_knc1-um01u currency 'INR'.

endloop.