Dynamic Creation of Table and assign Datasource.

Hi Experts
My scenario is like this..
There are more than one RFC models and the output list of these models I need to display in a table format.. The display should happen conditionally as per the availabity of the data in the output list..I need to display the data from multiple models at the same time the said table..
Please let me know the methods to create a table with 5 columns and also how to assign the datasource programatically..
THanks and Regards
SU

Hi,
Use only one Table View context.
Model Contexts:
RFC1,           RFC2,            RFC3
I_Attr11         I_Attr21          I_Attr31
I_Attr12         I_Attr22          I_Attr32
I_Attr13         I_Attr23          I_Attr33
I_Attr14         I_Attr24          I_Attr34
I_Attr15         I_Attr25          I_Attr35
Table Control Context:
Table
I_Attr1
I_Attr2
I_Attr3
I_Attr4
I_Attr5
Execute each model individually and loop through all model contexts...append the rows from each model context to table context.
//access the table node
IWDTableNode tableNode = wdContext.nodeTable();
IWDTableElement tableElem;
//loop thugh the models
for(int i=0; i<RFC1.size(); i++)
tableElem = tableNode.createTableElement();
tableElem.setAttr1(RFC1.getRFC1ElementAt(i).getAttr11);
tableElem.setAttr2(RFC1.getRFC1ElementAt(i).getAttr12);
tableElem.setAttr3(RFC1.getRFC1ElementAt(i).getAttr13);
tableElem.setAttr4(RFC1.getRFC1ElementAt(i).getAttr14);
tableElem.setAttr5(RFC1.getRFC1ElementAt(i).getAttr15);
tableNode.addElement(tableElem);
//similarly loop thrugh the remaining 2 models and append the table context
Regards
Srikanth

