Skip to Content
author's profile photo Former Member
Former Member

How to declare an itab - the 'proper' way???

Howdy,

I think there is a newer and better way of declaring internal tables...

currently i use:

*Table for credit notes created

DATA: BEGIN OF output_itab OCCURS 0,

vbeln TYPE vbak-vbeln,

END OF output_itab.

How should this be written????

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 07, 2005 at 02:25 PM

    Here is the standard that I use:

    Define my structure in the dictionary - Z_MY_STRUCTURE.

    DATA: t_my_table  TYPE STANDARD TABLE OF z_my_structure,
          wa_my_table LIKE LINE OF t_my_table.

    Optionally, define a table type in the dictionary that uses your new structure - Z_T_MY_STRUCTURE.

    DATA: t_my_table  TYPE z_t_my_structure,
          wa_my_table LIKE LINE OF t_my_table.

    I rarely define structures in my program. First of all, I cannot predict how I will need to share the definition, and secondly, we paid big bucks to get a dictionary, so use it.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 07, 2005 at 11:02 AM

    Not sure what do you mean by proper way, but in <b>ABAP OO context</b>, <b>the way to declare internal tables is without header line</b>.

    types: begin of ty_vbeln,
             vbeln type vbak-vbeln,
           end of ty_vbeln.
    
    data: output_itab type table of ty_vbeln. "Internal Table
    data: wa_itab type ty_vbeln.              "Workarea

    Regards,

    Subramanian V.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 07, 2005 at 11:06 AM

    Version one, when you define type:

        TYPES: BEGIN OF ty_s_vbeln,
                  vbeln TYPE vbak-vbeln,
               END OF ty_s_vbeln.
    ..
    DATA: lwa_vbeln type ty_s_vbeln,
    lit_vbeln type table of ty_s_vbeln.
    

    Or you skip the type part..it depends on your needs:

    DATA: lwa_vbeln type vbak-vbeln,
    lit_vbeln type table of vbak-vbeln.
    

    Peter

    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.