Skip to Content
avatar image
Former Member

inserting standard table data using ztable

Hi all,

I have an issue like i have created "ztable" where i am taking few of the mara table fields.

but my problem is i m not getting data into these fields , so can anyone tell me wht shuld be done to get the data into my ztable which will contain all these fields.

<code>

tables : mara.

data : begin of itab occurs 0,

matnr like mara-matnr,

ersda like mara-ersda,

ernam like mara-ernam,

vpsta like mara-vpsta,

mtart like mara-mtart,

mbrsh like mara-mbrsh,

matkl like mara-matkl,

meins like mara-meins,

end of itab.

data : wa like line of itab.

select matnr ersda ernam vpsta mtart mbrsh matkl meins from mara into corresponding fields of table itab .

  • what should be done , shuld i use INSERT INTO "ZTABLE FROM ITAB.

PLZZ SUGGEST.

Thanks,

karan

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Oct 09, 2007 at 01:38 PM

    hi Karan,

    the selection like:

    select matnr ersda ernam vpsta mtart mbrsh matkl meins

    from mara

    into table itab .

    the insert like:

    INSERT ztable FROM table itab.

    hope this helps

    ec

    Add comment
    10|10000 characters needed characters exceeded

    • pls check if there are the same fields in the internal table declaration, like in the select statement (and in the same order), the select has to look like:

      SELECT ...

      FROM mara

      <b>INTO TABLE</b> itab

      it has to work.

      ec

  • avatar image
    Former Member
    Oct 09, 2007 at 01:39 PM

    any help frnds.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 09, 2007 at 01:48 PM

    Hi karan,

    i have done this:

    TABLES : MARA.

    *

    DATA : BEGIN OF ITAB OCCURS 0,

    MATNR LIKE MARA-MATNR,

    ERSDA LIKE MARA-ERSDA,

    ERNAM LIKE MARA-ERNAM,

    VPSTA LIKE MARA-VPSTA,

    MTART LIKE MARA-MTART,

    MBRSH LIKE MARA-MBRSH,

    MATKL LIKE MARA-MATKL,

    MEINS LIKE MARA-MEINS,

    END OF ITAB.

    DATA : WA LIKE LINE OF ITAB.

    SELECT MATNR ERSDA ERNAM VPSTA MTART MBRSH MATKL MEINS FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB UP TO 100 ROWS.

    *

    BREAK-POINT.

    it works ok.

    Try it.

    Regards, Dieter

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Karan,

      Have you tried to use the SAP ABAP help to understand all this? There you will fnid examples for reading and updating database tables. Or you could search these forums - this sort of question has been asked countless times before.

      Gareth

  • avatar image
    Former Member
    Oct 09, 2007 at 01:53 PM

    Hi Karan,

    After the <b>SELECT</b> stmt. you need to pass the values retrieved from DB tables into <b> ITAB</b> to a <b>new WA</b> using

    <b>LOOP AT ITAB INTO WA.</b>

    Wherein , in that loop move the fields retrieved from itab to the new WA, and later append this WA to ITAB(New One). Outside the loop, you can use the <b>INSERT</b> keyword as used by you in the given code.

    Hope this resolves your query.

    Regards

    Nagaraj

    Add comment
    10|10000 characters needed characters exceeded