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: 

adding multiple records at the end of the internal table

Former Member
0 Kudos
1,686

HI EXPERTS I AM NEW TO SAP .I AM SUBBAREDDY can u please suggest me how can i add multiple records to at the end of the internal table..

TYPES : BEGIN OF Ty_t001,

        Bukrs TYPE bukrs,"company code

        butxt TYPE butxt,"company name

        ort01 type ort01, " city

        land1 TYPE land1,"country key

     end OF ty_t001.

  "TYPES ty_t_t001 TYPE TABLE OF ty_t001.

  DATA : it_t001 TYPE TABLE OF ty_t001,

         wa_t001 TYPE ty_t001.

  PARAMETERS  : p_land1 TYPE land1_gp.

  SELECT bukrs butxt ort01 land1 FROM t001 into  TABLE it_t001 UP TO 10 rows

         where land1 = p_land1.

    sort it_t001 aSCENDING by land1.

    write :/'display company codes '  COLOR 1.

             uline.

      CLEAR wa_t001.

      wa_t001-bukrs = 'e001'.

      wa_t001-butxt = 'emax tech'.

      wa_t001-ort01 = 'hyderabad'.

      wa_t001-land1 = 'we'.

      APPEND wa_t001 to it_t001.

         

           

    loop at it_t001 INTO wa_t001.

      WRITE : / sy-tabix,wa_t001-bukrs,wa_t001-butxt,wa_t001-ort01,wa_t001-land1.

IN THIS PROGRAM I ADDED ON;Y 1RECORD.

2 REPLIES 2

Former Member
0 Kudos
291

Hi Subba,

Welcome to ABAP.

There are a few ways you can do this.

1) Within a LOOP ... ENDLOOP. You simply set the fields of your work area which matches the line type of the internal table and then use the APPEND statement to append it at the end of the table

2) If you have table A which has the same line type as table B you can append table A to B by using the statement APPEND LINES OF

0 Kudos
291

hi tank u nick.