Accessing Global Internal Table in Field Routine Level

I am working on a transformation. I have created a Global Internal Table with the structure of my Source Target + extra fields not in my source target. In the start routine of the transformation I am first copying all corresponding fields from SOURCE_PACKAGE to internal table and then finally doing a lot of manipulations and modifying and appending the internal table with data now ready for populating to target.
I want to populate the target fields at field routine level by  the data present in the Global internal table. Can you please tell me how to code here. If data was being read by SOURCE_PACKAGE, I would have read the value of SOURCE_FIELDS - (Value). But incase of value to be read from Global Internal Table, can I refer to the internal table work area directly. Thanks.
Global Internal Table - G_ITAB
Work Area - WA_G_ITAB
Is the below correct ?
Result = WA_G_ITAB-(Field Name).

Let me understand this with an example as I am still not clear. Suppose I am loading to a DSO having 17 Key Fields say K1, K2, K3.........K17.
And if the 3.5x logic is
DATA : L1 LIKE COMM_STRUCTURE-amt.
  CLEAR L1 .
  IF COMM_STRUCTURE-CHK = '222'
   OR COMM_STRUCTURE-CHK = '333' .
    L1 = COMM_STRUCTURE-amt .
  ENDIF.
  RESULT = L1 .
Can you tell me the code of the above in BI7 at field level routine now. Please note I need to take data from G_ITAB internal table and that the DSO has 17 key fields?

