Skip to Content
avatar image
Former Member

insert into ZTAB

how i can insert into ztable.

i need to select data from standard table and insert into zTAB

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    Apr 20, 2006 at 12:01 PM

    Select * from std table into itab and then do a array insert using the insert command.

    INSERT ZTAB FROM ITAB.

    Cheers

    VJ

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 20, 2006 at 12:03 PM

    Use Modify statment

    select *

    from std table

    into corresponding fields of itab.

    modify ztab from table itab.

    REgards,

    Ravi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 20, 2006 at 12:04 PM

    HI Rani,

    select * into table itab1 from <table>.

    insert ztable from table itab1.

    regards

    satesh

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi Rani,

      Check it out with this ..

      <b>SELECT *

      FROM IT_TAB

      INTO TABLE ITAB.</b>

      <b>INSERT ZTAB FROM ITAB.</b>

      Regards,

      Santosh

  • avatar image
    Former Member
    Apr 20, 2006 at 12:05 PM

    Hi Rani,

    Create work area of ZTAB if one record

    insert into ztab form workarea

    create internal table if more than one record

    and insert records into it

    insert into ztab form table

    Eg.

    INSERT dbtab FROM TABLE itab ACCEPTING DUPLICATE KEYS

    (----


    ACCEPTING DUPLICATE KEYS ... this required for more than one record otherwise; dump if duplicate entries are present )

    if more than one record in the internal table .

    • itab should be of type ztab( table name)

    data itab type standard of ztab

    INSERT dbtab FROM wa

    if contains single record

    wa type ztab.

    -


    DATA select----


    u can directly select data into ZTAB INTERNAL TABLE provided the data type of the fields in the ztable is same as standard table .

    select f1 f2 f3 form st_table

    into ztab

    where ......

    order of the field selectED should match the order of the ztab filed otherwise DUMP.

    ..........If the data type are different that of standard table filed then select data in to temp_internal table ( data type should be specific )

    ........loop at the temp table and append into ztab with direct assign method to each field.

    then try to insert.

    Reagards

    Manoj

    Message was edited by: Manoj Gupta

    Message was edited by: Manoj Gupta

    Message was edited by: Manoj Gupta

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 20, 2006 at 12:08 PM

    Hi Rani,

    You can code something like this.

    SELECT * 
    FROM <STANDARD TABLE>
    INTO ITAB
    WHERE <CONDITION>.
    
    IF SY-SUBRC = 0.
      MODIFY ZTAB FROM TABLE ITAB.
    ENDIF.
    

    Hope this will help.

    Regards,

    Ferry Lianto

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 20, 2006 at 12:10 PM

    You can use either INSERT or MODIFY to add values to the Ztable. INSERT pushes a row into the table, so the update could fail if a duplicate record exists.

    MODIFY will check for existing records with the same primary keys, add a new row if no duplicates exist, and update the existing row if one already exists.

    Hope this helps.

    Sudha

    Add comment
    10|10000 characters needed characters exceeded