Online Tutorials & Training Materials | STechies.com
Register Login
Advertisement

Insert Internal Table Records into Database Table

|| || 3

Insert Internal Table Records into Database Table
Stechies

Hello SAP Experts,

I can select records from mara using select statement (ernam and matnr),  I want to insert these rec to my table ( ie I created using se11----that contain only 2 fields  =matnr and ernam ).

please help


Comments

  • 11 Mar 2016 10:21 am Best Answer

    insert ztable from table itab.

    ztable = table name

    itab = internal table

    --------- --------- --------- --------- --------- --------- --------- --------- --------- --------- 

    INSERT ZTABLE from TABLE itab ACCEPTING DUPLICATE KEYS.

    IF sy-subrc = 0.

    MESSAGE 'Records Save into Database table' TYPE 'S'.

    ENDIF.

    --------- --------- --------- --------- --------- --------- --------- --------- --------- --------- 

    Working with Internal Table

    --------- --------- --------- --------- --------- --------- --------- --------- --------- --------- 

    ZINTERNAL_INSERT

    REPORT ZINTERNAL_INSERT.

    TYPE: BEGIN OF TY_STUD,

    SID TYPE I,

    SNAME(10) TYPE C,

    SMARKS TYPE I,

    END OF TY_STUD.

     

    DATA: IT_STUD TYPE TABLE OF TY_STUD,

    WA_STUD TYPE TY_STUD,

    WA_STUD-SID=1.

    WA_STUD-NAME='ABCD'.

    WA_STUD-MARKS=54.

    INSERT WA_STUD INTO TABLE IT_STUD.

     

    STUD-SID=2.

    WA_STUD-NAME='XYZ'.

    WA_STUD-MARKS=44.

    INSERT WA_STUD INTO TABLE IT_STUD.

     

    STUD-SID=3.

    WA_STUD-NAME='DFDFS'.

    WA_STUD-MARKS=33.

    INSERT WA_STUD INTO TABLE IT_STUD.

     

    STUD-SID=4.

    WA_STUD-NAME='RAMM'.

    WA_STUD-MARKS=78.

    INSERT WA_STUD INTO TABLE IT_STUD INDEX 3.

     

    LOOP ATIT_STUD IN_STUD INTO WA_STUD.

    WRITE: /WA_STUD-SID, WA_STUD-SNAME, WA_STUD-SMARKS.

    ENDLOOP.

    --------- --------- --------- --------- --------- --------- --------- --------- --------- --------- 


     

  • 13 Jul 2009 8:01 am Helpful Answer
    Try using "insert dbtab from itab."
    or update target from source.


    Abhinandan Kumar
  • 23 Sep 2016 12:46 pm

    insert main_table from it_taable.

    modify target from source 


Advertisement
Advertisement