Dynamic ALV: but with globally available dynamic table type

Hello,
I would like to create a dynamic node for a ALV and dynamic table types to fill and the ALV.
The ALV data can be changed so I need to read it again.
I have read all the threads about dynamic node create and i have no problem with it. I can create a structure and a table dynamically. thats also no issue for me.
But. I fill the ALV data in a method and read it in another method to save the changes in a data base table.
Thats also no problem
So where i need your help? I currently create the dynamic table and structure in both methods. That works, but why do the same thing twice?
I cant figure out by myself how to create a dynamic table/structure in a global way, so the dynamic table/structure is created once and then available in the whole WD4A view.
I tried is with a class type in se24 with reference to CL_ABAP_STRUCTDESCR but I cant make that run, because to access the type I created an attribute in se24 with reference to the class type that I now try in instance and fill in the method. But ABAP thinks that my attribute is not compatible anymore.
Any idea how to make a dynamic table globally available? That must be an ABAP god who can answer this question, hehe. So imagin me falling on my knees for the one who has an answer that really works
Kind regards,
Hendrik

This doesn't seem too difficult really. For a dynamic table you just need to declare the internal table as TYPE REF TO DATA.
Just more this declaration to the attributes of your Component Controller. So for instance in my component controller I have an attribute called i_data with the RefTo column checked and the associated type = DATA.
So now I could do the following:
  create data wd_this->idata type table of (tablename).
Or however you are dynamically creating the table - maybe with TYPE HANDLE instead.
The point is that your dynamic table is now global to your entire component and you can read and write to it from different methods.
Is this what you were looking for?  Without knowing more about your existing coding, it is difficult to say more.

