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

Similar Messages

  • It cannot reference the dynamic internal table in memory as an object.

    Hi,
    I am getting the syntax error in the second select. I guest it cannot reference the dynamic internal table in memory as an object.
    The internal table contains different fields from multiple tables and it gets created OK. Then the first select within the loop executes OK allowing me to read the multiple tables in ITABLES.
    * Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = ifc
        IMPORTING
          ep_table        = dy_table.
    ***OK, the dynamic tables is created here
      assign dy_table->* to <dyn_table>.
    * Create dynamic work area and assign to FS
      create data dy_line like line of <dyn_table>.
      assign dy_line->* to <dyn_wa>.
    loop at ITABLES.
    ***OK, no syntax errors in this select here
      select * appending corresponding fields of table <dyn_table>
                 from (ITABLES-TABNAME).
    endloop.
    data: ikonp like konp occurs 0 with header line.
    ***NOT OK, there is syntax errors
      select * into table ikonp
      from KONP for all entries in <dyn_table>
      where knumh = <dyn_table>-knumh.
    Some of the tables in ITABLES are pooled tables which does not allow me to use INNER JOINS. Therefore I need a second select in order to read the pricing table KONP.
    Thanks in advance for any hint.

    Hi Abel,
    You must be getting the syntax error that <dyn_table> does not contain the field knumh.
    try putiing the entire where clause in a char type variable say wa_char and then use in ur query as
    where (wa_char) .. it may work..
    concatenate 'knumh' '=' '<dyn_table>-knumh' INTO wa_char SEPARATED BY SPACES.
    SELECT ... from konp...
    where (wa_char).
    Revert if it doesnt work.

  • 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

  • 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?

  • Filling dynamic internal table with data from other internal table

    Hi Friends,
    My problem is that i have already built a dynamic internal table
    (class int_table->create) but now i want to fill it with data from other internal table.
    The dynamic table column name and the field value of the data filled internal table are same, but how to access that column name, since i cant hard code it anyway.
    Like if my werks field value is '8001'. I want to place it under the column 8001 of dynamic table, Can anybody help me in this regard?
    Awarding points is not a problem for even giving a slight hint.
    Best Regards

    Hi
    See this
    Dynamic internal table is internal table that we create on the fly with flexible column numbers.
    For sample code, please look at this code tutorial. Hopefully it can help you
    Check this link:
    http://www.****************/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm
    Sample code:
    DATA: l_cnt(2) TYPE n,
    l_cnt1(3) TYPE n,
    l_nam(12),
    l_con(18) TYPE c,
    l_con1(18) TYPE c,
    lf_mat TYPE matnr.
    SORT it_bom_expl BY bom_comp bom_mat level.
    CLEAR: l_cnt1, <fs_dyn_wa>.
    Looping the component internal table
    LOOP AT it_bom_expl INTO gf_it_bom_expl.
    CLEAR: l_cnt1.
    AT NEW bom_comp.
    CLEAR: l_cnt, <fs_dyn_wa>, lf_mat.
    For every new bom component the material data is moved to
    temp material table which will be used for assigning the levels
    checking the count
    it_mat_temp[] = it_mat[].
    Component data is been assigned to the field symbol which is checked
    against the field of dynamic internal table and the value of the
    component number is been passed to the dynamic internal table field
    value.
    ASSIGN COMPONENT c_comp_list OF STRUCTURE <fs_dyn_wa> TO
    <fs_check>.
    <fs_check> = gf_it_bom_expl-bom_comp.
    ENDAT.
    AT NEW bom_mat.
    CLEAR l_con.
    ENDAT.
    lf_mat = gf_it_bom_expl-bom_mat.
    Looping the temp internal table and looping the dynamic internal table
    *by reading line by line into workarea, the materialxxn is been assigned
    to field symbol which will be checked and used.
    LOOP AT it_mat_temp.
    l_nam = c_mat.
    l_cnt1 = l_cnt1 + 1.
    CONCATENATE l_nam l_cnt1 INTO l_nam.
    LOOP AT <fs_dyn_table2> ASSIGNING <fs_dyn_wa2>.
    ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa2> TO <fs_xy>.
    ENDLOOP.
    IF <fs_xy> = lf_mat.
    CLEAR lf_mat.
    l_con1 = l_con.
    ENDIF.
    Checking whether the material exists for a component and if so it is
    been assigned to the field symbol which is checked against the field
    of dynamic internal table and the level of the component number
    against material is been passed to the dynamic internal table field
    value.
    IF <fs_xy> = gf_it_bom_expl-bom_mat.
    ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
    CLEAR l_con.
    MOVE gf_it_bom_expl-level TO l_con.
    CONCATENATE c_val_l l_con INTO l_con.
    CONDENSE l_con NO-GAPS.
    IF l_con1 NE space.
    CONCATENATE l_con1 l_con INTO l_con SEPARATED BY c_comma.
    CLEAR l_con1.
    l_cnt = l_cnt - 1.
    ENDIF.
    <fs_check> = l_con.
    l_cnt = l_cnt + 1.
    ENDIF.
    ENDLOOP.
    AT END OF bom_comp.
    At end of every new bom component the count is moved to the field
    symbol which is checked against the field of dynamic internal table
    and the count is been passed to the dynamic internal table field
    value.
    ASSIGN COMPONENT c_count OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
    <fs_check> = l_cnt.
    INSERT <fs_dyn_wa> INTO TABLE <fs_dyn_table>.
    ENDAT.
    ENDLOOP.
    Reward if useful
    Anji

  • 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

  • Change SSIS variable with reference in C# ?

    I access a read write variable with C# in script task. Its Dts.Variables["strRope"].Value = "onFire";
    Is there any way I could refer to a SSIS variable without using this big name ? I was thinking of  - 
    Object var = Dts.Variables["strRope"].REFERENCE_TO_VARIABLE;
    Now, if I want to reassign strRope, I can simply say var = (String) "Ten thousand thundering typhoons".
    Is there any way I can do such a thing ?
    I tried this -
    public void Main()
    object var = Dts.Variables["strRope"].Value;
    MessageBox.Show("original value = " + Dts.Variables["strRope"].Value.ToString());//original value = "Hello World"
    //Try to change the value of Dts.Variables["strRope"].Value using var ???
    var = (object)"Hello cruel world !";
    MessageBox.Show("new value = " + Dts.Variables["strRope"].Value.ToString());//new value = ???
    Dts.TaskResult = (int)ScriptResults.Success;

    You cant. you need to invoke it using Dts.Variables collection itself.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
    I think it would be useful to have this feature. So one can create aliases for all the long SSIS variables in the beginning of the code itself. Otherwise, one has to put it all around. 
    I was trying this - 
    public void Main()
    object var = Dts.Variables["strRope"].Value;
    MessageBox.Show("original value = " + Dts.Variables["strRope"].Value.ToString());//original value = "Hello World"
    //Try to change the value of Dts.Variables["strRope"].Value using var ???
    var = (object)"Hello cruel world !";
    MessageBox.Show("new value = " + Dts.Variables["strRope"].Value.ToString());//new value = ???
    Dts.TaskResult = (int)ScriptResults.Success;

  • Dynamic creation of variables and alv grid output/internal table

    Dear Experts
    I am stuck in an inventory ageing report which is to be done year wise. the scenario is as follow.
    selection screen i enter the year 2011 or 2010 or 2009.
    the output should show me 2011-2007 or 2010-2007 or 2009-2007. the alv grid should always start from 2007 and end at the year that is entered in the selection screen.
    Now how can i create a dynamic variables to store the values of the corresponding yr and also how can i create a dynamic internal table to store these values.
    Thanks & Regards
    Zamir Parkar

    Hi Zamir,
    if you are new to ABAP you may leave old and buggy techniques behind.
    If you want to create the table dynamically, please do not use l_alv_table_create=>create_dynamic_table because it is limited and always triggers a possibly unwanted database commit.
    You better use RTTS dynamic runtime type services, i.e. check the example for [Creating Flat and Complex Internal Tables Dynamically using RTTI|http://wiki.sdn.sap.com/wiki/display/Snippets/CreatingFlatandComplexInternalTablesDynamicallyusingRTTI].
    As done here, leave all outdated ALV technologies behind and start with CL_SALV_TABLE. It is following the object-oriented approach and does not need a field catalog.
    You will get used to field-symbols that can be compared to the data referenced by a pointer. For dynamic fields, you may build the field names dynamically, i.e.
    DATA:
          lo_structdescr         TYPE REF TO cl_abap_structdescr,
          lo_typedescr           TYPE REF TO cl_abap_typedescr,
          lo_tabledescr          TYPE REF TO cl_abap_tabledescr,
          lr_data                TYPE REF TO data,
          lt_comp_all            TYPE cl_abap_structdescr=>component_table,
          lv_index               TYPE numc2.
        FIELD-SYMBOLS:
          <any>                  TYPE ANY,
          <component>            TYPE LINE OF abap_component_tab,
           <table>                TYPE table.
        DO nnn TIMES.
          lv_index = sy-index.
          lo_typedescr   =  cl_abap_typedescr=>describe_by_name( <name of data element> ).
          APPEND INITIAL LINE TO lt_comp_all ASSIGNING <component>.
          <component>-type ?= lo_typedescr.
          CONCATENATE 'YEARVAL' lc_underscore lv_index INTO <component>-name.
          <component>-as_include  = abap_true.
          CONCATENATE lc_underscore lv_index INTO <component>-suffix.
        ENDDO.
    * create description object for structured type
        lo_structdescr = cl_abap_structdescr=>create( lt_comp_all ).
    *  create table description object for this
        lo_tabledescr = cl_abap_tabledescr=>create(
                        p_line_type  = lo_structdescr
                        p_table_kind = cl_abap_tabledescr=>tablekind_std
                        p_unique     = abap_false ).
    * create data object
        CREATE DATA lr_data TYPE HANDLE lo_tabledescr.
    ASSIGN lr_data->* to <table>.
    This is a fragment. Please adapt to your needs.
    Regards,
    Clemens

  • 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

  • How to declare global internal table in smartform

    Hi
    i need internal table in smart form with type of tline .. tline is structure and when i declare it in global definition as  lines like tline it creates a structre ... kindly help me out
    Regards
    Ammad

    This error is coming becasue u have not created an work area which is of same type as tdline.
    Just double click on the error and copy paste the code here.Error now is nin ur code.
    Secondly lets my internal table is GT_TLINE.
    I will declare a work are GWA_TLINE type TLINE.
    then i can have
    loop at gt_line into gwa_tline or
    read table gt_tline into gwa_tline with key etc.
    Regards,
    Nabheet Madan

  • Search Help doesn't work with a dynamically created internal table

    Hi Gurus,
    I have a custom report that will display the output through edittable ALV.
    My issue is, even though I've already did the FOREIGN KEY assisgnment to each fields of my custom table,
    when I run my report,some fields F$ functionality aint working.
    In my report, I've declared the table to be passed to ALV display dynamically as below:
    *_Create dynamic internal tables for the Final INTERNAL TABLE
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = gt_fldcatfin
        IMPORTING
          ep_table                  = gp_fintab
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
        ASSIGN gp_fintab->* TO <i_xfintab>.
    Where gt_fldcatfin is a modified fieldcatalog (combination of the cutom table fields and 1 column for CELLCOLOR)
    Please help me with this. Thanks a lot.

    This is one way.
    Import photo into illustrator.
    Draw box around photo, no fill ,no stroke colour and place on top of photo.
    Menu - Object - Envelope Distort - Make with Warp - (warp option will appear)
    Use ‘Direct Selection Tool’ (white arrow)
    Select/click on anchor points to alter, you can also use the rotation tool to turn to required position.
    Hope this info' is of help.

  • Issue with WRITE statement from Internal Table

    Hi All,
    I have written the below code in a infoset query, the syntax check is ok & when i run the query in debugging mode, i find the internal table being filled with the values & the write statement outputing the values as well.
    But the problem is when i execute the query the output does not show all the lines, instead just displays the last record . What could be the mistake?
    Is it because i have defined Y_EBELN, Y_EBELP & Y_OPENQTY as nodes in the Extras Tab of the infoset & have chosen this for display in my query? How to display the output from my internal table in my query output?
    Hope my problem is clear, await clarification.
    Vivek
    Code
      types:
        Begin of itab,
          wl_ebeln   type eket-ebeln,
          wl_ebelp   type eket-ebelp,
          wl_openqty type eket-menge,
        End of itab.
    Data: il_po type table of itab with header line.
    *Display open PO for materials
      SELECT EKETEBELN EKETEBELP EKETMENGE EKETWEMNG EKET~EINDT
           INTO (Y_EBELN, Y_EBELP, WL_MENGE, WL_WEMNG, Y_EINDT)
        FROM EKET
          INNER JOIN EKPO
             ON EKETEBELN     = EKPOEBELN
              AND EKETEBELP = EKPOEBELP
          INNER JOIN MARD
             ON EKPOMATNR     = MARDMATNR
              AND EKPOWERKS = MARDWERKS
              AND EKPOLGORT = MARDLGORT
        WHERE EKPO~MATNR = MARD-MATNR
          AND EKPO~WERKS = MARD-WERKS
          AND EKPO~LGORT = MARD-LGORT
          AND EKPO~LOEKZ = SPACE
          AND EKPO~ELIKZ = SPACE.
    *Display only still open qty per schedule line
      Y_OPENQTY = WL_MENGE - WL_WEMNG.
      il_po-wl_ebeln = Y_EBELN.
      il_po-wl_ebelp = Y_EBELP.
      il_po-wl_openqty = Y_OPENQTY.
        append il_po.
      ENDSELECT.
    ENDIF.
    Loop at il_po.
      write:/ il_po-wl_ebeln, il_po-wl_ebelp, il_po-wl_openqty.
    endloop.

    Hi Vivek,
      Try it like this.
    Data: Begin of itab,
           lifnr type lfa1-lifnr,
           name1 type lfa1-name1,
           land1 type lfa1-land1,
          End of itab,
          it_lfa1 like table of itab with header line,
          lifnr like lfa1-lifnr,
          name1 like lfa1-name1,
          land1 like lfa1-land1.
    select lifnr name1 land1 into (lifnr, name1, land1)
           from lfa1.
    it_lfa1-lifnr = lifnr.
    it_lfa1-name1 = name1.
    it_lfa1-land1 = land1.
    append it_lfa1.
    endselect.
    loop at it_lfa1.
    write:/ it_lfa1-lifnr, it_lfa1-name1, it_lfa1-land1.
    endloop.
    Note:
    In place of the above select you insert your join select statement. It is working for me.
    You have declared your internal table wrongly. In the internal table instead of TYPE use LIKE, it will work.
    Hope this will work for you.
    Thanks & Regards
    Haritha.

  • A global internal table - retaing values of internal table

    Hi,
    I needed some help in the creation of a internal table whose content don't change in the recursive call to the method.
    I call a method  M1 which returns me an standard internal table (i1) as an import parameter and has two export parameters ( exp_p1,exp_p2).
    I call this method(m1) recursively in the method m1 itself. I find that when i call this mehtod m1 , second time the data that was there in the internal table M1 on first call of the method is cleared out.
    what shoudl i do , so that i can to reatin the the value of the internal table.
    Like for example , i have one record in the internal table in the first call to the method M1 and before the second call of method is made.
    Once the call to method M1 is made ( meaning to say a second call is made) ,the internal table contains zero records.
    while creating the internal table i use a the append keyword to add rows in the method.
    In Programming language 'C', for recursion function , if any variable is made as static, that variable retains it value during successive calls to the function.I am looking for something similar to it.
    Regards,
    Om

    Use a static class. 
    report zrich_0002.
    *       CLASS lcl_app DEFINITION
    class lcl_app definition.
      public section.
        <b>class-data:</b> it001 type table of t001.
        <b>class-data:</b> xt001 type t001.
        <b>class-methods:</b> get_data,
                       write_data.
    endclass.
    start-of-selection.
      call method lcl_app=>get_data.
      do 2 times.
        call method lcl_app=>write_data.
        skip 1.
      enddo.
    *       CLASS lcl_app IMPLEMENTATION
    class lcl_app implementation.
      method get_data.
        select * into table it001 from t001.
      endmethod.
      method write_data.
        loop at it001 into xt001.
          write:/ xt001-bukrs, xt001-butxt.
        endloop..
      endmethod.
    endclass.
    REgards,
    Rich Heilman

  • Best way to concatenate with a ; in dynamic internal table

    I have dynamic internal table, i need to concatenate each field with a semi colon (
    The following is the code i have written , is any better approach to this
    report zaRs
      no standard page heading line-size 255.
    data : wa_itab      type yctcgsa_out. 
    data : i_itab       type standard table of wa_itab.
    data : i_details    type abap_compdescr_tab.
    data : i_ref_descr  type ref to cl_abap_structdescr.
    i_ref_descr ?= cl_abap_typedescr=>describe_by_data( i_itab ). " Here i_itab is dynamic int table
    i_details[] = i_ref_descr->components[].
    data: output(900) type c.
    data: value(51) type c.
    loop at i_itab into wa_itab.
      loop at i_details.
        assign component sy-tabix of structure <wa_itab> to <fs>.
        condense <fs> no-gaps.
        concatenamte <fs> ';' into value.
        condense value no-gaps.
        v_len = strlen( value ).
        move value to output+v_pos(v_len).
        v_pos = v_pos + v_len.
      endloop.
      move output to i_putput.
      append i_output.
      clear : v_pos, v_len, output, value.
    endloop.

    Hello,
    2/other solution:
    Create a dynamic structure with 2n fields where n is the number of fields i_tab. The structure of this table will be:
    field 1          : Field n°1 of i_tab
    field 2         : one character field  named SEP0001
    field 3         : Field n°2 of i_tab
    field 4         : one character field  named SEP0002
    field 2n - 1: Field n°n of i_tab
    field 2n         : one character field  named SEP000n
    Create a dynamic structure with n fields. this structure will be defined as follow:
    field 1          :one character field  named SEP0001
    field 2          :one character field  named SEP0002
    field n          :one character field  named SEP000n
    For example, we have the below report. This report does not explain how to create dynamic structures wa_sep and wa_itab_sep.
    report zaRs
      no standard page heading line-size 255.
    TYPES:
      BEGIN OF ywa_itab,
         field1 type vbeln,
         field2 type vbeln,
      END   OF ywa_tab,
      BEGIN OF ywa_sep,
         sep0001 type char1,
         sep0002 type char1,
      END   OF ywa_sep,
      BEGIN OF ywa_itab_sep,
         field1  type ywa_itab-field1,
         sep0001 type ywa_sep-sep0001,
         field2  type ywa_itab-field2,
         sep0002 type ywa_sep-sep0002,
      END   OF ywa_itab_sep.
    data : wa_itab      type ywa_itab. 
    data : i_itab       type standard table of wa_itab.
    data : wa_sep       type ywa_sep.
    data : wa_itab_sep  type ywa_itab_sep.
    data: output(900) type c.
    data: value(51) type c.
    *init all fields of wa_sep with ';'
      DO.
        assign component sy-tabix of structure wa_sep to <fs>.
        IF  sy-subrc IS INITIAL. EXIT. ENDIF.
        MOVE ';'   TO <fs>.
      EnDDo.
    loop at i_itab into wa_itab.
      move-correponsding wa_itab to wa_itab_sep.
      move-correponsding wa_sep  to wa_itab_sep.
      move wa_itab_sep           to i_output.
      append  i_output             to output.
    endloop.
    This report does not explain how to create dynamic structures wa_sep and wa_itab_sep.
    Cordialement,
    Chaouki.
    Edited by: Chaouki AKIR on Jun 12, 2009 1:18 AM

Maybe you are looking for

  • My wifi only ipad does not find my new address since moving house

    i moved house 5 months ago but Google Maps and Google Earth show my current location as my old address.  Is there a way to resolve this problem?

  • Can I use a Nokia N80 as a modem for my G4 PowerBook?

    I'm about to spend a month in Italy and will take my G4 PowerBook with me. I need to buy a new mobile phone and thought that if I buy the Nokia N80 Internet Edition I can also use it as a modem for my PowerBook and connect using UMTS or EDGE. I alrea

  • WLM 2.5.69 Unexpected Server Error

    I have this error on my Torch 9800. I sign in with my messenger account (eg. [email protected]) and I can login fine, I can chat fine, but suddenly the app logout and appear a message "Unexpected Server Error. Please try again later." The strange thi

  • Column alias error in a query of views

    Hi I was trying to workout this query create view dept_sal as select d.department_name,sum(e.salary) from departments d left outer join employees e on d.department_id= e.department_id group by d.department_name; and i recieved this error message ....

  • If I Order By Count, no data displayed

    Hi! I'm using JDeveloper 11g Release 2 (11.1.2.3.0). I create a VO with SQL Query DataSource. The Query is the follwing one: SELECT COUNT (*),          Brand.BRA_NAME,          Model.MOD_NAME FROM Sale,          Car,          Brand,          Model WH