Similar Messages

  • Internal table on Start Routine

    Hello
    I have 5 key figures. They have an standard routine with a select statement. Basically they have to read an external DSO and get some fields values.
    As all of them have the same SELECT statement I think it would be better to replace this with a select in the Start Routine, in order to improve performance. But unfortunatelly I'm not an abap programmer.
    How could this be replaced in the Start routine ?
    select single EXRATEXACC DOC_CURRCY NETVAL_INV
          into (h_rate, h_dcurr, h_inv)
          from /bic/azsdbiio100
           where BILL_NUM eq SOURCE_FIELDS-/BIC/ZREFDOC
           and BILL_ITEM eq SOURCE_FIELDS-/BIC/ZREFDOCLN
           and COMP_CODE eq SOURCE_FIELDS-COMP_CODE.
      if sy-subrc ne 0. " Not found
            select single EXRATEXACC DOC_CURRCY NETVAL_INV
            into (h_rate, h_dcurr, h_inv)
            from /bic/azsdbiio100
             where DOC_NUMBER eq SOURCE_FIELDS-DOC_NUMBER
             and S_ORD_ITEM eq SOURCE_FIELDS-S_ORD_ITEM
             and COMP_CODE eq SOURCE_FIELDS-COMP_CODE.
         if sy-subrc eq 0.
              h_flag = 'X'.  " Document found
         endif.
      else.
         h_flag = 'X'.  "Document found.
      endif.
    if h_flag = 'X'.
            if h_dcurr ne SOURCE_FIELDS-CURRENCY.
              if h_rate lt 0.
                h_rate = h_rate * ( -1 ).
                clear h_amount.
                if h_inv ne 0.
                  h_amount = h_inv.
                else.
                  h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104 * h_rate.
                endif.
              elseif h_rate gt 0.
                if h_inv ne 0.
                  h_amount = h_inv.
                else.
                  h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104 / h_rate.
                endif.
              else.
                h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104.
              endif.
            else.
              h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104.
            endif.
            RESULT = h_amount.
            CURRENCY = h_dcurr.
          endif.
        endif.

    Hi,
    what you need to do first is to define internal tables in the start routine for each individual routine with the key fields. So look at the different SELECT SINGLE statements and build up the internal table(s). So for the first one you need to define an internal table with fields BILL_NUM, BILL_ITEM, COMP_CODE  (your key) and EXRATEXACC, DOC_CURRCY and NETVAL_INV. I don't know if you can combine the two select single statements, that will depend on if BILL_NUM is the same type of field as DOC_NUMBER.
    After declaration of the internal tables you can fill the bales by doing a SELECT instead of select single INTO the internal table.
    In the individual update rules you can do a READ TABLE (internal table) WITH KEY yyyyyy
    In this way you only have to access the DB once per data package and read from the internal memory for each record, which will definitely improve performance.
    Hope this helps!

  • ABAP Objects: Private variable with reference to global internal table

    Hello. I want an object that can hold a private reference
    to a global internal table so that when one of it's methods are invoked, the global table contents are modified.
    Simplification of scenario:
    class myObject definition.
      public section.
        methods:
          set_global_table
            importing reference(i_table) type standard table,
          change_global_table.
      private section.
        data:
          m_pointer_to_table " not sure how to type this"
    endclass.
    class myObject implementation.
      method set_global_table.
        m_pointer_to_table = i_table. " this needs to  "
                                      " assign a pointer to "
                                      " the global variable "
      endmethod.
      method change_global_table.
        refresh m_pointer_to_table. "this should change "
                                    "the contents of global "
                                    "variable "
      endmethod.
    endclass.
    data: gt_itable   type standard table of t_widget,
          go_myobject type ref to myobject.
    * Main code
      create object go_myobject.
    * phantom code fills gt_itable
      call method go_myobject->set_global_table
                    exporting i_table = gt_itable.
      call method go_myobject->change_global_table.
      if gt_itable is initial.
         write 'this should output'.
      endif.
    The code here doesn't work and I've tried messing with field-symbols, etc. all to no avail. Thank you for any help you could provide!
    Brett

    Just typed in this editor - so no syntax-check but you will get the idea:
    Pass the internal table and get the reference of it
    Store the reference and manipulate the global contents with local field-symbols to which you have assigned the reference.
    Hope this helps
    Christian
    >
    > class myObject definition.
    > *
    >   public section.
    > *
    >     methods:
    >       set_global_table
    > importing reference(i_table) type standard
    > standard table,
    > *
    >       change_global_table.
    > *
    >   private section.
    > *
    >     data:
    > m_pointer_to_table type ref to data
    > *
    > endclass.
    > *
    > class myObject implementation.
    > *
    >   method set_global_table.
    > *
         GET REFERENCE of i_table into m_pointer_to_table.
    >   endmethod.
    > *
    > *
    >   method change_global_table.
    > *
      field-symbols: <lit_table> type any table.
        assign m_pointer_to_table to <lit_table>.
    * manipulate <lit_table>
    >   endmethod.
    > *
    > endclass.
    > *
    > *
    > data: gt_itable   type standard table of t_widget,
    >       go_myobject type ref to myobject.
    > *
    > * Main code
    > *
    >   create object go_myobject.
    > *
    > *
    > *
    > * phantom code fills gt_itable
    > *
    > *
    >   call method go_myobject->set_global_table
    >                 exporting i_table = gt_itable.
    > *
    >   call method go_myobject->change_global_table.
    > *
    > *
    >   if gt_itable is initial.
    > *
    >      write 'this should output'.
    > *
    >   endif.
    >
    >
    > The code here doesn't work and I've tried messing
    > with field-symbols, etc. all to no avail. Thank you
    > for any help you could provide!
    >
    > Brett

  • How to pass the values from internal table to field groups

    hi all,
    how can i pass the internal  table values to field groups?
    already field groups are holding some values.. INSERT STATEMENT IS NOT WORKING as it is ovewriting the existing values..
    Use full answers will be rewared.
    Thanks.
    Moderator message - duplicate post locked
    Edited by: Rob Burbank on Jun 23, 2009 9:51 AM

    Hi,
    You can use INSERT statement to put a work area of an Internal table in Field-group
    and use Extract to get info out of it.
    Hope it helps,
    Raj

  • Delete row from internal table using field symbol.

    Hi friends,
      I created dynamic internal table using field symbol. I want to delete some data using where clause.
    for example. i want to use like,
        DELETE <FS> WHERE KUNNR = WA_KNA1-KUNNR.
    Like the above statment it won't work. How i can use delete with where clause in field symbols.
    Hope any one can help me.
    Thanks and regards
    Srikanth. S

    hi Srikanth,
    I think you have to LOOP through the whole internal table and check each line and decide to delete or not:
    LOOP at <itab> INTO <wa>.
    ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <wa> TO <field>.
    CHECK <field> IS ASSIGNED.
    IF <field> EQ WA_KNA1-KUNNR.
    DELETE ...
    ENDIF.
    UNASSIGN <field>.
    ENDLOOP.
    hope this helps
    ec

  • Read two files and store it to Global Internal table in LSMW

    Hi
    I have a requirement in LSMW, there are two files which needs to read the data and upload into SAP based on 2nd file data with some conditions.
    Example :
    File One : Customer Details.
    File Two : Customer Master.
    when we upload the customer master data into SAP we have to cross check customer aganist file two(customer master).
    If the customer is does not exist in the file two, then only we have create the customer other wise skip the record.
    How to go about this, can we create any global internal table in LSMW and how to store the 2nd file data for cross check.
    I tryed with define two source structures, but at any point of time 1st file data is only one record is available.
    Please suggest some solutions.
    Advance Thanks
    Murali.

    Hi Jürgen L.
    If customer is exist in the both files, then we need to extend him to other company codes.
    Some reasons the data is not available in SAP, for writing select query. apart from this we have to do some validation based on 2nd file data.
    Is there any possibility for global internal tables
    Thanks
    Murali

  • Can we create global internal table in data dictionary

    help me
    i want to know whether we can create global internal tables in data dictionary

    Hi Swathi,
    The whole concept of internal table is to manipulate the data at runtime.
    This replaces the concept of two dimentional array in other languages.
    The power of internal tables is it gets lakhs of records at runtime. I mean it can accomodate lots of records at runtime.
    So you can create a table type in DDIC and use it to declare your internal table.
    Yes, You can create global internal tables for function modules.
    By declaring the internal table in top include you can use this internal table all the function modules of that function group. So if one function module is filling the data another can use it as it is stored globally.
    Hope this answers your curiosity.
    Award points if useful else getback.
    Aleem.

  • Avoiding Z-table and having a global internal table during Sales Order

    Hi All,
    I have a requirement like this.
    1. In the R/3 system I am creating Sales order.
    2. For each line item, it will call APO system to check the availability of the materials and the informaiton is returned back to
    R/3 system.
    3. As the soon as the informaiton is recieved in R/3 system, we found one enhancement point and this informaiton is being captured now in a Z-table to do some processing while saving the order after processing all the line items
    4. I wanted to avoid the Z-table and want to have some global internal table which will be available till the end of the processing of the sales order.
    Solution I am thinking of:
    1. One option could be creating a global internal table in SAPMV45A program in one of the enhancement points in the TOP declaration. But, that global internal table is not accessible in the enhancement point where I wanted to store the information. Because, I am actually updating the table in a FM.
    2. Export it to memory and import it when needed. But, how to update the informaiton in this intenal table(which is in memory) for every line item
    Please guide me. Any help on this would be highly appreciated.
    Thanks,
    Babu Kilari

    >
    Babu Kilari wrote:
    >  Solution I am thinking of:
    >
    > 1. One option could be creating a global internal table in SAPMV45A program in one of the enhancement points in the TOP declaration. But, that global internal table is not accessible in the enhancement point where I wanted to store the information. Because, I am actually updating the table in a FM.
    >  Babu Kilari
    If you are updating this table in a FM, you can always add one tables parameter to the function ( if it is a custom function) and pass the globally declared internal table to the function call in the user exit update the table in the FM and when the end function is reached, you will have the updated internal table again at the user exit after the function call.
    Imp- Declare your internal table in MV45ATZZ.
    KR,
    Advait
    Edited by: Advait Gode on Aug 6, 2009 8:16 AM

  • Creating dynamic internal table(Not field symbol table)

    Hi Experts,
    I am facing problem creating Intarnal table
    I have fieldcatalog, I want create dynamic internal table(Not field symbol table).
    I have written----
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
       i_style_table             =
         it_fieldcatalog           = it_fldcat
          it_fieldcatalog           = me->gt_fieldcat
       i_length_in_byte          =
        IMPORTING
          ep_table                  = lt_new_table
       e_style_fname             =
        EXCEPTIONS
         generate_subpool_dir_full = 1
         OTHERS                    = 2.
        ASSIGN lt_new_table->* TO <gt_dyn_repdata>.
        CREATE DATA ls_new_line LIKE LINE OF <gt_dyn_repdata>.
        ASSIGN ls_new_line->* TO <gs_dyn_repdata>.
    above logic creating dynamic field symbol table.... But I want create normal internal table.
    Thanks,
    Rajasekhar

    Hi
    What do you mean?
    It needs to use the field-symbol, this is the price to pay if it wants a dynamic object
    Max

  • Accessing Dynamic Internal table fields

    Hello All,
    I have one internal table ep_tabx having 138 columns whose data is getting displayed
    by using function module reuse_alv_grid_display.
    Now my query is, i have created one custom button on the appl toolbar to download ep_tabx data.
    IF the user changes the the layout of the output at runtime and then presses that custom button
    then i have created one dynamic internal table using call method cl_alv_table_create=>create_dynamic_table suppose <dyn_table> whose struc will be that of
    dynamic fieldcatalog returned by using FM REUSE_ALV_GRID_LAYOUT_INFO_GET.
    And then I have put a loop on the int table ep_tabx and move corresponding to the int table
    <dyn_table>. But when i download the <dyn_table> data through GUI_DOWNLOAD the
    date fields data is not getting downloaded correctly. I have 4 date fields in my ep_tabx.
    In the alv grid output the date is getting displayed like 08/30/2004(ie mon/date/yr) but in download
    file it comes like 20040830(ie yr/mon/date and that too without /).How to access the dynamic
    internal tables fields separately so asto convert them in the pgm before the download.
    Kindly Help.
    Thanks in advance.
    Mansi

    Hi,
    Search in SDN you would get loads of info on accessing dynamic itab's .
    in order to convert your date format use WRITE stmt to convert the value in your itab before passing it to download FM.
    Regards,
    Raghavendra

  • Dynamic field access in internal tables

    Hi everyone.
    I woulkd like to know if there is any way to identify the fields of an internal table at runtime. I'm creating a method in a class, and i would like to accept any itab as a paramter and then access the fields of that itab. I currently have the itab passing no problem using field symbols, and i am able to loop at the data, but i am unsure how to get the field names.
    Any suggestions?
    Thanks!

    Hi,
    Check the code below:
    REPORT ZYKTEST3 .
    DATA: d_ref TYPE REF TO data,
    d_ref2 TYPE REF TO data,
    i_alv_cat TYPE TABLE OF lvc_s_fcat,
    ls_alv_cat LIKE LINE OF i_alv_cat.
    TYPES: tabname LIKE dcobjdef-name ,
    fieldname LIKE dcobjdef-name,
    desc LIKE dntab-fieldtext.
    PARAMETER: p_tablen TYPE tabname. -
    > Input table field
    DATA: BEGIN OF itab OCCURS 0.
    INCLUDE STRUCTURE dntab.
    DATA: END OF itab.
    FIELD-SYMBOLS : <f_fs> TYPE table,
    <f_fs1> TYPE table,
    <f_fs2> TYPE ANY,
    <f_fs3> TYPE ANY,
    <f_fs4> type any,
    <f_field> TYPE ANY.
    REFRESH itab.
    CALL FUNCTION 'NAMETAB_GET' -
    > Fetches the fields
    EXPORTING
    langu = sy-langu
    tabname = p_tablen
    TABLES
    nametab = itab
    EXCEPTIONS
    no_texts_found = 1.
    LOOP AT itab .
    ls_alv_cat-fieldname = itab-fieldname.
    ls_alv_cat-ref_table = p_tablen.
    ls_alv_cat-ref_field = itab-fieldname.
    ls_alv_cat-seltext = itab-fieldtext.
    ls_alv_cat-reptext = itab-fieldtext.
    APPEND ls_alv_cat TO i_alv_cat.
    ENDLOOP.
    internal table build
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = i_alv_cat
    IMPORTING
    ep_table = d_ref.
    ASSIGN d_ref->* TO <f_fs>. -
    > Dynamic table creation with fields of the table
    DATA: l_field TYPE fieldname,
    l_field1 type fieldname.
    SELECT * FROM (p_tablen) INTO CORRESPONDING FIELDS OF TABLE <f_fs>.
    Fetching of the data from the table
    LOOP AT <f_fs> ASSIGNING <f_fs2>.
    Here u can check the validations and process
    ASSIGN COMPONENT 2 OF STRUCTURE <f_fs2> TO <f_fs3>.
    ASSIGN COMPONENT 3 OF STRUCTURE <f_fs2> TO <f_fs4>.
    IF sy-subrc = 0.
    MOVE <f_fs3> TO l_field.
    MOVE <f_fs4> TO l_field1.
    WRITE:/1 l_field(20),
    22 l_field1(10).
    ENDIF.
    ENDLOOP.
    Regards
    Kannaiah

  • How to declare a internal table in start routine i.e. transformations

    Hi Gurus,
    How to define an internal table in a start rotuine?
    any help greatly appreciated.
    Best Regards,
    Reddy.

    Hi,
    types: begin of str,
    field1 type c,
    field2 type c,
    end of str.
    data : itab type table of str with header line.
    the above code should be inserted where it says insert code below this. this will be like a global decleration. this table will be available for all the routines that you write in the transformation.
    All the best !!
    Regards
    Aparna

  • How to make use of a global internal table in SAP BW during transfer rules

    HI friends,
    I am ABAP consultant working on some APO info cubes. I have an issue during the upload of planning area data into APO info cube.
    Please help.
    I am using a transfer routine to find the TECHWEEK from a data base table ZGC_CALWEEK based on the on the calender month and calender week.
    Code I am writing is like below.
    *       FORM COMPUTE_/BIC/ZCALWEEK
    * Compute value of InfoObject ZCALWEEK
    * in communication structure /BIC/CSZT6DPPA
    * Technical properties:
    *     field name      = /BIC/ZCALWEEK
    *     data element    = /BIC/OIZCALWEEK
    *     data type       = NUMC
    *     length          = 000006
    *     decimals        = 000000
    *     ABAP type       = N
    *     ABAP length     = 000006
    *     reference field =
    * Parameters:
    *  -->  RECORD_NO       Record number
    *  -->  TRAN_STRUCTURE  Transfer structure
    *  <--  RESULT          Return value of InfoObject
    *  <->  G_T_ERRORLOG    Error log
    *  <--  RETURNCODE      Return code (to skip one record)
    *  <--  ABORT           Abort code (to skip whole data package)
    FORM COMPUTE_/BIC/ZCALWEEK
      USING    RECORD_NO LIKE SY-TABIX
               TRAN_STRUCTURE TYPE TRANSFER_STRUCTURE
               G_S_MINFO TYPE RSSM_S_MINFO
      CHANGING RESULT TYPE /BIC/OIZCALWEEK
               G_T_ERRORLOG TYPE rssm_t_errorlog_int
               RETURNCODE LIKE SY-SUBRC
               ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel datapackage
    *$*$ begin of routine - insert your code only below this line        *-*
    * DATA: l_s_errorlog TYPE rssm_s_errorlog_int.
    DATA: LV_WEEK         TYPE ZGC_CALWEEK-APOWEEK,
            LV_MONTH        TYPE ZGC_CALWEEK-APOMONTH,
            LV_TECH_WEEK    TYPE ZGC_CALWEEK-TECHWEEK.
      LV_WEEK   = TRAN_STRUCTURE-CALWEEK.
      LV_MONTH  = TRAN_STRUCTURE-CALMONTH.
      SELECT SINGLE TECHWEEK INTO LV_TECH_WEEK
        FROM ZGC_CALWEEK CLIENT SPECIFIED
        WHERE  MANDT = SY-MANDT
        AND  APOWEEK  = LV_WEEK
        AND   APOMONTH = LV_MONTH.
      IF SY-SUBRC IS INITIAL.
        RESULT = LV_TECH_WEEK.
      ELSE.
        RETURNCODE = 1.
        ENDIF.
    *$*$ end of routine - insert your code only before this line         *-*
    ENDFORM.
    There are more than 50-80 million records that wil be transferred from planning area to info cube. The select statment is giving pathetic performance as this has to run 50-80 million times.
    After adding the select statment to find the TECHWEEK it is taking 4 times the time that used to take before writing the select statment.
    Is there a way that I can first fetch the data from ZGC_CALWEEK to one internal table and that internal table can be used using read statment during the transfer routine instead of writing select statement here.
    Please help in this case?

    Hi Ashutosh,
    Thanks for the reply,
    The structure of the ZGC_CALWEEK is as below. I have already created a secondary index on the table for this table for the fields APO WEEK and APO MONTH. This didn't help much on the performance.
    I am also planning to keep the ZGC_CALWEEK database table to be fully buffered and this may definitely improve the performance but I need to reduce the data base hits as less as possible.
    MANDT                           MANDT                           CLNT     3     0     Client
    TECHWEEK                           ZTECHWEEK                           NUMC     6     0     Technical Week
    FROMDATE_TECH     DATUM                           DATS     8     0     Date
    TODATE_TECH     DATUM                           DATS     8     0     Date
    APOWEEK                           /BI0/OICALWEEK     NUMC     6     0     Calendar year / week
    FROMDATE_APO     DATUM                            DATS     8     0     Date
    TODATE_APO     DATUM                            DATS     8     0     Date
    APOMONTH                           /BI0/OICALMONTH     NUMC     6     0     Calendar year/month
    The table ZGC_CALWEEK is in APO system, where the transfer rules are being executed.
    As you mentioned START ROUTINE, In the start routine Can I create an internal table let's say GT_CALWEEK with structure ZGC_CALWEEK and pull all the records (I have a max of 2000 records in this table) from ZGC_CALWEEK to GT_CALWEEK and Can I used the same internal table GT_CALWEEK in the transfer routine to read the TECHWEEK from internal table.
    Thank you very much again for you reply. Any help regarding this would be greatly appreciated.
    Best regards,
    Siva

  • Modify internal table embedded in internal table as field

    Hi Experts,
    I am using function module CRM_DNO_READ_ORDER_TEXT.
    One of the output table of this fm is  ET_ALLTEXTS whixh is of structure COMT_TEXT_TEXTDATA_T.
    This structure has two fields one is GUI and other is LINES which itself contains the table in it.
    I want to delete one row from the data of this LINES table in main table ET_ALLTEXTS .
    Actually, this LINES table contains the texts entered by user from some application. So i want to edit the text.
    Pls help me..this is very complicated.
    thnx
    DIvya

    I guess Nilesh is right, there is something wrong with your declaration. Me for one, I've tried to reproduce your problem and I don't see any problem here. How did you declare your internal table for example?
    When you want to delete a line from table LINES you can't just say:
    delete et_alltexts-lines index 1.
    Because this will give you the error message with 'table without header line....". Instead you first have to loop at this ET_ALLTEXTS internal table and only then you have access to the individual lines, which is an internal table as well. The following is only an example, but it should be helpful:
    DATA: gv_header_guid TYPE crmt_object_guid.
    DATA: gt_textdata    TYPE comt_text_textdata_t ,
          gt_alltexts    TYPE comt_text_textdata_t.
    FIELD-SYMBOLS: <alltext>     LIKE LINE OF gt_alltexts.
    CALL FUNCTION 'CRM_DNO_READ_ORDER_TEXT'
      EXPORTING
        iv_header_guid = gv_header_guid
      IMPORTING
        et_textdata    = gt_textdata
        et_alltexts    = gt_alltexts.
    LOOP AT gt_alltexts ASSIGNING <alltext>.
      DELETE <alltext>-lines INDEX 1.
    ENDLOOP.

  • Dynamic internal  tables using field symbols

    Hello,
    Is it possible to create a dynamic table where the no of fields in the internal table can be created dynamically(using field symbols).
    Say sometimes internal tables with 10 fields and depending upon the requirement the fields can be dynamically increased or decreased in runtime.
    Thanks.

    Hi,
    Go through the following code....
    *Data definitions
    *** Tables
    data: lt_data type ref to data.
    data: lt_fieldcatalog type lvc_t_fcat.
    *** Structure
    data: ls_fieldcatalog type lvc_s_fcat.
    *** Data References
    data: new_line type ref to data,
          fs_data type ref to data.
    *** Field Symbols
    field-symbols: <fs_data> type ref to data,
                   <fs_1> type any table,
                   <fs_2>,
                   <fs_3>.
    *Populating the internal table with fieldnames required for our dynamic
    *internal table
    ls_fieldcatalog-fieldname = 'MANDT'.
    append ls_fieldcatalog to lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CARRID'. "Fieldname
    ls_fieldcatalog-inttype = 'C'. "Internal Type C-> Character
    append ls_fieldcatalog to lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CONNID'.
    ls_fieldcatalog-inttype = 'N'.
    append ls_fieldcatalog to lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'FLDATE'.
    ls_fieldcatalog-inttype = 'D'.
    append ls_fieldcatalog to lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'PRICE'.
    ls_fieldcatalog-inttype = 'P'.
    append ls_fieldcatalog to lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CURRENCY'.
    ls_fieldcatalog-inttype = 'C'.
    append ls_fieldcatalog to lt_fieldcatalog.
    *Calling the method CREATE_DYNAMIC_TABLE
    call method cl_alv_table_create=>create_dynamic_table
         exporting
           it_fieldcatalog = lt_fieldcatalog
         importing
           ep_table = fs_data
         exceptions
           generate_subpool_dir_full = 1
           others = 2
    if sy-subrc <> 0.
    endif.
    *Assigning Field-Symbol to our dynamic internal table
    assign lt_data to <fs_data>.
    *Internal Table is ready, now to put data in that table
    *** So <FS_1> now points to our dynamic internal table.
    assign fs_data->* to <fs_1>.
    *** Next step is to create a work area for our dynamic internal table.
    create data new_line like line of <fs_1>.
    *** A field-symbol to access that work area
    assign new_line->*  to <fs_2>.
    *** And to put the data in the internal table
    select
          mandt
          carrid
          connid
          fldate
          price
          currency
                  from sflight
                  into corresponding fields of table <fs_1>.
    *** Access contents of internal table
    loop at <fs_1> assigning <fs_2>.
    do 5 times.
    assign component sy-index of structure <fs_2> to <fs_3>.
    write:  <fs_3>.
    enddo.
    skip 1.
    endloop.
    top-of-page.
    write:/5 'FUJITSU CONSULTING COMPANY' inverse color 6,
           50 sy-datum inverse color 6,
           70 sy-pagno inverse color 6.
    uline.
    <REMOVED BY MODERATOR>
    Vijay C
    Code Formatted by: Alvaro Tejada Galindo on Apr 14, 2008 1:47 PM

Maybe you are looking for