Similar Messages

  • Create Structure with dynamical Table-Type

    Hi experts,
    is there a possibility, to create a structure via SE11 and including there a field which referes to a dynamic table-type.
    So that I can append to this structure-field all different table-types?
    for example: ones I append MARA[] and ones AFKO[]
    Thx for help

    Hi Christian,
    There's not predefined generic type to do that, but you could create your own field type (deep structure) which would be able to keep table lines after transposition (90 degree flip) where in example it would have four columns: Table type, row id(index) field name, value. That way you could store ANY table row you need... This will not come cheap and will involve some work of course.
    You may want have a look at standard ABAP services RRTS and RTTI (see classes and structures used in attributes an parameters) - these are two services for handling data types and metadata related operations during runtime. You may want to use them for flipping your table entries to the tabular form and so on. You may also find some ideas there on how to compose your own data type for your purposes.
    Good luck!
    Marcin

  • Dynamic table type

    Hi folks,
    Is there any generic data type for table declaration, beside :
    data: lt_generic type table of data 
    I know that field-symbols can have the generic table type any
    field-symbols: <lft_generic> type any table. 
    I basically want to be able to read from generic tables.
    READ TABLE lt_generic .... 
    Thanks
    Andreas

    Hi Neil,
    actually i want to execute a read on the dynamic created tabel.
    Maybe this repot explains my purpose.
    REPORT  ztc_dqm_dynamic.
    * Step 1: << local definitions >>
    " << variables >>
    " << error string >>
    DATA: lv_error TYPE string.
    " << struc >>
    " << holds one component >>
    DATA: ls_component TYPE
          cl_abap_structdescr=>component.
    " << table >>
    DATA: lt_component TYPE cl_abap_structdescr=>component_table.
    DATA: lt_db_indexfields TYPE TABLE OF ztcc_dqm_indices.
    " << dynamic >>
    " << generated struc >>
    DATA: ls_dystruc TYPE REF TO data.
    " << generated table >>
    DATA: lt_dytable TYPE REF TO data.
    " << field symbols >>
    FIELD-SYMBOLS: <lfs_indexfields> TYPE ANY TABLE.
    FIELD-SYMBOLS: <lfs_indexfield> TYPE ANY.
    FIELD-SYMBOLS: <lfs_db_indexfields> TYPE ztcc_dqm_indices.
    " << objects >>
    DATA: lr_struc_type TYPE REF TO cl_abap_structdescr.
    DATA: lr_table_type TYPE REF TO cl_abap_tabledescr.
    " << exception >>
    DATA: lr_ex TYPE REF TO cx_sy_type_creation.
    * Step 2: << dynamic struc >>
    " << set struc fields >>
    SELECT *
      FROM ztcc_dqm_indices
        INTO TABLE lt_db_indexfields
          WHERE addr_type EQ 1
            ORDER BY index_order.
    " << get types >>
    LOOP AT lt_db_indexfields ASSIGNING <lfs_db_indexfields>.
      ls_component-name =
        <lfs_db_indexfields>-fieldname.
      ls_component-type ?=
         cl_abap_datadescr=>describe_by_name( <lfs_db_indexfields>-fieldtype ).
      APPEND ls_component TO lt_component.
    ENDLOOP.
    " << create struc >>
    TRY.
        CALL METHOD cl_abap_structdescr=>create
          EXPORTING
            p_components = lt_component
            p_strict     = abap_true
          RECEIVING
            p_result     = lr_struc_type.
      CATCH cx_sy_struct_creation INTO lr_ex.
        CALL METHOD lr_ex->if_message~get_text
          RECEIVING
            result = lv_error.
        WRITE: / lv_error.
    ENDTRY.
    " << create table >>
    TRY.
        CALL METHOD cl_abap_tabledescr=>create
          EXPORTING
            p_line_type        = lr_struc_type
    *        p_table_kind       = tablekind_std
    *        p_unique           = abap_false
    *        p_key              = p_key_kind
    *        keydefkind_default =
          RECEIVING
            p_result           = lr_table_type.
      CATCH cx_sy_table_creation INTO lr_ex.
        CALL METHOD lr_ex->if_message~get_text
          RECEIVING
            result = lv_error.
        WRITE: / lv_error.
    ENDTRY.
    " << create attributs >>
    CREATE DATA: ls_dystruc TYPE HANDLE lr_struc_type.
    CREATE DATA: lt_dytable TYPE HANDLE lr_table_type.
    * Step 3: << dynamic assignment >>
    ASSIGN lt_dytable->* TO <lfs_indexfields>.
    ASSIGN ls_dystruc->* TO <lfs_indexfield>.
    " << this works >>
    LOOP AT <lfs_indexfields> ASSIGNING <lfs_indexfield>.
    ENDLOOP.
    " << i want >>
    READ TABLE lt_dytable
      INTO ls_dystruc
        WITH KEY .....

  • Dynamic table type generation at runtime

    Hi,
    Is there any way by which I can generate the table types at runtime.
    I am fetching table_name from all_tables and according to the table_name fetched from all_tables, I want to generate a table type for the same (eg. some thing like mentioned below) :
    TYPE v_tablename(int_tablecounter)||'_typ' IS TABLE OF v_tablename(int_tablecounter)%ROWTYPE INDEX BY BINARY_INTEGER
    thanks,
    aks

    Hello aks,
    did you try
      1  Declare
      2    v_CNT   NUMBER       := 1;
      3    v_TABLE VARCHAR2(30) := 'TEST';
      4    v_STMT  VARCHAR2(500);
      5  Begin
      6    v_STMT := ' DECLARE '||
      7              '   TYPE TAB'||v_CNT||' IS TABLE OF '||v_TABLE||'%ROWTYPE INDEX BY PLS_INTEGER;'||
      8              '   v_TAB'||v_CNT||' TAB'||v_CNT||';'||
      9              ' BEGIN'||
    10              '   v_TAB'||v_CNT||'(1).ID   := 1;'||
    11              '   v_TAB'||v_CNT||'(1).COL  := ''TEST'';'||
    12              '   P.L ( v_TAB'||v_CNT||'(1).COL );'||
    13              ' END;';
    14    EXECUTE IMMEDIATE v_STMT;
    15* End;
    bprechtl@DEV01>
    bprechtl@DEV01> /
    TEST
    PL/SQL-Prozedur wurde erfolgreich abgeschlossen.
    bprechtl@DEV01>And did you like it? ;-)
    Bernd

  • Block with more than one table type agurment -  Update Procedure for Block

    Hi,
    I have one form with 3 Block. First Block is single row block, and other 2 are details block . The details balocks are based on the Procedure datasource, because of the complex query conditions. Now my requirement is When Inserting / Updating the Master Block (Single Row Block), I need to get the values in the two details block , because I need to update some other tables also based on these values. I created a procedure with two Table Type parameters (for each details block) , but when I using this procedure as the Update Procedure Name in the block, I am getting the error Only One table type arguement is allowed. Is there any other method to implement this.
    Thanks in advance.

    Rizly,
    A quick summary to make sure I understand your requirements. You have a single row base table master block with two detail blocks that are based on Procedures. When you update the single row base table master block, you need all of the data in the two procedure based detail blocks as there are updates that you have to perform to other tables that use this data. You have created a stored procedure that take two PL/SQL tables as parameters, but you are getting the error that only 1 table parameter is allowed.
    I need to ask you a few questions first. What is your Forms version? The stored procedure you created; are you using this procedure in the "On-Insert, On-Update, On-Delete" triggers or do you call the procedure in one of the Base Table block ("Key-Commit, When-Button-Pressed" or other trigger)? When you modify or add a new Master block record are you adding values to the detail blocks or using values from the previous Master block record?
    If you are using your procedure in the On-Insert, On-Update or On-Delete trigger(s), then based on your description, the error you are receiving is correct. The "On-..." triggers are constrained in that their procedures expect only a single PL/SQL table, Table of Records or Ref Cursor as a parameter. This is a Forms constraint - not a PL/SQL constraint as Forms is expecting you to only perform actions on the block where the "On-..." Trigger is located.
    Perhaps you should consider creating a database Package that has two package specification constructs (Ref Cursor, Table of Records, etc) you can populate from Forms and then simply call the package procedure that will use the Ref Cursors to perform the needed update or inserts.
    Hope this helps.
    Craig...
    If mine or someone elses response was helpful, please mark it accordingly

  • ALV list with count of the table

    Dear all,
    My requirement is i want display the output as alv list along with the count of the table .
    i got the count  but unable to diplay the  below the list.
    please suggest me.
    Thanks& Regards,
    RP

    If you are using a custom control on the screen and then a custom container you can easily do this.
    Create a screen(Size 200 x 240), place a custom control on the screen and make it to the max size  200 x 240. Now in the attributes of the custom control, check the Resizing option for both horizontal and vertical, with some minimum numbers there.
    Now, your ALV grid automatically occupies all the space available on the screen irrespective of the size if the screen and you will have only one scroll bar.
    Regards,
    Ravi
    Note - Please mark all the helpful answers

  • HT201364 I have a Power Mac G# B&W, 400 Mhz, Igh mem. I have installed OS X Leopard on it. It request I install OS 9.1 classic to accommodate the classic programs. I have serveral OS 9.1 install and restrore disk. I have tried several but with no avail. I

    I have a power mac G3, B&W, 400 Ghz. 1gHz mem. I have installed OS 10, It says I may install OS 9.1 later. I have 9.1 installation and restore disk at my disposal. Which do I use and  how can I install updated firmware before installation? I have tried ti install OS 9.1 but I keep getting the error messege "my firmware is out of date". What am I doing wrong. Please help me!

    Technically it can't without a special software known as LeopardAssist.
    The firmware required is here:
    Power Macintosh G3 (Blue and White) Firmware Update 1.1
    Power Macintosh G3 (Blue and White) with SCSI (I could not find, remove any SCSI card before using Tiger or Leopard)
    The installer disk must look like:
    http://www.thebookyard.com/images/OSX9DISK.jpg
    And not say Upgrade, Dropin, a Mac model, or OEM.  Once you have 9, you can get 9.0.4, 9.1, and 9.2.2 updates through the iinet link mentioned earlier.
    Firmware updates and other OS 9 updates are on the following links for reference, but the iinet is where the downloads are still available.
    http://support.apple.com/kb/HT1395
    https://discussions.apple.com/docs/DOC-2751

  • How to pass values in dynamic structure and then dynamic table

    Hi,
    we have a Z structure in se11 holding 10 fields. But at run time i need to create a dynamic table with more than 10 records.
    I am able to create the structure and corresponding internal table. Now the issue is i have to populate this dynamic structure with some values and then append it to dynamic internal table. Since the dynamic  table type is any its not allowing an index operation like modify etc etc.
    Could anyone help me in passing the values . I have searched in SDN . everyone created a dynamic table and then populated it values from some standard or custom tables.Then assigning the component of structure  and displaying the output. but in my situation i have no such values stored in any tables. i populate values based on certain calculation.

    Hi Friends,
    This is the piece of code.After creating dynamic work area and dynamic table what i should do?
    TYPES: BEGIN OF STR,
    ID TYPE I,
    NAME(30) TYPE C,
    END OF STR.
    data: v_lines type i.
    STR_TYPE ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( 'STR' ).
    STR_COMP = STR_TYPE->GET_COMPONENTS( ).
    APPEND LINES OF STR_COMP TO COMP_TAB.
    COMP-NAME = 'NAME1'.
    COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING(  ).
    APPEND COMP TO COMP_TAB.
    COMP-NAME = 'VALUE1'.
    COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
    APPEND COMP TO COMP_TAB.
    COMP-NAME = 'NAME2'.
    COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
    APPEND COMP TO COMP_TAB.
    COMP-NAME = 'VALUE2'.
    COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
    APPEND COMP TO COMP_TAB.
    COMP-NAME = 'NAME3'.
    COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
    APPEND COMP TO COMP_TAB.
    COMP-NAME = 'VALUE3'.
    COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
    APPEND COMP TO COMP_TAB.
    NEW_STR = CL_ABAP_STRUCTDESCR=>CREATE( COMP_TAB ).
    NEW_TAB = CL_ABAP_TABLEDESCR=>CREATE(
    P_LINE_TYPE = NEW_STR
    P_TABLE_KIND = CL_ABAP_TABLEDESCR=>TABLEKIND_STD
    P_UNIQUE = ABAP_FALSE ).
    CREATE DATA DREF TYPE HANDLE NEW_TAB.
    CREATE DATA DREF1 TYPE HANDLE NEW_str.

  • Dynamic Table - Deep Structure

    Hi Gurus,
    this is my first posting, so be patient!
    I want to create a deep structure dynamic table via method
    cl_alv_table_create=>create_dynamic_table, is this possible? Are there tricks to make it happen?
    Background: i wanna create an alv with dynamic fieldcatalalog, in this case i want to colour special fields, which is done by lvc_s_layo-?csp_fieldname? in combination with a field in my internal table which is typed ?lvc_t_scol?. Is this possible under 6.2.43
    thanxs for your replies
    juergen
    - ?i dont actually know by rote the correct fieldnames of lvc_xxxxx?

    Hi Jurgen, I took on the challenge.  This program provides a dynamic table with the ability to set the colors of the cells.
    Create the structure ZCDF_CELL_COLOR in the dictionary as described in the program.
    Create screen 100 as empty, with next screen set to 0, and the following flow logic:
    PROCESS BEFORE OUTPUT.
      MODULE initialization.
    PROCESS AFTER INPUT.
    REPORT  zcdf_dynamic_table.
    * Dynamic ALV Grid with Cell Coloring
    DATA:
      r_dyn_table      TYPE REF TO data,
      r_wa_dyn_table   TYPE REF TO data,
      r_dock_ctnr      TYPE REF TO cl_gui_docking_container,
      r_alv_grid       TYPE REF TO cl_gui_alv_grid,
      t_fieldcat1      TYPE lvc_t_fcat, "with cell color
      t_fieldcat2      TYPE lvc_t_fcat, "without cell color
      wa_fieldcat      LIKE LINE OF t_fieldcat1,
      wa_cellcolors    TYPE LINE OF lvc_t_scol,
      wa_is_layout     TYPE lvc_s_layo.
    FIELD-SYMBOLS:
      <t_dyn_table>    TYPE STANDARD TABLE,
      <wa_dyn_table>   TYPE ANY,
      <t_cellcolors>   TYPE lvc_t_scol,
      <w_field>        TYPE ANY.
    START-OF-SELECTION.
    * Build field catalog based on your criteria.
      wa_fieldcat-fieldname = 'FIELD1'.
      wa_fieldcat-inttype   = 'C'.
      wa_fieldcat-outputlen = '10'.
      wa_fieldcat-coltext   = 'My Field 1'.
      wa_fieldcat-seltext   = wa_fieldcat-coltext.
      APPEND wa_fieldcat TO t_fieldcat1.
      wa_fieldcat-fieldname = 'FIELD2'.
      wa_fieldcat-inttype   = 'C'.
      wa_fieldcat-outputlen = '10'.
      wa_fieldcat-coltext   = 'My Field 2'.
      wa_fieldcat-seltext   = wa_fieldcat-coltext.
      APPEND wa_fieldcat TO t_fieldcat1.
    * Before adding cell color table,
    *  save fieldcatalog to pass
    *  to ALV call.
      t_fieldcat2[] = t_fieldcat1[].
    * Add cell color table.
    *  ZCDF_CELL_COLOR is a structure in the
    *   dictionary with one
    *   field called T_CELL_COLOR of type LVC_T_SCOL.
      wa_fieldcat-fieldname = 'T_CELLCOLORS'.
      wa_fieldcat-ref_field = 'T_CELL_COLOR'.
      wa_fieldcat-ref_table = 'ZCDF_CELL_COLOR'.
      APPEND wa_fieldcat TO t_fieldcat1.
    * Create dynamic table.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = t_fieldcat1
        IMPORTING
          ep_table                  = r_dyn_table
        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.
    * Get access to new table using field symbol.
      ASSIGN r_dyn_table->* TO <t_dyn_table>.
    * Create work area for new table.
      CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.
    * Get access to new work area using field symbol.
      ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.
    * Get data into table from somewhere.  Field names are
    *  known at this point because field catalog is already
    *  built.  Read field names from the field catalog or use
    *  COMPONENT <number> in a DO loop to access the fields. 
    *  A simpler hard coded approach is used here.
      ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table>
        TO <w_field>.
      <w_field> = 'ABC'.
      ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table>
        TO <w_field>.
      <w_field> = 'XYZ'.
      APPEND <wa_dyn_table> TO <t_dyn_table>.
      ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table>
        TO <w_field>.
      <w_field> = 'TUV'.
      ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table>
        TO <w_field>.
      <w_field> = 'DEF'.
      APPEND <wa_dyn_table> TO <t_dyn_table>.
    * Color cells based on your criteria. 
    *  In this example, a test on
    *  FIELD2 is used to decide on color.
      LOOP AT <t_dyn_table> INTO <wa_dyn_table>.
        ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table>
          TO <w_field>.
        ASSIGN COMPONENT 'T_CELLCOLORS'
          OF STRUCTURE <wa_dyn_table> TO <t_cellcolors>.
        CLEAR wa_cellcolors.
        wa_cellcolors-fname     = 'FIELD2'.
        IF <w_field> = 'DEF'.
          wa_cellcolors-color-col = '7'.
        ELSE.
          wa_cellcolors-color-col = '5'.
        ENDIF.
        APPEND wa_cellcolors TO <t_cellcolors>.
        MODIFY <t_dyn_table> FROM <wa_dyn_table>.
      ENDLOOP.
      CALL SCREEN 100.
    *  MODULE initialization OUTPUT
    MODULE initialization OUTPUT.
    * Set up for ALV display.
      IF r_dock_ctnr IS INITIAL.
        CREATE OBJECT r_dock_ctnr
               EXPORTING
                  side  =  
                    cl_gui_docking_container=>dock_at_left
                  ratio = '90'.
        CREATE OBJECT r_alv_grid
               EXPORTING i_parent = r_dock_ctnr.
    *   Set ALV controls.
        wa_is_layout-ctab_fname = 'T_CELLCOLORS'.
    *   Display.
        CALL METHOD r_alv_grid->set_table_for_first_display
          EXPORTING
            is_layout       = wa_is_layout
          CHANGING
            it_outtab       = <t_dyn_table>
            it_fieldcatalog = t_fieldcat2.
      ELSE.     "grids already prepared
    *   Refresh display.
        CALL METHOD r_alv_grid->refresh_table_display
          EXPORTING
            i_soft_refresh = ' '
          EXCEPTIONS
            finished       = 1
            OTHERS         = 2.
      ENDIF.
    ENDMODULE.                 " initialization  OUTPUT

  • How to setup Business Group with Global Legislation?

    Hi All,
    We are exploring possibility of creating International Business Group with no Legislation Code for our client. The client has operations in multiple geographies.
    I found following document in Metalink
    How an International Business Group be created with no Legislation Code? [Doc ID 851711.1] It mentions "Global legislation must be installed in order to set up a Global Business Group. The business group is created just like any other, but with Global legislation selected. You will need to use Global responsibilities to access it."
    When we tried to create a business group with Legislation Code as 'Global" we did not find any such Legislation Code in dropdown of *Business Group Info classification.
    Has anybody implemented Global Legislation before? Any information on Setup Steps, Challenges faced, bugs and issues faced with other modules especially OTL would be appreciated.
    Thanks in Advance,
    Amit
    Edited by: user10450466 on Jan 22, 2010 12:23 AM

    I wasn't aware there's any such thing as 'Global Legislation' in HRMS and I think the Metalink Note you mention is misleading. There are multiple concepts here being mixed up.
    hrglobal and Data Installer
    Oracle deliver legislative seed data through hrglobal and Data Installer. When a DBA runs this they pick the legislations they wish to install. That includes legislations such as US, GB and all legislations where Oracle HRMS deliver seed data (Fast Formulas, balances, etc). One of the options here is 'Global', which ensures that common seed data used across multiple legislations is installed. This process does not create new legislations - it just creates the seed data used by those legislations. 'Global' is not a legislation - it just means that the relevant seed data (Fast Formula, balances, etc) is typically delivered without the legislation_code column being populated.
    Business Groups and Legislations
    A Business Group is intrinsically tied to a Legislation Code - they have a one-to-one relationship. When you define a Business Group you have to pick a Legislation and that list of Legislations comes from fnd_territories_vl. The list in fnd_territories_vl has nothing to do with hrglobal or Data Installer. There is no 'global' territory.
    International HR & Payroll
    If you are implementing HRMS in a country where Oracle HRMS do not deliver any specific legislative seed data or functionality (ie, the legislation isn't listed in Data Installer) you have the option of using International HR & Payroll. This allows you to install generic seed data into the legislation of your choice, which is again a list from fnd_territories_vl. Again, there's no concept of 'global' legislation. Information on that is available here:
    International HR and Payroll [ID 261452.1]
    International Implementations
    Customers, like yours, who are rolling out Oracle HRMS to multiple countries have a big choice to make: single or multi Business Group. If you opt for one Business Group you create employees in multiple countries all within the same Business Group. That Business Group is tied to just one of those country's legislation codes - which you go for is up to you but that's generally the Legislation Code of the International HQ. The problem with this approach is that you can't leverage the legislative-specific functionality for each of the other countries.
    If you opt for multi-Business Group you typically define one Business Group for each country so that you leverage the legislative-specific functionality for each country. This is generally more popular but doesn't suit everyone: you can have problems with employees transferring from one country to another, etc.
    Global Structures
    Oracle HRMS has forced you to tie a Business Group to a legislation code for many years. As mentioned above, this causes a number of problems. To mitigate those, Oracle have delivered a number of enhancements that help you model global businesses:
    1. Global Organization Hierarchies
    2. Global Security Profiles
    3. Global Overseas Deployment functionality (nickname GOD/GOLD)
    4. Cross Business Group profile option
    5. etc
    I hope that helps.

  • Sort/filter datablock based on procedure that return table type

    Hi All,
    I’ve got datablock based on procedure that return table type. In the form I have to provide ‘filter and sort records’ functionality. Previously, using tables/views based datablocks, I’ve done that by using:
    -- filter
    SET_BLOCK_PROPERTY (L_BLOCK_NAME, DEFAULT_WHERE, L_WHERE_CLAUSE);
    -- sort
    SET_BLOCK_PROPERTY(L_BLOCK_NAME ,ORDER_BY, L_ORDER_BY_CLAUSE);
    -- and then
    EXECUTE_QUERY;
    It doesn’t work with procedure that return table type. How I can do that?
    Bartek

    I agree with Andreas, from the sample you have given us, I don't see any reason why you could not merge these queries into a single UNION/UNION ALL query. Also, I would add your summation query to your main query to eliminate this extra step. The result would look something like:
    SELECT DISTINCT
         pih.id
         ,d.document_id
         ,pih.doc_serial_no
         ,pih.purch_invoice_date
         ,oh.company_name
         ,(SELECT NVL(SUM(amount),0)
              FROM "YOUR TABLE HERE" yth
              WHERE yth."YOUR COLUMN HERE" = pih.id) AS sum_amount
      FROM "YOUR TABLES HERE"
    WHERE "YOUR JOIN CONDITIONS HERE"
    UNION ALL
    SELECT DISTINCT
         sih.id
         ,d.document_ind
         ,sih.doc_serial_no
         ,sih.sales_invoice_date
         ,sih.company_name
         ,(SELECT NVL(SUM(amount),0)
              FROM "YOUR TABLE HERE" yth
              WHERE yth."YOUR COLUMN HERE" = sih.id) AS sum_amount
      FROM "YOUR TABLES HERE"
    WHERE "YOUR JOIN CONDITIONS HERE"
    [/code]
    Hope this helps.
    Craig...
    +If a response is helpful or correct, please mark it accordingly+
    Edited by: CraigB on Feb 23, 2010 1:39 PM
    It appears the CODE tags are not working as well as the URL tags.  :(                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Definitions of record and table type

    I’m confused with the definition of record and table type. Below is my understanding, Please correct me if anything wrong. Thanks in advance!
    Record type can only hold one record with multiple fields.
    Table type is an array (multiple records) with only one field
    Table type defined with %rowtype (table of records) is an array of multiple records with multiple fields.

    I am not sure that I understand what you are asking. I have not heard the term table type before.
    However, I think a record type is more closely aligned to the %rowtype declaration. Maybe a collection is what you are looking for with the term table type.
    From the Oracle 10g documentation:
    %ROWTYPE
    In PL/SQL, records are used to group data. A record consists of a number of related fields in which data values can be stored. The %ROWTYPE attribute provides a record type that represents a row in a table. The record can store an entire row of data selected from the table or fetched from a cursor or cursor variable.
    Columns in a row and corresponding fields in a record have the same names and datatypes. In the example below, you declare a record named dept_rec. Its fields have the same names and datatypes as the columns in the dept table.
    DECLARE
    dept_rec dept%ROWTYPE; -- declare record variable

  • Here's how to do ALV (OO) with dynamic fcat, int table and editable data

    Hi everybody
    Here's a more useful approach to ALV grid with OO using dynamic table, data NOT from DDIC, dynamic FCAT and how to get changed lines from the grid when ENTER key is pressed.
    It's really not too dificult but I think this is more useful than the ever present SFLIGHT methods from the demos.
    This also defines a subclass of cl_gui_alv_grid so you can access the protected attributes / methods of that class.
    You don't need to add the class via SE24 -- done fron this ABAP.
    When you run it click Edit for the first time.
    After editing data press ENTER and the break point should bring you into the relevant method.
    Code developed on NW2004S trial version but also works on rel 6.40 on a "Real" system.
    The code should work without any changes on any system >=6.40.
    All you need to do is to create a blank screen 100 via SE51  with a custom container on it called CCONTAINER1.
    The rest of the code can just be uploaded into your system using the SE38 upload facility.
    When running the program click on the EDIT button to enable the edit functionality of the grid.
    Change your data and when you press ENTER you should get the break-point where you can see the original table and changed rows.
    This program is actually quite general as it covers Dynamic tables, building a dynamic fcat where your table fields are NOT in the DDIC, intercepting the ENTER key via using an event, and accessing the protected attributes of the cl_gui_alv_grid by defining a subclass of this class in the abap.
    I've seen various questions relating to all these functions but none in my view ever answers the questions in a simple manner. I hope this simple program will answer all these and show how using OO ALV is actually quite easy and people shouldn't be scared of using OO.
    Have fun and award points if useful.
    Cheers
    Jimbo.
    <b>PROGRAM zdynfieldcat.
    Simple test of dynamic ITAB with user defined (not ddic) fields
    Build dynamic fcat
    use ALV grid to display and edit.
    *When edit mode set to 1 toolbar gives possibility of adding and
    *deleting rows.
    *Define subclass of cl_gui_alv_grid so we can use protected attributes
    *and methods.
    Add event handler to intercept user entering data and pressing the
    *ENTER key.
    When enter key is pressed get actual value of NEW table (all rows)
    rather than just the changed data.
    *use new RTTI functionality to retrieve internal table structure
    *details.
    Create a blank screen 100  with a custom container called CCONTAINER1.
    James Hawthorne
    include <icon>.
    define  any old internal structure  NOT in DDIC
    types: begin of s_elements,
           anyfield1(20) type c,
           anyfield2(20) type c,
           anyfield3(20) type c,
           anyfield4(20) type c,
           anyfield5(11) type n,
           end of s_elements.
    types:  lt_rows  type lvc_t_roid.
    Note new RTTI functionality allows field detail retrieval
    at runtime for dynamic tables.
    data:   wa_element type s_elements ,
            wa_data type s_elements,
            c_index type sy-index,
            c_dec2 type s_elements-anyfield5,
            wa_it_fldcat type lvc_s_fcat,
            it_fldcat type lvc_t_fcat,
            lr_rtti_struc TYPE REF TO cl_abap_structdescr,    "RTTI
            lt_comp TYPE cl_abap_structdescr=>component_table,"RTTI
            ls_comp LIKE LINE OF lt_comp,                     "RTTI
            zog  like line of lr_rtti_struc->components,      "RTTI
            struct_grid_lset type lvc_s_layo,
            l_valid  type c,
            new_table type ref to data.
    field-symbols: <dyn_table> type standard table,
                   <actual_tab> type standard table,
                   <fs1> type ANY,
                   <FS2> TYPE TABLE.
    data: grid_container1 type ref to cl_gui_custom_container.
    class lcl_grid_event_receiver definition deferred.
    data: g_event_receiver type ref to lcl_grid_event_receiver.
    data: ls_modcell type LVC_S_MODI,
          stab type ref to data,
          sdog type  s_elements.      .
    class lcl_grid_event_receiver definition.
      public section.
        methods:
        handle_data_changed
             for event data_changed of cl_gui_alv_grid
                 importing er_data_changed,
           toolbar for event toolbar of cl_gui_alv_grid
                     importing e_object
                               e_interactive,
          user_command for event user_command of cl_gui_alv_grid
                     importing e_ucomm.
    endclass.
    *implementation of Grid event-handler class
    class lcl_grid_event_receiver implementation.
    method handle_data_changed.
    code whatever required after data entry.
    various possibilites here as you can get back Cell(s) changed
    columns or the entire updated table.
    Data validation is also possible here.
    perform check_data using er_data_changed.
    endmethod.
    Method for handling all creation/modification calls to the toolbar
      method toolbar.
        data : ls_toolbar type stb_button.
    Define Custom Button in the toolbar
        clear ls_toolbar.
        move 0 to ls_toolbar-butn_type.
        move 'EDIT' to ls_toolbar-function.
        move space to ls_toolbar-disabled.
        move 'Edit' to ls_toolbar-text.
        move icon_change_text to ls_toolbar-icon.
        move 'Click2Edit' to ls_toolbar-quickinfo.
        append ls_toolbar to e_object->mt_toolbar.
        clear ls_toolbar.
        move 0 to ls_toolbar-butn_type.
        move 'UPDA' to ls_toolbar-function.
        move space to ls_toolbar-disabled.
        move 'Update' to ls_toolbar-text.
        move icon_system_save to ls_toolbar-icon.
        move 'Click2Update' to ls_toolbar-quickinfo.
        append ls_toolbar to e_object->mt_toolbar.
        clear ls_toolbar.
        move 0 to ls_toolbar-butn_type.
        move 'EXIT' to ls_toolbar-function.
        move space to ls_toolbar-disabled.
        move 'Exit' to ls_toolbar-text.
        move icon_system_end to ls_toolbar-icon.
        move 'Click2Exit' to ls_toolbar-quickinfo.
        append ls_toolbar to e_object->mt_toolbar.
      endmethod.
      method user_command.
        case e_ucomm .
          when 'EDIT'.          "From Tool bar
            perform set_input.
             perform init_grid.
          when 'UPDA'.          "From Tool bar
            perform refresh_disp.
            perform update_table.
          when 'EXIT'.          "From Tool bar
            leave program.
        endcase.
      endmethod.
    endclass.
    class zcltest definition inheriting from  cl_gui_alv_grid.
    define this as a subclass so we can access the protected attributes
    of the superclass cl_gui_alv_grid
    public section.
    methods: constructor, disp_tab.
    endclass.
    need this now to instantiate object
    as we are using subclass rather than the main cl_gui_alv_grid.
    class zcltest implementation.
    METHOD constructor.
    CALL METHOD super->constructor
            exporting i_appl_events = 'X'
               i_parent = grid_container1.
    endmethod.
    method disp_tab.
    FIELD-SYMBOLS: <outtab> TYPE STANDARD TABLE.
    break-point 1.
    mt_outtab is the data table held as a protected attribute
    in class cl_gui_alv_grid.
    ASSIGN me->mt_outtab->* TO <outtab>.  "Original data
    do whatever you want with <outtab>
    contains data BEFORE changes each time.
    Note that NEW (Changed) table has been obtained already by
    call to form check_data USING P_ER_DATA_CHANGED
             TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
    Entered data is in table defined by <fs2>
    In this method you can compare original and changed data.
    Easier than messing around with individual cells.
    do what you want with data in <fs2>  validate / update / merge etc
    endmethod.
    endclass.
    data :
        ok_code like sy-ucomm,
        save_ok like sy-ucomm,
        i4 type int4,
    Container Object [grid_container]
    now created via method constructor
    in the subclass zcltest.
    Control Object [grid]
    grid1 type ref to zcltest,
    Event-Handler Object [grid_handler]
    grid_handler type ref to lcl_grid_event_receiver.
    start-of-selection.
    call screen 100.
    module status_0100 output.
    now display it as grid
    if grid_container1 is initial.
        create object grid_container1
            exporting
              container_name = 'CCONTAINER1'.
        create object grid1.
         break-point 1.
        create object grid_handler.
        set handler:
           grid_handler->user_command for grid1,
           grid_handler->toolbar for grid1,
           grid_handler->handle_data_changed for grid1.
    perform create_dynamic_fcat.
    perform create_dynamic_itab.
    perform populate_dynamic_itab.
    perform init_grid.
    perform register_enter_event.
    set off ready for input initially
    i4 = 0.
      call method grid1->set_ready_for_input
             exporting
               i_ready_for_input = i4.
    endif.
    endmodule.
    module user_command_0100 input.
    *PAI not needed in OO ALV anymore as User Commands are handled as events
    *in method user_command.
    *we can also get control if the Data entered and the ENTER is pressed by
    *raising an event.
    Control then returns to method handle_data_changed.
    endmodule.
    form create_dynamic_fcat.
    get structure of our user table for building field catalog
    Use the RTTI functionality
    lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( wa_data ).
    Build field catalog just use basic data here
    colour specific columns as well
    loop at lr_rtti_struc->components into zog.
    c_index = c_index + 1.
    clear wa_it_fldcat.
      wa_it_fldcat-fieldname = zog-name .
      wa_it_fldcat-datatype =  zog-type_kind.
      wa_it_fldcat-inttype =   zog-type_kind.
      wa_it_fldcat-intlen =    zog-length.
      wa_it_fldcat-decimals =  zog-decimals.
      wa_it_fldcat-lowercase = 'X'.
      if c_index eq 2.
      wa_it_fldcat-emphasize = 'C411'.
         endif.
        if c_index eq 3.
      wa_it_fldcat-emphasize = 'C511'.
       endif.
      append wa_it_fldcat to it_fldcat .
    endloop.
    endform.
    form create_dynamic_itab.
    Create dynamic internal table and assign to field sysmbol.
    Use dynamic field catalog just built.
    call method cl_alv_table_create=>create_dynamic_table
                 exporting
                    it_fieldcatalog = it_fldcat
                 importing
                    ep_table        = new_table.
    assign new_table->* to <dyn_table>.
    endform.
    form populate_dynamic_itab.
    load up a line of the dynamic table
    c_dec2 = c_dec2 + 11.
    wa_element-anyfield1 = 'Tabbies'.
    wa_element-anyfield2 = 'ger.shepards'.
    wa_element-anyfield3  = 'White mice'.
    wa_element-anyfield4 =  'Any old text'.
    wa_element-anyfield5 =  c_dec2.
    append  wa_element to <dyn_table>.
    endform.
    form check_data USING P_ER_DATA_CHANGED
               TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
    Get altered data back
      ASSIGN   p_er_data_changed->mp_mod_rows TO <FS1>.
    stab =       p_er_data_changed->mp_mod_rows.
    ASSIGN STAB->* TO <FS2>.
    LOOP AT <FS2> INTO sdog.
    ALV grid display with altered data is now in <fs2>.
    do any extra processing you want here
    endloop.
    now display new table
    call method grid1->disp_tab.
    endform.
    form exit_program.
      call method grid_container1->free.
      call method cl_gui_cfw=>flush.
      leave program.
    endform.
    form refresh_disp.
      call method grid1->refresh_table_display.
    endform.
    form update_table.
    The dynamic table here is the changed table read from the grid
    after user has changed it
    Data can be saved to DB or whatever.
    loop at <dyn_table> into wa_element.
    do what you want with the data here
    endloop.
    switch off edit mode again for next function
    i4 = 0.
      call method grid1->set_ready_for_input
          exporting
              i_ready_for_input = i4.
    endform.
    form set_input.
    i4 = 1.
      call method grid1->set_ready_for_input
         exporting
           i_ready_for_input = i4.
    endform.
    form switch_input.
    if i4 = 1.
    i4 = 0.
    else.
    i4 = 1.
    endif.
      call method grid1->set_ready_for_input
         exporting
           i_ready_for_input = i4.
    endform.
    form init_grid.
    Enabling the grid to edit mode,
         struct_grid_lset-edit = 'X'. "To enable editing in ALV
         struct_grid_lset-grid_title  = 'Jimbos Test'.
         call method grid1->set_table_for_first_display
           exporting
             is_layout           = struct_grid_lset
           changing
             it_outtab             =  <dyn_table>
             it_fieldcatalog       =  it_fldcat.
    endform.
    form register_enter_event.
    call method grid1->register_edit_event
                   exporting
                      i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    Instantiate the event or it won't work.
    create object g_event_receiver.
    set handler g_event_receiver->handle_data_changed for grid1.
    endform.</b>

    Hi there
    IE7 doesn't give me the add new page option and I get 404 error when trying to access the "How to contribute" section.
    I'll load up Firefox later (this browser usually works when IE7 doesn't always work properly).
    I'll copy the stuff to the wiki when I've got the browser sorted out.
    Cheers
    jimbp

  • WD4A Dynamic ALV Table with dynamic tables

    Hi all,
    first I want give you the information what I try to do.
    I have an another WD4A application for administrative use in which I can assign certain tablefields to a certain user. You can say it's something like a customizing application.
    In the next application (with my issues) I will display the tables for the user, but these tables are not the complete table.
    I have a node in my context of the component controller which is bound to my ALV. I add during the runtime attributes to my node.
    * .... coding ....declaration
    * get the node
      lr_node = wd_context->get_child_node( 'M_TABLE' ).
      lr_node_info ?= lr_node->get_node_info( ).
    * remove the attributes, if exists
      lr_node_info->remove_dynamic_attributes( ).
    * .... coding ....
    *   add attributes
        LOOP AT l_t_m_table INTO l_s_m_table.
          CLEAR ls_attribute.
    *     name of the attribute
          MOVE l_s_m_table-NAME TO ls_attribute-NAME.
    *     DDIC type of the attribute
          MOVE l_s_m_table-TYPE_NAME TO ls_attribute-TYPE_NAME.
    *     If the DDIC has a gen namespace like /B135/ replace the / with _
          REPLACE ALL OCCURRENCES OF '/' IN ls_attribute-NAME WITH '_'.
    *     add the attribute
          lr_node_info->add_attribute( EXPORTING
                                         attribute_info = ls_attribute ).
        ENDLOOP.
    This coding works fine I get the columns in my ALV. Then I tried to fill my ALV table with data from a database table.
    I created dynamicly an internal table with the following coding:
    *   Create dynamic table
        CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
          EXPORTING
            IT_FIELDCATALOG = l_t_FLDCAT
          IMPORTING
            EP_TABLE = l_t_NEW_M_TABLE.
    *   assign the table
        ASSIGN l_t_NEW_M_TABLE->* TO <M_TABLE>.
    *   structure of table
        CREATE DATA l_s_NEW_M_TABLE LIKE LINE OF <M_TABLE>.
        ASSIGN l_s_NEW_M_TABLE->* TO <l_s_m_table>.
    * get data from database
    SELECT * FROM (l_m_table) INTO CORRESPONDING FIELDS OF TABLE <M_table> WHERE OBJVERS = 'A'.
    With this coding I get the data from the database and only the required fields that means I have e.g. an itab with columns1, columns3, columns4 from the database.
    I also added e.g. these columns  (columns1, columns3, columns4 from the database) to the node as attribute. Now it should be possible to bind the table to the structure with this coding:
    lr_comp_usage_m = wd_this->wd_cpuse_usage_alv_M_table( ).
    *   create component if not active
        IF lr_comp_usage_m->has_active_component( ) IS INITIAL.
          lr_comp_usage_m->create_component( ).
        else.
    * set data if node exists
          l_ref_interfacecontroller = wd_this->wd_cpifc_usage_alv_M_table( ).
          l_ref_interfacecontroller->set_data( lr_node ).
        endif.
    *   bind table
        lr_node->bind_table( <M_TABLE> ).
    Now, I get an error, which is caused by the table binding.
    In ST22 I get:
    Short text
        Line types of an internal table and a work area not compatible.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "CL_WDR_CONTEXT_NODE_VAL=======CP" had to be
         terminated because it has
        come across a statement that unfortunately cannot be executed.
    Error analysis
        The statement
           "INSERT wa INTO TABLE itab"
        requires the lines of the internal table "TABLE" and the
        work area " wa" to be compatible. Compatibility means
        equivalence in the context of ABAP/4 type checking.
        In this case, the condition is not satisfied because the internal table
        "TABLE" has the line type "u" and the length 28, but the work area " wa"
        has the type "C" and the length 2.
        (If the work area " wa" is the header line of the internal
        table "TABLE", the above inconsistency can arise if an internal
        table t with the line type T1 is passed to a subroutine (FORM or
        FUNCTION) as an actual parameter and the corresponding formal
        parameter p is declared in the subroutine by "TABLES p STRUCTURE T2".
        If then T1 and T2 are incompatible, the header line p
        has the type T2 (specifed by STRUCTURE), but the internal
        table p has the line type T1 (passed from the actual parameter)).
    Source Code Extract
    Line  SourceCde
        1 method if_wd_context_node~get_static_attributes_table .
        2
        3   field-symbols:
        4     <element> like line of me->collection,
        5     <static_attributes> type data,
        6     <table> type index table.
        7
        8 * check whether elements are supllied or not
        9   if me->elements_supplied = abap_false.
       10     me->supply_elements( ).
       11   endif.
       12
       13   clear table.
       14
       15   if me->table_ref is not initial.
       16     assign me->table_ref->* to <table>.
       17     table = <table>.
       18   else.
       19     loop at me->collection assigning <element> from from to to.
       20       assign <element>->static_attributes->* to <static_attributes>.
    error in line 21       insert <static_attributes> into table table.
       22     endloop.
       23   endif.
       24
       25 endmethod.
    Any suggestions? Is it allowed to use bind_table() with a field symbol?
    Another strange thing is that if I try the same with static itab and attributes during runtime it works, but only if the fields of the itab has the same name as the attributes, which means that I can not use itabs with fieldnames like /BI0/S_CUSTOMER and if I can not use them it's difficult to read data from database with SELECT * FROM ... INTO CORRESPONDING FIELDS OF TABLE itab.
    Thanks in advance for your suggestions!
    Best Regards,
    Marcel

    Hi Francois,
    I solve it with the RTTI and the method    
    lr_node_info = lr_node_info->add_new_child_node(
                          name = 'Dynamic_TABLE'
                          IS_MANDATORY = ABAP_false
                          IS_MULTIPLE = ABAP_true
                          STATIC_ELEMENT_RTTI = lr_struct_descr
                          IS_STATIC = ABAP_false
    I don't know why it doesn't work with adding attributes and binding the table after adding the attributes.
    Anyway thanks for your help.
    Best Regards,
    Marcel

  • Manipulate Layout on ALV Grid with dynamic table

    Dear all
    i'm generating a dynamic table depending of a date selection. That means that I show columns for weeks and the quantity of weeky migh change.
    Now the users wants to have a specific layout of the ALV grid with totals. When he saves the layout, only the weeks at this selection will show the next time he runs the programm with a larger selection.
    a) Is it possible to modify the layout during runtime by programming?
    b) Do you have any other ideas how to solve this problem?
    Thank you

    You don't know the names of your columns? hmm you do, because before you created dynamic table you had to create field catalog, so the structure and column names of newly (dynamically) created table will be the same like defined in the field catalog.
    The last loop also does not look good, in my opinion should be something like:
    LOOP AT lt_datatable +(my first table)+ ASSIGNING <ls_data4>.
        AT NEW pernr.
          APPEND initial line to <fs_1> assigning <fs_2>.
          <fs_2>-pernr = <ls_data4>-pernr.
        ENDAT.
        ASSIGN COMPONENT <ls_data4>-wage_type OF STRUCTURE <fs_2> TO <fs_5>.
        <fs_5> = <ls_data4>-amount.
    ENDLOOP.
    also keep in mind that number of calls of method cl_alv_table_create=>create_dynamic_table is limited to 36 (?) calls within one program session because it uses dynamic subroutine pool behind so you will have short dump if you will execute that 37 times.

