Skip to Content

whats basic difference between data and types while declearing the itab

whats basic difference between data and types while declearing the internal tables...

DATA : BEGIN OF t_vbap OCCURS 0,

vbeln1 LIKE vbap-vbeln,

posnr LIKE vbap-posnr,

kwmeng LIKE vbap-kwmeng,

netpr LIKE vbap-netpr,

netwr LIKE vbap-netwr,

werks LIKE vbap-werks,

matnr LIKE vbap-matnr,

arktx LIKE vbap-arktx,

END OF t_vbap.

vs

TYPES : BEGIN OF t_vbap,

vbeln1 LIKE vbap-vbeln,

posnr LIKE vbap-posnr,

kwmeng LIKE vbap-kwmeng,

netpr LIKE vbap-netpr,

netwr LIKE vbap-netwr,

werks LIKE vbap-werks,

matnr LIKE vbap-matnr,

arktx LIKE vbap-arktx,

END OF t_vbap.

and vs

TYPES : BEGIN OF t_vbap,

vbeln1 LIKE vbeln,

posnr LIKE posnr,

kwmeng LIKE kwmeng,

netpr LIKE netpr,

netwr LIKE netwr,

werks LIKE werks,

matnr LIKE matnr,

arktx LIKE arktx,

END OF t_vbap.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 08, 2007 at 06:53 AM

    hi,

    like -> used for refering existing data elements in data dictionary or in sap

    type -> used for refering existing data types in sap.

    types: used for creating used defined structure of tables which has fields from more tahn one table.

    diff b/w types and type in creation of internal tables is that when u create a table with types then u can use same for work area creation also.

    ex:

    TYPES : BEGIN OF t_vbap,

    vbeln1 LIKE vbeln,

    posnr LIKE posnr,

    kwmeng LIKE kwmeng,

    netpr LIKE netpr,

    netwr LIKE netwr,

    werks LIKE werks,

    matnr LIKE matnr,

    arktx LIKE arktx,

    END OF t_vbap.

    data: itab1 type t_vbap

    wa_itab1 type t_vbap.

    when type is used then u have to create a defintion of work area for another time when internal table doesnt have headr line as

    ex:

    DATA : BEGIN OF t_vbap OCCURS 0,

    vbeln1 LIKE vbap-vbeln,

    posnr LIKE vbap-posnr,

    kwmeng LIKE vbap-kwmeng,

    netpr LIKE vbap-netpr,

    netwr LIKE vbap-netwr,

    werks LIKE vbap-werks,

    matnr LIKE vbap-matnr,

    arktx LIKE vbap-arktx,

    END OF t_vbap.

    DATA : BEGIN OF wa_vbap,

    vbeln1 LIKE vbap-vbeln,

    posnr LIKE vbap-posnr,

    kwmeng LIKE vbap-kwmeng,

    netpr LIKE vbap-netpr,

    netwr LIKE vbap-netwr,

    werks LIKE vbap-werks,

    matnr LIKE vbap-matnr,

    arktx LIKE vbap-arktx,

    END OF wa_vbap.

    if helpful reward soem points.

    with regards,

    suresh.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 08, 2007 at 06:18 AM

    Hi Amit,

    DATA : BEGIN OF t_vbap OCCURS 0,

    This will create an internal table

    whereas TYPES : BEGIN OF t_vbap

    This will create just a structure .

    Regards,

    Sree.

    PS: Reward points if Useful.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 08, 2007 at 06:19 AM

    Hi,

    1. TYPES statement defines the structure without allocation of memory, DATA statements allocate the memory at runtime.

    2. Create a structure by using types statement and refer it by using the DATA statement.

    3. In order to avoid the internal table declaration without header line, we are declaring a structure by types statemnet and declaring an internal table with reference to the structure.

    ***do reward if usefull

    vijay

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 08, 2007 at 06:40 AM

    use types and delcare structure.

    then declare internal table.

    ex-

    types: begin of ty_lfa1,

    kunnr like kna1-kunnr,'end of ty_kna1.

    data : i_kna1 type standard table of ty_kna1 with header line.

    regards

    Suresh.D

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.