DIFF: Field string ,Structure and Internal table declaration

Hai,
       what is the diference between  Field string ,Structure in ABAP program and Internal table declaration and how it will work ?
Thank you
ASHOK KUMAR.

hi,
Look this u will get a good idea.
*& Report  ZTYPES                                                      *
REPORT  ZTYPES                                                  .
* Table declaration (old method)
DATA: BEGIN OF tab_ekpo OCCURS 0,             "itab with header line
  ebeln TYPE ekpo-ebeln,
  ebelp TYPE ekpo-ebelp,
END OF tab_ekpo.
*Table declaration (new method)     "USE THIS WAY!!!
TYPES: BEGIN OF t_ekpo,
  ebeln TYPE ekpo-ebeln,
  ebelp TYPE ekpo-ebelp,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,      "itab
      wa_ekpo TYPE t_ekpo.                    "work area (header line)
* Build internal table and work area from existing internal table
DATA: it_datatab LIKE tab_ekpo OCCURS 0,      "old method
      wa_datatab LIKE LINE OF tab_ekpo.
* Build internal table and work area from existing internal table,
* adding additional fields
TYPES: BEGIN OF t_repdata.
        INCLUDE STRUCTURE tab_ekpo.  "could include EKKO table itself!!
TYPES: bukrs  TYPE ekpo-werks,
       bstyp  TYPE ekpo-bukrs.
TYPES: END OF t_repdata.
DATA: it_repdata TYPE STANDARD TABLE OF t_repdata INITIAL SIZE 0,   "itab
      wa_repdata TYPE t_repdata.                 "work area (header line)
Regards
Reshma