Maybe you are looking for

  • Standard Text in Arabic

    Hi, i have created one standard text in S010 transaction using language code 'AR' . i.e Arabic. In design mode is showing properly but when i am previewing it. it is showing me transvere characters means last character is comming at the first place a

  • PSE 6 Blank welcome screen and nothing else

    Started suddenly, no issues previously. Installed on an iMac running 10.5.8. Blank welcome screen and nothing else. Tried reinstalling... nothing is working.... help!

  • Help! -- Safari, etc. crash when I verify a signed Applet for Party Poker

    I need help. I am trying to make an Applet run from the Party Poker website. Every time I try to verify the certificate, Safari, Firefox, and Camino browsers "quit unexpectedly". I have submitted numerous reports, but nothing has been resolved. Can s

  • Cannot get BI JDBC query to display results..

    My connection to the Oracle DB works fine. The system check in Portal returns OK. The system alias is visible in VC. I can browse tables and views. I can use the BI integration wizard to set up a query, and I am also able to review the output (see th

  • Correct Order for BI+ services restart

    Hi All, We have the below services in BI+ What is the correct order to start them. Hyperion S9 BI+ 9.3 Core Services 1 Hyperion S9 BI+ 9.3 Interactive Reporting 1 Hyperion S9 BI+ 9.3 Financial Reporting Java RMI Registry Hyperion S9 BI+ 9.3 Financial