Similar Messages

  • Dynamic creation of tables and data insertion in BODS

    Specific requirement : We need to extract multiple tables from ERP system and stage them in BODS SQL server database.
    As the need is for lot of tables , we want to come up with a generic Job which can be used for all the tables which have different sructures.
    So BODS Job should create tables on the fly and also load data into different tables not having same structure. We can maintain a config table of all the tables to be extracted.
    Any ideas?

    Dirk,
    The job should be generic to cater to n number of tables , we are looking at one job where the source /Target structures are not imported so that it becomes generic and we don't know the count of tables that we will be extracting . We just like one job , which can extract tables as and when we add table names in the config table.......

  • 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

  • Dynamic Creation of Buttons and Actions HELP

    Hi there,
    I have got a problem (or maybe even two) with the dynamic Creation of buttons. The code below creates the buttons.
    My main problem is, that the parameter created for the button's action isn't propagated to the assigned event handler. I get a null, though the name of the parameter in the event handler and the name of the parameter added to the action are the same.
    Could it also be that I'm always using the same action? I.e. does wdThis.wdGetAddElementAction() always return the same action instance? If yes, how can I create individual actions for each button?
    Any help is appreciated!
    Cheers,
    Heiko
    "    for(int i=rootContainer.getChildren().length; i<wdContext.nodeFeature().size();i++)
                   IPrivateVCT_Feature.IFeatureElement featureElement = wdContext.nodeFeature().getFeatureElementAt(i);
                   IWDTray featureTray = (IWDTray) view.createElement(IWDTray.class, featureElement.getName());
                   IWDCaption header = (IWDCaption) view.createElement(IWDCaption.class, featureElement.getName()+"_Header");
                   header.setText(featureElement.getName());
                   featureTray.setHeader(header);
                   featureTray.setExpanded(false);
                   rootContainer.addChild(featureTray);
                   IWDButton button = (IWDButton) view.createElement(IWDButton.class, featureElement.getName()+"_Button_AddElement");
                   IWDAction actionAddElement = wdThis.wdGetAddElementAction();
                   actionAddElement.getActionParameters().addParameter("featureIndex", new Integer(i).toString());
                   button.setOnAction(actionAddElement);
                   button.setText("Add Element");
                   featureTray.addChild(button);

    Hi Heiko,
    You have done everything correctly....except for 1 line
    in the code...
    Replace the following line in your code:
    actionAddElement.getActionParameters().addParameter("featureIndex", new Integer(i).toString());
    Replace the above line with this code:
    button.mappingOfOnAction().addParameter("featureIndex",i);
    Actually in your code, you are not associating the parameter with the button...
    Note that addParameter(...) comes with two signatures: addParameter(String param, String value) and addParameter(String param, int value). You can use any of them based on yuor need.
    Hope it helps,
    Thanks and Regards,
    Vishnu Prasad Hegde

  • Regarding Creation of Views and Multiple Datasources.

    Dear All,
    I hv a COreport(Cost Center Report).the data is coming from tables of CO,FI,SD,MM.
    The Tables from CO are COEP,COSP,COSS,CSKS,CRHD,CSKU,CRCO,CSKB
    The tables from SD are VBRK,KNA1
    The Tables from MM are EKKO,LFA1.
    The table from FI are SKAT,BKPF,BSIK,BSAK.
    1)Can i create a view for these tables?Can a view be called a DS.
    2)With these tables i hv Multiple DS's.So can i use Multiple DS's to extract data
    3)Can i use FM to extract Data?If i use FM,vll i face errors during Support?
    4)Please Guide me how to create Views for these tables and How to handle Multiple Datasources.
    Thanks

    Noor,
    Have you checked suitable business content datasources.
    I think you have lot of options
    FIrst You need to have a multiple data source
    --> Check for suitable business content datasources
    --> check whether these details are already available in BW through any means (through other standard datasources to ODS)
    --> Create customized extractor finally as a last option
    All these tables are atandard and nost probably you would find a standard datasource ( again multiple) I am sure for costing you have standard
    Few or more standard datasources or already existing BW objexts with 1 or 2(rarely) customized extractor would do the purpose that you look for,....
    Good Luck !!!
    Regards
    VJ

  • Creation of iview and assigning to portal

    Hi All,
    We developed some BI reports by using the  Reports URL
    How to create the Iview ,
    then iview  how to assign to sub folder and Folder
    how the folder can be assigned to Page
    and all the folder , sub folder and page how to create .
    Please can anyone tell  detailed process or if any document for e ntire concept.
    Thanks & Regards,
    sathish

    Hi Raju,
    Thanks  for kind and quick respomce.
    My Requirement is i created  some reports in BI 7.0
    now those reports i want to establish in portal.
    in portal page
    please can provide the step by step
    creation of iview
    creation of workset and folder
    my requirement is in BI different modules are there under each module different reports are there
    in top tab
    HR,MM<PM
    like that has to come
    if i click on HR
    all HR reports should be displayed left side
    please  can you provide step by step how to proceed.
    Thanks & Regards,
    sathish

  • 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

  • Dynamic creation of table with variable field-names

    HI
    I am looking for a way in order to create a table during runtime. The problem is that the field names of the table are provided in another table.
    TO illustrate the case at hand, an example:
    The initial table contains the fields
    UserID - attribut_name - attribute_value
    Example Data
    d00587 - first_name    - Jon
    d00587 - last_name     - Smith
    d00587 - age           - 48
    d00127 - first_name    - Jack
    d00127 - last_name     - Daniels
    d00127 - position      - Manager
    Now I need to create a table per User that looks as follows:
    for user d00587
    first_name  -  last_name  -  age
    **Values
    Jon         -  Smith      -  48
    for user d00127
    first_name  -  last_name  -  positioin
    Jack        -  Daniels    -  Manager
    I split the initial table by sorting it according to userID and then looping into an itab with an AT END OF userid, thus I receive the table per user:
    Example iTab
    UserID - attribut_name - attribute_value
    Example Data
    d00587 - first_name    - Jon
    d00587 - last_name     - Smith
    d00587 - age           - 48
    However I have no clue on how to create a new internal table with field-names = attribute_name.
    Does anybody have an idea or example code for this?
    Thanks a lot for your help,
    Kind regards,
    Mingolo

    Hello Minima
    Here is some sample coding:
    DATA:
      gt_fcat  type lvc_t_fcat,
      gdo_data TYPE REF TO data.
    FIELD-SYMBOLS:
      <gt_itab> TYPE table.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
      EXPORTING
    *     I_BUFFER_ACTIVE              =
        i_structure_name             = 'MARA'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
      CHANGING
        ct_fieldcat                  = gt_fcat
      EXCEPTIONS
        inconsistent_interface       = 1
        program_error                = 2
        OTHERS                       = 3
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
    *      I_STYLE_TABLE             =
        it_fieldcatalog           = gt_fcat
      IMPORTING
        ep_table                  = gdo_data
    *      E_STYLE_FNAME             =
      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 gdo_data->* TO <gt_itab>.
    In your case, you would call the function module with your tables (D00587, D00127). Remove all fields from the fieldcatalog that you do not need before calling the static method.
    Regards
      Uwe

  • Creation of Documents and assigning it to WBS Elements

    Hi all,
    I have a question regarding creation of documents.
    I am using T-code CV01N.....
    How to create the document and how to assign it to a WBS Element?
    Do we have any BAPIs or FM available for this?
    Thanks in advance....

    Hi Raj,
    Documents can be created/checkin  from WBS/activity without going to CV01N. For this, you need to have the DMS configured.
    Another way, Create document using transaction CV01N and attach manually in WBS/activity from Project Builder.
    Srinivasan Desingh

  • Dynamic creation of ItemListBox and binding a child node

    Hello @all,
    I have the following context structure
    root
    --category
    -- --report
    -- -- --id
    -- -- --name
    -- --id
    -- --name
    the parent node is "category" with attributes "id" and "name" and the child node is "report" with "id" and "name".
    Now I want on an onAction-Event of a Button, that for every category an itemListBox will be created with the according report names. the creation of the itemList is not the problem, but the binding of the datasource and/or the descriptivetext.
    my code:
    public void initItemListBox( )
        //@@begin initItemListBox()
        IWDView view = wdContext.currentContextElement().getSelectView();
        IWDGroup group = (IWDGroup) view.getElement("ItemListGroup");
        if (group.hasChildren())
          group.removeAllChildren();
        for (int i = 0; i < wdContext.nodeCategory().size(); i++)
          ICategoryElement catEl = wdContext.nodeCategory().getCategoryElementAt(i);
          wdContext.nodeCategory().setLeadSelection(i);
          generateItemLists(wdContext.currentContextElement().getSelectView(), wdContext, catEl);
        //@@end
    public void generateItemLists( com.sap.tc.webdynpro.progmodel.api.IWDView view, de.mgi.portaldev.bc.mdw.msi.wdp.IPrivateCRSReportView.IContextNode wdContext, de.mgi.portaldev.bc.mdw.msi.wdp.IPrivateCRSReportView.ICategoryElement category )
        //@@begin generateItemLists()
        //    ItemListBox
        IWDGroup group;
        IWDGroup catGroup;
        IWDLabel label;
        String groupId = "group_" + category.getName();
        catGroup = (IWDGroup) view.createElement(IWDGroup.class, groupId);
        IWDMatrixLayout matrLayout = (IWDMatrixLayout) catGroup.createLayout(IWDMatrixLayout.class);
        String labelId = "label_" + category.getName();
        label = (IWDLabel) view.createElement(IWDLabel.class, labelId);
        label.setText(category.getName());
        IWDMatrixData layout = (IWDMatrixData) label.createLayoutData(IWDMatrixData.class);
        layout.setVAlign(WDCellVAlign.TOP);
        String itemListId = "itemList_" + category.getName();
        IWDItemListBox itemListBox = (IWDItemListBox) view.createElement(IWDItemListBox.class, itemListId);
        label.setLabelFor(itemListId);
        IWDMatrixData itemlayout = (IWDMatrixData) itemListBox.createLayoutData(IWDMatrixData.class);
        itemListBox.bindDescriptiveText("crsReporting.category.report.name");
        IWDNodeInfo reportNodeInfo = category.nodeReport().getNodeInfo();
    //    itemListBox.bindText(reportNodeInfo.getAttribute("name"));
        itemListBox.setVisibleItems(5);
        IWDMatrixHeadData matrixHead = (IWDMatrixHeadData) itemListBox.createLayoutData(IWDMatrixHeadData.class);
        IWDAction itemListAct = (IWDAction) wdThis.wdGetItemSelectAction();
        itemListBox.setOnLeadSelect(itemListAct);
    //    itemListBox.bindDataSource(reportNodeInfo);
        itemListBox.bindDataSource("crsReporting.category.report");
        catGroup.addChild(label);
        catGroup.addChild(itemListBox);
        group = (IWDGroup) view.getElement("ItemListGroup");
        group.addChild(catGroup);
        //    END ITEMLIST
        //@@end
    What am I doing wrong? in every ItemListbox there are only the report names of the last category.
    thanks.

    RowRepeater is available in WD Java since NW CE (7.1). With RowRepeater, the solution is trivial and can be done completely by declaration in view designer.
    In earlier releases, you can solve it as follows (non-trivial)
    - For each category, create a separate context node "Category_i" with an attribute "name"
    - Inside each category node, create a non-singleton node "Reports" with an attribute "name"
    - Foreach report, add a node element to the reports subnode of its category node <b>element</b>
    All this has to be done using the generic context API.
    On each change of the data, reset the context and re-create these nodes.
    In wdDoModifyView(), check if data have changes and create UI elements programmatically.
    - For each category, create a group, bind header text to category name.
    - Inside each group, create a ItemListBox, bind "dataSource" to reports sub-node of category (non-singleton!) and bind "text" to text attribute of report node.
    Sample code:
    To build context structure:
    private void createCategories()
        for (int i = 0; i < 3; ++i)
          IWDNodeInfo categoryNodeInfo = wdContext.getNodeInfo().addChild("Category" + i, null, true, CMICardinality.ONE, CMICardinality.ONE, true, null);
          IWDAttributeInfo att = categoryNodeInfo.addAttribute("name", "ddic:com.sap.dictionary.string");
          IWDNode categoryNode = wdContext.getChildNode(categoryNodeInfo.getName(), 0);
          categoryNode.getElementAt(0).setAttributeValue(att.getName(), "Category #" + i);
          IWDNodeInfo reportNodeInfo = categoryNodeInfo.addChild("Reports", null, false, CMICardinality.MANY, CMICardinality.ZERO_TO_ONE, true, null);
          IWDAttributeInfo attReportName = reportNodeInfo.addAttribute("name", "ddic:com.sap.dictionary.string");
          IWDNode reportNode = categoryNode.getChildNode("Reports", 0);
          for (int j = 0; j < 5; ++j)
            IWDNodeElement report = reportNode.createAndAddElement();
            report.setAttributeValue("name", "Report #" + j);
    To recreate UI:
    if (<data_have_changed>)
          IWDTransparentContainer root = (IWDTransparentContainer) view.getRootElement();
          for (int i = 0; i < 3; ++i)
            IWDNode categoryNode = wdContext.getChildNode("Category" + i, 0);
            IWDAttributeInfo attName = categoryNode.getNodeInfo().getAttribute("name");
            IWDGroup group = view.createElement(IWDGroup.class);
            root.addChild(group);
            IWDCaption header = view.createElement(IWDCaption.class);
            group.setHeader(header);
            header.bindText(attName);
            IWDNode reportsNode = categoryNode.getChildNode("Reports", 0);
            IWDAttributeInfo attReportName = reportsNode.getNodeInfo().getAttribute("name");
            IWDItemListBox list = view.createElement(IWDItemListBox.class);
            group.addChild(list);
            list.bindDataSource(reportsNode.getNodeInfo());
            list.bindText(attReportName);
    Armin
    Fixed code tags

  • Dynamic creation of class and calling methods

    I've got and interface called Transformation and then two implementations called TxA and TxB, where TxA and TxB have their own attribtues and setter and getters for these attributes.
    The question is, I need to create instances of TxA and TxB and called the setter and getters where I at runtime I only know the attribute to set, how can I create and instance and call the right getters and setters methods?
    Thanks in advance

    Smart money says your design sucks and needs to be rethought entirely. Can we get specifics?
    Drake

  • Dynamic Internal table values read and assign it back

    Hi All,
            I want to get the internal table field name dynamically and fetch its value and do some calculation and asign the new value to the same field name.
           CONCATENATE '<WA_PIPE>-ZW' v_index INTO v_fld.
            CONDENSE v_fld NO-GAPS.
            FIELD-SYMBOLS <fs> TYPE ANY.
            ASSIGN (v_fld) TO <fs>.
            v_fld1 = <fs> * <wa_pipe>-zrate.
    Now i've the internal table field name as <WA_PIPE>-ZW1 in v_fld and v_fld1 is having the value of the same field.
    How to assign it to the internal table field.
    Thanks.
    Ashok

    *& Report  YY_TEST1
    REPORT  YY_TEST1.
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
    <dyn_wa>.
    data: it_alvfc type slis_t_fieldcat_alv,
    wa_alvfc type slis_fieldcat_alv,
    it_fldcat type lvc_t_fcat,
    wa_fldcat type lvc_s_fcat.
    selection-screen begin of block b1 with frame title text-001.
      parameters: p_flds(5) type c.
    selection-screen end of block b1.
    start-of-selection.
    *build the dynamic internal table
    perform build_dyn_itab.
    *write 5 records to the alv grid
    do 5 times.
    perform build_report.
    enddo.
    *call the alv grid.
    perform call_alv.
    *Build_dyn_itab
    form build_dyn_itab.
    *Create the dynamic internal table
    data: new_table type ref to data,
    new_line type ref to data.
    *Create fields .
    do p_flds times.
    clear wa_fldcat.
    wa_fldcat-fieldname = sy-index.
    wa_fldcat-datatype = 'CHAR'.
    wa_fldcat-intlen = 5.
    append wa_fldcat to it_fldcat .
    enddo.
    *Create dynamic internal table and assign to FS
    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>.
    *Create dynamic work area and assign to FS
    create data new_line like line of <dyn_table>.
    assign new_line->* to <dyn_wa>.
    endform.
    *Form build_report
    form build_report.
    *Fill some values into the dynamic internal table
    data: fieldname(20) type c.
    data: fieldvalue(5) type c.
    data: index(3) type c.
    field-symbols: <fs1>.
    do p_flds times.
    index = sy-index.
    *Set up fieldvalue
    concatenate 'FLD' index into
    fieldvalue.
    condense fieldvalue no-gaps.
    assign component index of structure <dyn_wa> to <fs1>.
    <fs1> = fieldvalue.
    enddo.
    *Append to the dynamic internal table
    append <dyn_wa> to <dyn_table>.
    endform.
    *CALL_ALV
    form call_alv.
    *Build FC for ALV
    loop at it_fldcat into wa_fldcat.
    wa_alvfc-fieldname = wa_fldcat-fieldname.
    wa_alvfc-seltext_s = sy-tabix.
    wa_alvfc-outputlen = wa_fldcat-intlen.
    append wa_alvfc to it_alvfc.
    endloop.
    *Call ABAP List Viewer (ALV)
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
    it_fieldcat = it_alvfc
    tables
    t_outtab = <dyn_table>.
    endform.

  • Read a csv file, fill a dynamic table and insert into a standard table

    Hi everybody,
    I have a problem here and I need your help:
    I have to read a csv file and insert the data of it into a standard table.
    1 - On the parameter scrreen I have to indicate the standard table and the csv file.
    2 - I need to create a dynamic table. The same type of the one I choose at parameter screen.
    3 - Then I need to read the csv and put the data into this dynamic table.
    4 - Later I need to insert the data from the dynamic table into the standard table (the one on the parameter screen).
    How do I do this job? Do you have an example? Thanks.

    Here is an example table which shows how to upload a csv file from the frontend to a dynamic internal table.  You can of course modify this to update your database table.
    report zrich_0002.
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>,
                   <dyn_field>.
    data: it_fldcat type lvc_t_fcat,
          wa_it_fldcat type lvc_s_fcat.
    type-pools : abap.
    data: new_table type ref to data,
          new_line  type ref to data.
    data: xcel type table of alsmex_tabline with header line.
    selection-screen begin of block b1 with frame title text .
    parameters: p_file type  rlgrap-filename default 'c:Test.csv'.
    parameters: p_flds type i.
    selection-screen end of block b1.
    start-of-selection.
    * Add X number of fields to the dynamic itab cataelog
      do p_flds times.
        clear wa_it_fldcat.
        wa_it_fldcat-fieldname = sy-index.
        wa_it_fldcat-datatype = 'C'.
        wa_it_fldcat-inttype = 'C'.
        wa_it_fldcat-intlen = 10.
        append wa_it_fldcat to it_fldcat .
      enddo.
    * Create dynamic internal table and assign to FS
      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>.
    * Create dynamic work area and assign to FS
      create data new_line like line of <dyn_table>.
      assign new_line->* to <dyn_wa>.
    * Upload the excel
      call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           exporting
                filename                = p_file
                i_begin_col             = '1'
                i_begin_row             = '1'
                i_end_col               = '200'
                i_end_row               = '5000'
           tables
                intern                  = xcel
           exceptions
                inconsistent_parameters = 1
                upload_ole              = 2
                others                  = 3.
    * Reformt to dynamic internal table
      loop at xcel.
        assign component xcel-col of structure <dyn_wa> to <dyn_field>.
        if sy-subrc = 0.
         <dyn_field> = xcel-value.
        endif.
        at end of row.
          append <dyn_wa> to <dyn_table>.
          clear <dyn_wa>.
        endat.
      endloop.
    * Write out data from table.
      loop at <dyn_table> into <dyn_wa>.
        do.
          assign component  sy-index  of structure <dyn_wa> to <dyn_field>.
          if sy-subrc <> 0.
            exit.
          endif.
          if sy-index = 1.
            write:/ <dyn_field>.
          else.
            write: <dyn_field>.
          endif.
        enddo.
      endloop.
    REgards,
    RIch Heilman

  • Link between technical table and datasource - SE16

    Hi,
    I'm looking for the table in SE16 that gives me the association between my technical tables and my datasources/infosources:
    for example:
    I have table /BIC/B0000161000 and I want to know for which datasource this is the PSA table...
    Kind regards
    Joke

    already found the link: rstsods

  • Dynamically create Internal Table

    Hi,
    I have a parameter in the program table name.
    I want to create an Internal Table like the table name entered for this parameter.
    Is this kind of dynamic creation of internal table from a variable possible.
    If yes, can you guys please help me with it.
    Thanks,
    CD

    Sure, its possible. HEre is an example.  And you will find thousands more, when you search this forum. 
    report zrich_0002.
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>,
                   <dyn_field>.
    data: alv_fldcat type slis_t_fieldcat_alv,
          it_fldcat type lvc_t_fcat.
    type-pools : abap.
    data : it_details type abap_compdescr_tab,
           wa_details type abap_compdescr.
    data : ref_descr type ref to cl_abap_structdescr.
    data: new_table type ref to data,
          new_line  type ref to data,
          wa_it_fldcat type lvc_s_fcat.
    selection-screen begin of block b1 with frame title text .
    parameters: p_table(30) type c.
    selection-screen end of block b1.
    * Get the structure of the table.
    ref_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
    it_details[] = ref_descr->components[].
    loop at it_details into wa_details.
      clear wa_it_fldcat.
      wa_it_fldcat-fieldname = wa_details-name .
      wa_it_fldcat-datatype = wa_details-type_kind.
      wa_it_fldcat-inttype = wa_details-type_kind.
      wa_it_fldcat-intlen = wa_details-length.
      wa_it_fldcat-decimals = wa_details-decimals.
      append wa_it_fldcat to it_fldcat .
    endloop.
    * Create dynamic internal table and assign to FS
    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>.
    * Create dynamic work area and assign to FS
    create data new_line like line of <dyn_table>.
    assign new_line->* to <dyn_wa>.
    * Select Data from table.
    select * into corresponding fields of table <dyn_table>
               from (p_table).
    * Write out data from table.
    loop at <dyn_table> into <dyn_wa>.
      do.
        assign component  sy-index  of structure <dyn_wa> to <dyn_field>.
        if sy-subrc <> 0.
          exit.
        endif.
        if sy-index = 1.
          write:/ <dyn_field>.
        else.
          write: <dyn_field>.
        endif.
      enddo.
    endloop.
    Regards,
    Rich Heilman