Similar Messages

  • Dynamic Structures and Internal Tables

    Hi All,
    I am doing a report to create condition records based on the condition type and condition table. Assume the condition type as PR00 and it as condition table of 304,305,306.Each condition table as its own header and item fields.Based on the  condition table that the user specifies in the selection screen
    the header and item structures of my report should change dynamically and these should be moved  to the dynamic internal table that contains both header and item fields.Can anyone give an idea how to achieve it. Thanks in advance.
    Regards,
    Chakradhar.

    Hi All,
    Thanks for your replies.
    SPLIT i_string_line-input_str AT cl_abap_char_utilities=>horizontal_tab
    INTO i_header_line-header
              i_header_line-vkorg
              i_header_line-vtweg                                                                              
              i_header_line-pltyp                                                                              
             i_header_line-waerk.    
    In the above syntax based on the condition table I selected on selection screen my flat file is as below.
    case 1: If condition table given is 304
    H    SalesOrganization    DistributionChannel    Customer
    I    Material    Releasestatus    Amount    Currency    ValidFrom    ValidTo
    case 2: If condition table given is 305
    H    SalesOrganization    DistributionChannel
    I    Material    Releasestatus    Amount    Currency    ValidFrom    ValidTo
    case 3: If condition table given is 306
    H    SalesOrganization    DistributionChannel     PriceListType     DocumentCurrency
    I    Material    Releasestatus    Amount    Currency    ValidFrom    ValidTo
    In the above code i_string_line-input_str contains the following heading of fields based on the condition table we select in selection screen.when I want to split them into respective fields
    using INTO clause my structure should change dynamically.How can I achieve it and my entire program is in OOPS ALV.Thanks in Advance.
    Regards,
    Chakradhar.

  • Structure and internal table

    is it possible to made a report by using internal talbe and structure....if yes how and if u have sample code for that pls tell me....
    raju

    Hi Raju,
    Yes. It is possible. But it depends upon your requirement. Please check the transaction ABAPDOCU for examples.
    Here are some examples
    http://www.sapgenie.com/abap/code/chap1201.txt
    http://www.sapgenie.com/abap/code/chap0103.txt
    http://www.sapgenie.com/abap/code/chap0407.txt
    http://www.sapgenie.com/abap/code/chap1112.txt
    There are many examples here.
    http://www.sapgenie.com/abap/example_code.htm
    Cheers
    Vinod
    Message was edited by: Vinod C

  • Internal table declaration - work area and body

    Hi all
    I have declared my internal table in my program as
    data : itab_wa type ZRESULT_LINE,
           itab    type ZRESULT_ROW.
    Where ZRESULT_LINE and ZRESULT_ROW are the structure and table types.
    Now I want to add
    data: TCOLOR TYPE SLIS_T_SPECIALCOL_ALV.
    in my internal table declaration. How can I do this. Please remember I need to have work area and body in my internal table as I have used work area and body in my code.
    Waiting..............
    Message was edited by: Raju Boda

    HI,
    See the Declarion types of workarea and Internal tables
    * Table declaration (old method)
    DATA: BEGIN OF tab_ekpo OCCURS 0,             "itab with header line
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
    END OF tab_ekpo.
    *Table declaration (new method)     "USE THIS WAY!!!
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,      "itab
          wa_ekpo TYPE t_ekpo.                    "work area (header line)
    * Build internal table and work area from existing internal table
    DATA: it_datatab LIKE tab_ekpo OCCURS 0,      "old method
          wa_datatab LIKE LINE OF tab_ekpo.
    * Build internal table and work area from existing internal table,
    * adding additional fields
    TYPES: BEGIN OF t_repdata.
            INCLUDE STRUCTURE tab_ekpo.  "could include EKKO table itself!!
    TYPES: bukrs  TYPE ekpo-werks,
           bstyp  TYPE ekpo-bukrs.
    TYPES: END OF t_repdata.
    DATA: it_repdata TYPE STANDARD TABLE OF t_repdata INITIAL SIZE 0,   "itab
          wa_repdata TYPE t_repdata.                 "work area (header line
    you need to maintain same structure for both workarea as well Internal table
    Regards
    Sudheer

  • Difference between the Field Group  and Internal Table.

    Hi all,
    Can anybody tell me the difference between the Field group and Internal table and when they will used?
    Thanks,
    Sriram.

    Hi
    Internal Tables: They are used to store record type data in tabular form temporarily in ABAP programming. Or we can say, it stores multiple lines of records for temporary use in ABAP programming.
    A field group is a user-defined grouping of characteristics and basic key figures from the EC-EIS or EC-BP field catalog.
    Use
    The field catalog contains the fields that are used in the aspects. As the number of fields grows, the field catalog becomes very large and unclear. To simplify maintenance of the aspects, you can group fields in a field group. You can group the fields as you wish, for example, by subject area or responsibility area. A field may be included in several field groups.
    When maintaining the data structure of an aspect, you can select the field group that contains the relevant characteristics and basic key figures. This way you limit the number of fields offered.
    Regards
    Ashish

  • Delete and internal table with not eqaul to fields

    Hi I have an internal table I want delete few records with fields not equal to the variable v_lifnr, v_name1 and v_city,
    structure of internal table has fields LIFNR, NAME1, CITY, TEXT1 and TEXT2.
    I dont want to go by deletin in loop.

    Hi ,
    i want to delete a internal table record based on the values which are NOT in the ranges ..
    I am facing a syntax error with not operation in some system s
    code looks like below !
    i am not facing this problem when there in  no not in ranges.
    Thanks .
    RANGES: RA_FFIDS FOR /VIRSA/ZFFUSERS-ZVIRFFID.
    data : BEGIN OF IZVIRFFTRANSLOG OCCURS 0.
            INCLUDE STRUCTURE /VIRSA/ZFFTNSLOG.
    DATA:   DESC LIKE RS38M-REPTI,
          END OF IZVIRFFTRANSLOG.
    data : IT_ZFlight_T LIKE IZVIRFFTRANSLOG OCCURS 0 WITH HEADER LINE.
    IF NOT IT_ZFlight_T_TCODE[] IS INITIAL.
        DELETE IT_ZFlight_T_TCODE WHERE ZVIRFFID NOT IN RA_FFIDS.
       DELETE IT_ZFlight_T WHERE ZVIRFFID NOT IN RA_FFIDS.
    ENDIF.

  • String and Internal table

    We have a large character string in the memory, e.g. of 5M.
    (1) we want to split the character string into an internal table with a field of c(1000), for example.
    (2) we want to read the internal table, and concatenate each line into one string.
    For STRLEN and CONCATENATE, it always ignores the trailing blanks. However, we don't want to LOSE ANY BLANKS.
    thanks,
    -Stanley

    I don't think there is any availble function module that does it. You may have to code for it. Also the blanks are a problem. So try something like this, which was actually suggested by Sanjay while responding to another question in this forum
    First replace all the blank space with a character that you know for sure, will not be there in your string.
    TRANSLATE mystring USING ' @'.
    Now do your STRLEN and get your string length.
    The you can split your string using the option INTO TABLE. Your itab will have only one field of 1000 length.
    Then read the internal table and concatenate them back into the long string.
    Finally, you reverse the pattern in the previous TRANSLATE statement to '@ '.
    Srinivas

  • Field-symbols and internal table

    Hello,
    How do I declare a field-symbol as an intenal table?
    I have a internal table declared, but i need to declare a field symbols as my internal table´s type. How do I do it?
    What I wrote was this:
    DATA: BEGIN OF IT_INTE OCCURS 0,
               FIELD(3) TYPE C,
           END OF IT_INTE.
    FIELD-SYMBOLS:  isn´t defined as an internal table, how do I fix it.
    Thanks!!!
    Gabriel.

    It is very much possible to have a field symbol point to a internal table.  Here is some sample code.
    report  zrich_0001.
    data: begin of itab1 occurs 0,
          fld1(10) type c,
          fld3(10) type c,
          fld5(10) type c,
          end of itab1.
    data: wa1 like line of itab1.
    field-symbols: <fs_table> type table.
    field-symbols: <fs_wa>.
    field-SYMBOLS: <fs_field>.
    * Setup the data
    itab1-fld1 = '0000000001'.
    itab1-fld3 = '0000000002'.
    itab1-fld5 = '0000000003'.
    append itab1.
    itab1-fld1 = '0000000004'.
    itab1-fld3 = '0000000005'.
    itab1-fld5 = '0000000006'.
    append itab1.
    assign itab1[] to <fs_table>.
    assign wa1     to <fs_wa>.
    loop at <fs_table> into <fs_wa>.
    * Write out each field of the line
      do.
           assign COMPONENT sy-index of structure <fs_wa> to <fs_field>.
        if sy-subrc <> 0.
          exit.
          endif.
          write:/ <fs_field>.
      enddo.
      skip 2.
    endloop.
    Regards,
    Rich Heilman

  • Passing SELECT-OPTIONS and Internal Tables to SUBROUTINES

    Hi Guys
    In the code below my colleague has created her own table types in order to pass a select option and internal tables to her subroutine. Is there an easier way of making them known to the subroutine.
    data : v_vbeln type vbeln_vf,
          it_bdoc type table of vbrp,
          it_t006 type table of t006a,
          wa_bdoc type vbrp,
          wa_t006 type t006a,
          it_bdoc2 type table of zsswathi_st_vbeln,
          wa_bdoc2 type zsswathi_st_vbeln
    select-options s_vbeln for v_vbeln matchcode object zswathi_vbeln obligatory.
    start-of-selection.
    perform bdoc using s_vbeln[]
                 changing it_bdoc
                          it_bdoc2
                          it_t006.
      loop at it_bdoc2 into wa_bdoc2.
    form bdoc using f_s_vbeln type ZSWATHI_ST_SELECT_OPTION_TA_TY       " all these are table types. for select options, a structure is created and then a table type for it is created.
            changing f_it_bdoc type zswathi_vbrp_ty_ta
                     f_it_bdoc2 type zswathi_vbeln_ty_ta
                      f_it_t006 type ZSWATHI_T006_TA_TY.
    select * from vbrp into table f_it_bdoc where vbeln in f_s_vbeln.
          if f_it_bdoc is not initial.
          select  vbeln sum( netwr ) prsdt from vbrp into table f_it_bdoc2 where vbeln in f_s_vbeln group by vbeln prsdt.
          sort f_it_bdoc2 by vbeln.
          "select * from t006a into table it_t006 for all entries in it_bdoc where msehi = it_bdoc-vrkme.
          select * from t006a into table f_it_t006 for all entries in f_it_bdoc where msehi = f_it_bdoc-vrkme.
       endif.
        endform.

    Hi Brett,
    1. you can use a select-options-range in a FORM subroutine also without passing it as a parameter because parameters and select-option range tables are global fields in their program.
    2. If you need a parameter, declare it as type table or type standard table or type any table. You do not need any special table type.
    Regards
    Clemens

  • How to get the field name of an internal table during runtime?

    How to get the field name of an internal table during runtime?

    Hi  Sudhir,
    Declare and Use Get Cursor Field in Your Prm to get the field Name of the Intenal Table
    Example Code:
        <b>  DATA: v_field(60).                        " Insert this code.
         GET CURSOR FIELD v_field.        " Insert this code.</b>
         <b>CHECK v_field = 'ITAB-KUNNR'.    " Insert this code. (or)
    Write: v_field.</b>
    Regards,
    Ramganesan K.

  • How to add one more field to an exist internal table

    hi abapers
    i am a very new abap programmer and just started learning it.
    i want to know How to add one more field to an exist internal table.
    lemme me put my question in a very simple way.
    i have a internal table having fields f1,f2,f3 and which also that internal also contains some data.
    now i want to add two more fields (mm & nn) to that internal table now.
    how can i do that.
    and i wanna know the websites names where i can find some brain teasing questions in abap programming.
    eagerly waiting for ur reply
    regards,
    Maqsood A Khan

    Hi, MAQSOOD.
    You can insert more fields in your internal table like this.
    refer this code snippet.
    DATA : BEGIN OF tbl_itab OCCURS 0.
            INCLUDE STRUCTURE zsdtc009.
    DATA :  vkorg   LIKE vbak-vkorg,  "inserted one
            vtweg   LIKE vbak-vtweg,  "inserted one
            vkbur   LIKE vbak-vkbur,  "inserted one
            vkgrp   LIKE vbak-vkgrp,  "inserted one
           END OF tbl_itab.
    you can also read the book "Teach yourself abap in 21 days"
    at http://cma.zdnet.com/book/abap/
    but that book is just about basic concept of abap and report program.
    it doesn't give a lecture for on-line program.
    you can get pdf version books(about abap, sap...things) from sap.
    http://help.sap.com/printdocu/core/Print46c/en/Data/htm/english.htm
    I wish I could help you.
    Regards
    Kyung Woo.

  • Difference between line type and internal table?

    Hi..
    I wanted to know, what is the difference between Line type and Internal Table?

    Hi,
        Before the 4.7 release in SAP if we want to define an internal table we have to write the defination using the occurs statement and we need to define all the fields using INCLUDE STRUCTURE or indidually all the fields ine by one.
    From 4.7 release of R/3 SAP introduced the Line type concept and it's part of the ABAP OOPS concept. for internal table defination we don't need to use the occur statements. Instead INCLUDE structure  we need to create a Line type for that structure in Se11 and then we can define the internal table like :
    DATA : ITAB TYPE TABLE OF <LINE_TYPE>.
    Only thing is this table will be  a table without header. So for internal table processing we need to define a work area structure of type line of line type  . EX:
    DATA: WA_ITAB TYPE LINE OF <LINE_TYPE>.
    Hope this helps.
    Thanks,
    Greetson

  • Table types and internal table

    Hi all,
    What is the relationship between table type in ABAP dictionary and internal table?
    Moderator message : Search for available information OR read ABAP documentation. Thread locked.
    Edited by: Vinod Kumar on Jul 16, 2011 11:16 AM

    You can INCLUDE TYPE.
    Types: begin of itab,
           field1 type string,
           field2 type string,
    *      More Fields in here.
           Field30 type string,
           End of itab.
    Data: lt_itab type table of itab.
    TYPES BEGIN OF new_itab.
           INCLUDE type itab.
    TYPES: field31 type string,
           field32 type string,
    END OF new_itab.
    Regards,
    Rich Heilman

  • String operations in internal table

    Dear friends..
            Good morning.
                        I wish to know.. how i segregate the field from a database table to internal table into two different internal table field. say for example.
    i have db table tab1 which has field number
    tab1 -> number
    and i have another internal table itab1 whic has two fields numa and numb
    tab1 -> numa
         -> numb
    i have value in tab1->number is 001 and 0001
    i wish to segregate this two values in to internal table
    if the value is 001 then it should be into 001 -> numa
    if the value is 0001 then it should be into 0001-> numb
    i dont know how to perform the string operations in internal table.. would you like to tell me how i fix this problem any suggetion, article, code will be great help of mine..
    thanking you
    Regards
    Naim

    Hi,
      what u can do is check the lenth
    lit_data_tab.
    lit_data_3
    lit_data_4.
    lv_char3 type char3.
    lv_char4 type char4.
    lv_length type i.
    loop at lit_data_tab.
    lv_length = STRLEN ( lit_data_tab-value ).
    if lv_length = 3.
       lv_char3 = lit_data_tab-value .
       append lv_char3 to lv_char3 type char3.
    else.
       lv_char4 = lit_data_tab-value .
       append lv_char4 to lv_char3 type char4.
    endif.
    endloop.
    if u want
    numa  numb
    003   0003.
    then u have to loop in one table and modify other.
    that is any one table should contains both the field.
    read the table with one field
    mark helpfull answers
    Regards
    Message was edited by: Manoj Gupta

  • Data from field symbol into an internal table or workarea

    Hi Experts,
    I have field symbol in which i get the data. I want to get this data into an internal table of type any or into an work area. How is this possible.
    My declaration for field symbol is as follow:
    FIELD-SYMBOLS: <l_t_data> TYPE any.
    DATA l_r_data TYPE REF TO data.
        CREATE DATA l_r_data type STANDARD TABLE OF (l_local_tab).
        ASSIGN l_r_data->* TO <l_t_data>.
    I get the data in this field symbol <l_t_data>. by passing into a funtion module. and I get the data into it. Now i have to assign the values of this field symbol to any internal table or to a work are how do i do it. Please help.
    Regards,
    Prashant.

    Not exactly sure what you need here, but.....
    FIELD-SYMBOLS: <l_t_data> TYPE TABLE.   "<<-- Change this
    FIELD-SYMBOLS: <l_s_data> TYPE ANY.      "<<---Add This
    DATA l_r_data TYPE REF TO data.
    CREATE DATA l_r_data type STANDARD TABLE OF (l_local_tab).
    ASSIGN l_r_data->* TO <l_t_data>.
    Loop at <l_t_data> assigning <l_s_data>.
    * Do what ever using <l_s_data>
    Endloop.
    Regards,
    Rich Heilman
    Edited by: Rich Heilman on Feb 28, 2008 2:42 PM

Maybe you are looking for

  • Disable internal modem

    Got an iMac 333 with a defective internal modem. Am now using an external modem but needed to upgrade OS from 8.6 to 9.2. Upgrade went fine and the modem worked. My friend called me and now has the same problem...the OS wants to dial-out using the ol

  • My Mac book pro battery drops with every percentage after fully charged?

    My mac book hardly runs for 2 hours after fully charged. What should I do?

  • How to turn off phone?

    is there another way to turn off the phone besides holding down the lock button at the top? for some reason that button stopped working.

  • Upgrade 10.2 to 11.2 manualy using cold backup copy on new server.

    Hi, I am going to manually upgrade my databases to 11.2 from 10.2. I will use cold backup of 10.2 and copy in to the new server Red Hat Linux 5. I got a Note (742108.1) done for upto 10.2.0.5 and it tells to set orapwd file=$oracle_HOME/dbs/orapw<SID

  • File to IDOC With Screenshots

    Hi, I am doing FIle to IDOC scenario but have got stuck in ID part what to take care in Receiver COmmunication Channel and Receiver determinaiton etc and donot know how to test after finishing ID part. ALso we need to put xml file as input in directo