How to pass internal table with data in ABAP OO

Hi experts ,
Here is the problem...
I create a screen 100 and use the internal table to get data from database, and then press the button on screen 100 , it will call screen 200.
I use ABAP OO code in screen 200, and i want to keep the internal table with data that i get from the sceen 100 parts, but it seems that it just supports to create a new internal table and get data from database in ABAP OO. That means i need to create a new table to save the data in internal table ? Or there is any other solution something like exporting or memory id ...
ps . the internal table in screen 100 is declared in global area, the beginning of the code.
Please give me some advice, thanks a lot!
Regards ,
Claire

I have already know how to do, here is my code:
METHODS fill_tree importing itab2 like itab1.
CALL METHOD: me->fill_tree exporting itab2 = itab1.
In METHOD fill_tree,
declare
data: itab3 TYPE STANDARD TABLE OF itab,
itab3[] = itab1[].
It is useful to me, thanks a lot.

Similar Messages

  • How to pass internal table to method of class

    Hi all,
    I am new to abap objects, i want to pass one internal table to class.
    i am trying in this way.
    class c1 definition.
    method get_material importing t_stpo  type any table
                                   exporting t_mast type any table.
    endmethod.
    endclass.
    class c1 implementation.
    method get_material.
    select f1 f2 f3 from <tab> into table t_mast
            for all entries in t_stpo
            where stlnr = t_stpo-stlnr.
    endmethod.
    endclass.
    ERROR:
    "stlnr" is not available
    if i use this way. its not giing error.
    class c1 definition.
    method get_material exporting t_mast type any table.
    endmethod.
    endclass.
    class c1 implementation.
    method get_material.
    select f1 f2 f3 from <tab> into table t_mast
            for all entries in it_stpo
            where stlnr = it_stpo-stlnr.
    endmethod.
    endclass.
    how to pass internal table with some specific reference may be using like or type <it_xxxx>
    thanks

    Try this.
    TYPES : BEGIN OF ty_stpo,
             stlnr TYPE stpo-stlnr,
             idnrk TYPE stpo-idnrk,
             menge TYPE stpo-menge,
            END OF ty_stpo,
            BEGIN OF ty_mast,
             matnr TYPE mast-matnr,
             werks TYPE mast-werks,
             stlnr TYPE mast-stlnr,
            END OF ty_mast,
            tt_stpo TYPE TABLE OF ty_stpo,
            tt_mast TYPE TABLE OF ty_mast.
    DATA : it_stpo TYPE tt_stpo,
           it_mast TYPE tt_mast.
    *       CLASS c1 DEFINITION
    CLASS c1 DEFINITION.
      PUBLIC SECTION.
        METHODS : get_bom_numbers EXPORTING ex_stpo type tt_stpo,
                  get_parent_material IMPORTING im_stpo TYPE tt_stpo
                                      EXPORTING ex_mast TYPE tt_mast.
        endclass.
    *       CLASS c1 IMPLEMENTATION
    CLASS c1 IMPLEMENTATION.
      METHOD get_bom_numbers.
      ENDMETHOD.                    "get_bom_numbers
      METHOD get_parent_material.
      ENDMETHOD.                    "get_parent_material
    START-OF-SELECTION.
      DATA : obj TYPE REF TO c1.
      CREATE OBJECT obj.
      CALL METHOD obj->get_bom_numbers
        IMPORTING
          t_stpo = it_stpo.
      CALL METHOD obj->get_parent_material
        EXPORTING
          im_stpo = it_stpo
        IMPORTING
          ex_mast = it_mast.
    Regards,
    Rich Heilman

  • How to pass  internal table values to parameter

    hi,
             how to pass  internal table values to parameter in selection screen.if is it possible means please sent codeings.
    thanks.
      stalin.

    hi,
    tables : mara.
    data :  begin of itab_mara occurs 0,
              matnr like mara-matnr,
              ernam like mara-ernam,
              end of itab_mara.
    selection-screen : begin of block blk1 with frame title text-001.
    parameters : p_matnr like mara-matnr.
    selection-screen : end of block blk1.
    select matnr ernam from mara into corresponding fields of itab_mara
                                                                    where matnr = p_matnr.
    loop at itab_mara.
    write :/ itab_mara-matnr,
               itab_mara-ernam.
    endloop.
    <b><REMOVED BY MODERATOR></b>
    Message was edited by:
            Alvaro Tejada Galindo

  • How to fill internal table with selection screen field.

    Hi all,
    i am new to sap . pls tell me how to fill internal table with selection screen field.

    Hi,
    Please see the example below:-
    I have used both select-options and parameter on the selection-screen.
    Understand the same.
    * type declaration
    TYPES: BEGIN OF t_matnr,
            matnr TYPE matnr,
           END OF t_matnr,
           BEGIN OF t_vbeln,
             vbeln TYPE vbeln,
           END OF t_vbeln.
    * internal table declaration
    DATA : it_mara  TYPE STANDARD TABLE OF t_matnr,
           it_vbeln TYPE STANDARD TABLE OF t_vbeln.
    * workarea declaration
    DATA : wa_mara  TYPE t_matnr,
           wa_vbeln TYPE t_vbeln.
    * selection-screen field
    SELECTION-SCREEN: BEGIN OF BLOCK b1.
    PARAMETERS : p_matnr TYPE matnr.
    SELECT-OPTIONS : s_vbeln FOR wa_vbeln-vbeln.
    SELECTION-SCREEN: END OF BLOCK b1.
    START-OF-SELECTION.
    * I am adding parameter value to my internal table
      wa_mara-matnr = p_matnr.
      APPEND wa_mara TO it_mara.
    * I am adding select-options value to an internal table
      LOOP AT s_vbeln.
        wa_vbeln-vbeln =  s_vbeln-low.
        APPEND  wa_vbeln TO  it_vbeln.
      ENDLOOP.
    Regards,
    Ankur Parab

  • How to disply internal table with grid format .

    HI ,
    how to disply internal table with grid format .
    Regards
    venkat

    Grid format can be disaplyed using two ways,
    1. Using reuse_alv_grid_display
    2. using object oriented ABAP with the methos set_table_for_first_display.
    For example program search in where used list for standard SAP programs.
    If this is not the answer then please explain your issue in detail
    Thanks,
    Rama Krishna

  • How i can create table with data

    How i can create table with data from dev to production?

    How i can create table with data
    [url=http://en.wikipedia.org/wiki/Black_Beast_of_Aa
    aaarrrrrrggghhh]from dev to production?
    [url=http://img2.travelblog.org/Photos/3800/14977/t
    /64816-Col-Kurtz-0.jpg]The horror, the
    horror.lol, you gonna scare somebody here.
    Are we helping devil?

  • Use of internal table with hearerline in ABAP OO

    Hi,
    I have a very basic question regarding the use of Internal table with headerline in ABAP OO.
    I consider the concept of Internal table with header as one of the most features of ABAP, which is not there in any of the other porgramming languages.
    I accept that OO's concept is one of the most powerful and a very good concept. We should also implement OO's concept in ABAP.
    But my concern is why in the process of moving to OO's the concept of Internal table with headerline is no more used.
    Can any one tell me the main reason for this. Is there any technical reason for this. By this i mean anything to do with memory or effeciency.
    Thanx,
    Srinivas

    Hi Srinivas,
       here is something more which i found about the same
    follow this link
    https://sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5ac31178-0701-0010-469a-b4d7fa2721ca
    and search for header line.
    it says:
    Tables with header lines not allowed
    Only tables without header lines can be declared in ABAP Objects.
    Error message in ABAP Objects if the following syntax is used:
    DATA itab TYPE LIKE TABLE OF ... WITH HEADER LINE.
    Correct syntax:
    DATA: itab TYPE LIKE TABLE OF ... ,
    wa LIKE LINE OF itab.
    Reason:
    It depends on the statement whether the body or header line of a table is accessed. The table name should identify the table uniquely. Programs are easier to read. Tables with header lines do not improve performance.
    i hope this will help you.
    regards,
    Kinshuk
    PS mark helpful answers

  • How to create internal table storing instances of ABAP class

    Hi experts, any one knows how to create internal table storing instances of ABAP class or alternative to implement such function?

    Hi
    Please see below example from ABAPDOCU, this might help you.
    Internal Table cnt_tab is used to store class objects.
    Regards,
    Vishal
    REPORT demo_objects_references.
    CLASS counter DEFINITION.
      PUBLIC SECTION.
        METHODS: set IMPORTING value(set_value) TYPE i,
                 increment,
                 get EXPORTING value(get_value) TYPE i.
      PRIVATE SECTION.
        DATA count TYPE i.
    ENDCLASS.
    CLASS counter IMPLEMENTATION.
      METHOD set.
        count = set_value.
      ENDMETHOD.
      METHOD increment.
        ADD 1 TO count.
      ENDMETHOD.
      METHOD get.
        get_value = count.
      ENDMETHOD.
    ENDCLASS.
    DATA: cnt_1 TYPE REF TO counter,
          cnt_2 TYPE REF TO counter,
          cnt_3 TYPE REF TO counter,
          cnt_tab TYPE TABLE OF REF TO counter.
    DATA number TYPE i.
    START-OF-SELECTION.
      CREATE OBJECT: cnt_1,
                     cnt_2.
      MOVE cnt_2 TO cnt_3.
      CLEAR cnt_2.
      cnt_3 = cnt_1.
      CLEAR cnt_3.
      APPEND cnt_1 TO cnt_tab.
      CREATE OBJECT: cnt_2,
                     cnt_3.
      APPEND: cnt_2 TO cnt_tab,
              cnt_3 TO cnt_tab.
      CALL METHOD cnt_1->set EXPORTING set_value = 1.
      CALL METHOD cnt_2->set EXPORTING set_value = 10.
      CALL METHOD cnt_3->set EXPORTING set_value = 100.
      DO 3 TIMES.
        CALL METHOD: cnt_1->increment,
                     cnt_2->increment,
                     cnt_3->increment.
      ENDDO.
      LOOP AT cnt_tab INTO cnt_1.
        CALL METHOD cnt_1->get IMPORTING get_value = number.
        WRITE / number.
      ENDLOOP.

  • How to fill internal table with no data in debugging mode

    Hi all,
             I modified one existing program.Now I want to test it.I am not given test data.So in the middle of my debugging, I found that one internal table with no data.My problem is how to fill that internal table with few records in that debugging mode just as we change contents in debugging mode.If I want to proceed further means that internal table must have some records.
    Please I dont know how to create test data so I am trying to create values temporarily in debugging mode only.
    Thanks,
    Balaji

    Hi,
    In the debugging do the following..
    Click the Table button..
    Double click on the internal table name..
    Then in the bottom of the screen you will get the buttons like CHANGE, INSERT, APPEND, DELETE..
    Use the APPEND button to insert records to the internal table..
    Thanks,
    Naren

  • How to pass  Internal table in submit

    Hi  Friends-
    i have a internal table with two fields it is like
    begin of error occurs 0,
    num(8)  type n,
    msg(50) type c,
    end of error .
    now  this table i have to submit in another report and i have to use this table in that other report
    but how i can pass this in submit   pls guide me.
    Regards
    Meeta

    Hi ,
    I am writing the 2 options that I know of my knowledge:
    OPTION 1 :
    in prog1
    loop at itab.
    r_matnr-sign = 'I'.
    r_matnr-option = 'EQ'.
    r_matnr-low = itab-matnr.
    append r_matnr.
    clear r_matnr.
    endloop.
    submit prog2 via selection-screen
    with s_matnr in r_matnr and return.
    in prog2
    select-options: s_matnr for mara-matnr no-display.
    loop at s_matnr.
    itab-matnr = s_matnr-low.
    append itab.
    clear itab.
    endloop.
    OPTION 2:
    report zashish_1.
    data: imara type table of mara with header line.
    start-of-selection.
    select * into table imara from mara up to 10 rows.
    export imara to memory id 'YOURID'.
    submit zashish_2 and return.
    The submitted program.
    report zashish_2 .
    data: imara type table of mara with header line.
    import imara from memory id 'YOURID'.
    loop at imara.
    write:/ imara-matnr.
    endloop.
    Hope these option might have clarified most of your doubts.
    Regards,
    Ashish Arora

  • How to pass internal table to form routine..?

    Gurus,
    I am creating a custom Function module in which i have declared few perform statements and passing internal table to it..but when i declare the form it gives me error that the internal table is unknown...Can u please suggest me what am i doing wrong...
      DATA: Begin of tb_set_values occurs 0.
            include structure rgsb4.
      DATA: End of tb_set_values.
    PERFORM read_sets_with_values USING wa_setheader CHANGING tb_set_values[].
    FORM read_sets_with_values USING value(rwa_setheader) LIKE setheader
                               CHANGING rtb_set_values LIKE tb_set_values[].
    DATA: v_setid TYPE setid.
    *DATA: Begin of rtb_set_values occurs 0.
         include structure rgsb4.
    *DATA: End of rtb_set_values.
      CALL FUNCTION 'G_SET_GET_ID_FROM_NAME'
        EXPORTING
          SHORTNAME = rwa_setheader-setname
        IMPORTING
          NEW_SETID = v_setid.
      CALL FUNCTION 'G_SET_GET_ALL_VALUES'
        EXPORTING
          SETNR      = v_setid
        TABLES
          SET_VALUES = rtb_set_values.
    ENDFORM.
    What can be the error..please help

    Well actually, I just tested it and it works fine as you have written it in my test program, so not sure what you are doing wrong. This was tested in NW 7.0
    REPORT rich_0001.
    DATA: setheader TYPE string.
    DATA: wa_setheader TYPE string.
    DATA: BEGIN OF tb_set_values OCCURS 0.
            INCLUDE STRUCTURE t000. "<<-- Test with T000 instead    "rgsb4.
    DATA: END OF tb_set_values.
    SELECT * INTO TABLE tb_set_values  FROM t000.
    PERFORM read_sets_with_values USING wa_setheader
                                  CHANGING tb_set_values[].
    *&      Form  read_sets_with_values
    *       text
    *      -->VALUE(RWA_SETHEADER)  text
    *      -->RTB_SET_VALUES        text
    FORM read_sets_with_values USING value(rwa_setheader) LIKE setheader
                               CHANGING rtb_set_values LIKE tb_set_values[].
      DATA: ls_set_values LIKE LINE OF rtb_set_values.
      LOOP AT rtb_set_values INTO ls_set_values.
        WRITE:/ ls_set_values.
      ENDLOOP.
    ENDFORM.                    "read_sets_with_values
    Regards,
    RIch Heilman

  • How to convert internal table with dynamic fields to XML

    Dear all,
    I met a problem like the following:
    The aim is to transform the following parameter to XML
    IT_FIELD stores the dynamic filed name of the internal table,with these fields, the dynamic internal can be created by cl_abap_tabledescr=>create(it_field)
    IT_VALUE stores the value of the internal table dynamically created with dynamic fields.
    For example
    IT_FIELD =>
    line1: FIELD1
    line2: FIELD2
    line3: FIELD3,
    three lines in this internal table.
    dynamically created internal table structure FIELD1 FIELD2 FIELD3
    And IT_VALUE=>
    1          2          3   (First line)
    11        22        33
    two lines of data.
    Do you have any idea about how to transform the IT_VALUE to XML here? And also the transformed XML to the IT_VALUE.( we may need remember IT_FIELD here for later XML to IT_VALUE.)
    Hope I describe the problem clearly.
    Any inputs will be appreciated.
    Edited by: Max Tang on Jan 12, 2009 3:46 PM
    Edited by: Max Tang on Jan 12, 2009 4:14 PM

    Hi,
    you need to implement a bit of coding for that.
    With the 'do varying' statement abap provides a loop over those fields. Within this loop you can build up a new internal table with one entry for each period and amount.
    kind regards
    Siggi
    PS: I am not very familiar with CO, but I guess there will be a standard extractor for that.

  • Populating dynamic internal table with data

    Hi,
    I have an internal table with the data like the below
          profit  lineId  amount
          center
           s21     70     1000
           s21     80     1200
           s22     70      800
    In the above internal table the number of distinct lineIDs will be vary based on selection-screen creiteria.
    So for this I build a fieldcatalog and dynamic internal table like the following
    The data available in the above internal table should be placed into the dynamic internal table like the following.
         profit
         center  LineID70 LineID80 .....etc
          S21      1000     1200
          S22       800
    Can any one suggest how to proceed?
    Thanks in advance
    Nanda.

    Hi
    This is my first ever reply so I hope this works or gives you some ideas.
    DATA: l_idcount TYPE i,
                l_idvalue LIKE itab2-amount.
    *loop through the source internal table
    LOOP AT itab1.
    * increment count of id numbers in current profit center
      l_idcount = l_idcount + 1. 
    * run through the amount fields in target internal table
      DO ID_number TIMES VARYING l_idvalue
          FROM itab2-LineID70 NEXT itab2-LineID80.
        IF sy-index EQ l_idcount.
    *   change field value if id count same as field position
          l_idvalue = itab1-amount.
        ENDIF.
      ENDDO.
      AT END OF profit_center.
        itab2-profit_center = itab1-profit_center.
        APPEND itab2.
        CLEAR l_idcount.
      ENDAT.
    ENDLOOP.
    ID_number is the number of ids as a result of selection-screen criteria.

  • Filling Dyanamic Internal table with data

    Hi All
    I have a following requirement.
    1.. I have internal table with 1 text field of length 1000, this is field with data uploaded from text file having data tab seprated
    2. I have a dyanamic table in which i have to fill the using the above internal table  splited by tab seprated into the corresponding fields of dyanamic table.
    please suggest some solution for the above.
    thanks
    bobby

    Hi Martin,
    But How to assign to dyanmic table fields if we are using
    split t_intab at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB into .
    where t_intab has 1 field of lenth say 1000 in which data stored is tab seprated.
    please find below my code, please check loop at t_intab
    FUNCTION Z_TEXT.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_EXPTABLE) TYPE  LVC_T_FCAT
    *"     VALUE(I_DELIMETER) TYPE  C DEFAULT 'T'
    *"  TABLES
    *"      T_INTAB
    *"      T_OUTTAB
    Data declarations
    DATA:
      dtab           TYPE REF TO data,
      newstr2        TYPE REF TO cl_abap_typedescr,
      tab_type1      TYPE REF TO cl_abap_tabledescr,
      lref_ditab     TYPE REF TO data,
      lref_new_line  TYPE REF TO data.
    Field-Symbols declarations
    FIELD-SYMBOLS:
    <fs_dyn_tab1> TYPE  ANY TABLE,
    <fs_dyn_wa>   TYPE ANY,
    <fs>          type any.
    Create dynamic table
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = i_exptable
        IMPORTING
          ep_table                  = lref_ditab
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
       IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Assign the dynamic table reference to a field-symbol
      ASSIGN lref_ditab->* TO <fs_dyn_tab1>.
    Create a structure similar to the dynamic table created
      CREATE DATA lref_new_line LIKE LINE OF <fs_dyn_tab1>.
      ASSIGN lref_new_line->* TO <fs_dyn_wa>.
    loop at t_intab.
    if I_DELIMETER = 'T'.
    split t_intab at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB into .
    endif.
    endloop.
    ENDFUNCTION.
    thanks
    bobby

  • How to Fill Internal Table with contents of Select-Option

    Hi all:
         There is a select-option s_matnr on the self-made screen.   An internal table t_int is declared in the program. The requirement is that users makes selection with multiple  material numbers.  I want to put the values of s_matnr  into internal table  t_int directly. Would you please tell me how?
         Thank you very much in advance.
    Edited by: dongdong guo on Jun 13, 2008 3:40 AM

    Hi,
    Select option works like an internal table only.
    For table selection you can use it directly using IN operator in where clause
    eg : where matnr IN s_matnr.
    Before that you may need to validate the content of the select-option. For that also you need to transfer the content to a new internal table.
    u can loop at the select-option.
    eq: loop at s_matnr.
          if s_matnr-low = 'MAT1'.
            condition.
          endif.
         endloop.
    if you just want to check whether any single valid material number exist in your user screen, then u can use a select single option with s_matnr directly.
      select single matnr from mara
                where matnr in s_matnr.
      select-option s_matnr behaves like an internal table with four fields.
    sign, option, low, high.

Maybe you are looking for