Maybe you are looking for

  • HT2666 Why won't my rented movie play?

    I'm  trying to play my rented movie for a second time within the 48 hour period in Australian, but when I click play, nothing happens, over and over.  Tried turning it off and on etc.  Anyone have any fixes for this?

  • Unable to match monitor brightness and prints when printing from lightroom.

    Trying to figure out how to print the brightness of what I see on the monitor. Running a windows 8 box with current Adobe creative cloud account. Trying to print directly from lightroom. Have a colormunki display and have calibrated the monitor which

  • Outer join with first of zero or more rows

    Hi! I'm trying to make a join where one part is the first row of zero or more rows. I seem to be getting much poorer performance than I ought to be able to. My tables Node and RelayGroup have 6000 and 3000 rows respectively, while the CommandHist tab

  • How to lower my iMac

    Hi I have an Imac 27" pc with the original stand. the height is too high and I strain my neck looking up. Does anyone know if apple or some other company makes another stand or adapter, the i can mount to the pc. I do not  want to wall mount it using

  • Problem in bsp layout - 'BAPI_MATERIAL_STOCK_REQ_LIST'

    Hi, I'm a student at HEC Montreal and i've been asked to develop a mobile application that is able to connect to SAP and display information about current stock and more. I've been asked to display a summary of the current SR list. I want my jsonp fi