Dynamically changing single to multiselect in Table in OAF

Hi,
I am trying to programmaticallychange single selection to multiple selection of Table in Controler. From UI point of view everything is replaced correctly, but when I am trying to get values of selected rows ALWAYS only the first row is returned as selected (I think it is a default value of singleselection). I have also set rendered option to false for singleselection using personalisation page. Do you know what I am doing wrong or what I should check?
The second issue is a dialog page. As I noticed the page context (table selection values) are lost when I am using confirmation page (dialog page with yes/no option). How should I pass page context to dialog page (table multiselection)?
Controler Code:
    public void processRequest(OAPageContext pageContext, OAWebBean webBean) {
        super.processRequest(pageContext, webBean);
        OATableBean tableBean = (OATableBean)webBean;
        tableBean.prepareForRendering(pageContext);
        // Define new table selection (multi)
        OAMultipleSelectionBean mySelection = (OAMultipleSelectionBean)createWebBean(pageContext, MULTIPLE_SELECTION_BEAN);
        mySelection.setViewUsageName("EventResultsVO1");
        mySelection.setViewAttributeName("SelectFlag");
        //String sEventSelectText = pageContext.getMessage("XLA", "XX_XLA_EVENT_SELECT", null);
        tableBean.setTableSelection(mySelection);
        /* Workaround selection works - not satisfied
            OAMessageCheckBoxBean checkboxSelection = (OAMessageCheckBoxBean)createWebBean(pageContext, OAWebBeanConstants.MESSAGE_CHECKBOX_BEAN);
            checkboxSelection.setViewUsageName("EventResultsVO1");
            checkboxSelection.setViewAttributeName("SelectFlag");
            checkboxSelection.setChecked(false);
            checkboxSelection.setLabel("Wybierz");
            tableBean.addIndexedChild(0,checkboxSelection);
         /* Workaround selection */
        // FireAction for Change Status Button
        OAFlowLayoutBean tableActionBean = (OAFlowLayoutBean)tableBean.getTableActions();
        FireAction FireActionAddGroup = new FireAction();
        FireActionAddGroup.setEvent("ChangeStatusEvent");
        // Change Status Button
        OASubmitButtonBean myButtonBean = (OASubmitButtonBean)createWebBean(pageContext, BUTTON_SUBMIT_BEAN);
        myButtonBean.setPrimaryClientAction(FireActionAddGroup);
        String sChangeStatusButton = pageContext.getMessage("XLA", "XX_XLA_CHANGE_STATUS", null);
        myButtonBean.setText(sChangeStatusButton);
        // Text Item
        OAMessagePromptBean myMessagePromptBean = (OAMessagePromptBean)createWebBean(pageContext, MESSAGE_PROMPT_BEAN);
        String sSpecifyReasonText = pageContext.getMessage("XLA", "XX_XLA_SPECIFY_REASON", null);
        myMessagePromptBean.setPrompt(sSpecifyReasonText+": ");
        myMessagePromptBean.setCSSClass("OraDataText");
        // Text Field Item
        OATextInputBean myTextInputBean = (OATextInputBean)createWebBean(pageContext, TEXT_INPUT_BEAN);
        myTextInputBean.setName("xxPrzyczynaZmianyStatusu");
        myTextInputBean.setID("xxPrzyczynaZmianyStatusu");
        myTextInputBean.setLabel("Przyczyna zmiany statusu");
        myTextInputBean.setMaximumLength(240);
        // Table Action Bean
        tableActionBean.addIndexedChild(0,myMessagePromptBean);
        tableActionBean.addIndexedChild(1,myTextInputBean);
        tableActionBean.addIndexedChild(2,myButtonBean);
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) {
          super.processFormRequest(pageContext, webBean);
          String event = pageContext.getParameter(EVENT_PARAM);
          if (event != null && "ChangeStatusEvent".equals(event)) {
              String statusChangeReasonField = pageContext.getParameter("xxPrzyczynaZmianyStatusu");
              if ((statusChangeReasonField != null) && (!"".equals(statusChangeReasonField))) {
                  //Prepare Dialog Page
                  String sChangeConfirmationText = pageContext.getMessage("XLA", "XX_XLA_CHNG_CONF", null);
                  OAException message = new OAException(sChangeConfirmationText);
                  OADialogPage dialogPage = new OADialogPage(OAException.CONFIRMATION, message, null, "","");
                  dialogPage.setOkButtonItemName("ChangeSelectedYesButton");
                  dialogPage.setNoButtonItemName("ChangeSelectedNoButton");
                  dialogPage.setOkButtonToPost(true);
                  dialogPage.setNoButtonToPost(true);
                  dialogPage.setPostToCallingPage(true);
                  String yes = pageContext.getMessage("AK", "FWK_TBX_T_YES", null);
                  String no = pageContext.getMessage("AK", "FWK_TBX_T_NO", null);
                  dialogPage.setOkButtonLabel(yes);
                  dialogPage.setNoButtonLabel(no);
                  //Pass changeReason argument to dialogPage
                  Hashtable formParams = new Hashtable(1);
                  formParams.put("statusChangeReasonField", statusChangeReasonField);
                  dialogPage.setFormParameters(formParams);
                  pageContext.redirectToDialogPage(dialogPage);
              } else {
                  //ChangeReason empty
                  String sSpecifyReasonText = pageContext.getMessage("XLA", "XX_XLA_SPECIFY_REASON", null);
                  throw new OAException(sSpecifyReasonText+"!", OAException.WARNING);
          else if(pageContext.getParameter("ChangeSelectedYesButton")!=null) {
                OAApplicationModule am = pageContext.getApplicationModule(webBean);
                String changeReason = pageContext.getParameter("statusChangeReasonField");
                Serializable parameters[] = {changeReason};
                am.invokeMethod("XXchangeSelectedEvents", parameters);
                OAException confMessage = new OAException("XLA","XX_XLA_DIALOG_MESSAGE", null, OAException.CONFIRMATION, null);
                pageContext.putDialogMessage(confMessage);
Application Module code:
public class xxEventsInquiryAMImpl extends EventsInquiryAMImpl {
    /**This is the default constructor (do not remove)
    public xxEventsInquiryAMImpl() {
    /**Sample main for debugging Business Components code using the tester.
    public static void main(String[] args) {
        launchTester("pzu.oracle.apps.xla.eventsinquiry.server", /* package name */
      "xxEventsInquiryAMLocal" /* Configuration Name */);
    public void XXchangeSelectedEvents(String changeReason) {
        OAViewObject vo = (OAViewObject)getEventResultsVO1();
        EventResultsVORowImpl row = null;
        int fetchedRowCount = vo.getFetchedRowCount();
        RowSetIterator updateIter = vo.createRowSetIterator("updateIter");
        if (fetchedRowCount > 0) {
            updateIter.setRangeStart(0);
            updateIter.setRangeSize(fetchedRowCount);
                // TEST - get number of selected rows
                Row[] selectedRows = updateIter.getFilteredRows("SelectFlag","Y");
                int numRows=selectedRows.length;
            for (int i = 0; i < fetchedRowCount; i++) {
              row = (EventResultsVORowImpl)updateIter.getRowAtRangeIndex(i);
              if (row != null && row.getSelectFlag() != null && row.getSelectFlag().equals("Y") ) {
                  Number rowEventId = (Number)row.getAttribute("EventId");
                  if (rowEventId != null) {
                      CallableStatement st = null;
                      try {
                          String stmt = "begin XX_DSP_FAH_010_API.set_no_action(:1, :2); end;";
                          //XX_DSP_FAH_010_API.set_no_action(p_event_id,p_reason,p_error_code,p_error_desc)
                          OADBTransaction tr = getOADBTransaction();
                          st = tr.createCallableStatement(stmt, 1);
                          st.setInt(1, rowEventId.intValue());
                          st.setString(2, changeReason);
                          st.close();
                          OAExceptionUtils.checkErrors(tr);
                      catch(SQLException sqle) {
                          throw OAException.wrapperException(sqle);
        updateIter.closeRowSetIterator();

Hi,
you can do this by surrounding the cell components (outputText, inputText, checkBox etc) with e.g. a panelLabelAndMessage component. Then on this component inlineStyle property use EL to reference a managed bean property. The managed bean property can now evaluate the check box select state. The trick part in your question is to tell upon rendering of the previous and next row that the check box in the row between has been selected. So you need to find a way to tell this. One option would be to apply logic like below
JUCtrlHierNodeBinding currentRenderedAdfRow = ... use facesContext --> getApplication --> getExpressionFactory --> createValueExpression to create a handle to the #{row} expression
Row rw = currentRenderedAdfRow.getRow();
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentBindingEntries();
DCIteratorBinding dciterator = (DCIteratorBinding ) bindings.get("Name of iterator used by table ");
RowSetIterator rsIterator = dciterator .getRowSetIterator();
Row prevRow = rsIterator.setCurrentRow(rw);
int currRowIndex = rsIterator.getCurrentRowIndex();
Row prevRow = getRowAtRangeIndex(currRowIndex-1); 
Row nextRow = getRowAtRangeIndex(currRowIndex-1); 
//return CSS that colors the background if the following conditions are true
if ( ((DataType) rw.getAttribute("checkBoxAttr")) ||  ((DataType) prevRow .getAttribute("checkBoxAttr")) |  ((DataType) nextRow .getAttribute("checkBoxAttr"))){
  //color background returning CSS
else{
  return empty string
}I wrote this code from the top of my head, so ensure you check for null pointers (e.g. if a prev-row doesn't exist). Also consider caching of the calculation so that it doesn't need to be performed for each cell in a row but only once per row. E.g. you can save the color and the row key in a managed bean in view scope and then compare the key with this managed bean before performing the calculation
Frank

Similar Messages

  • Dynamically change cell properties in a table

    Hi,
    I have read all forum posts about changing table cell properties, but I can't find the solution to my problem.
    I have a table that derives its structure from a table which is the output of an RFC.
    The rows are provided by the model.
    When displaying the result of the RFC call, I want to add a colored row between certain sections with totals of that particular section.
    I managed to add the row in the appropriate place, however I cannot change the color of this row (or even better: the particular cell).
    Can anyone tell me how to proceed? And what property determines backgroundcolor of a tablecell? TextViewSemanticColor determines the text color, I want to change the background color.
    Here is a fragment from my wdDoModifyView:
    i=0;
    IPrivateResultView.IEp_OpportunitiesNode node = wdContext.nodeEp_Opportunities();
    while (i<node.size()) {
         total1 += <some value>;
         total2 += <some value>;
         if (<start of new section>) {
              IPrivateResultView.IEp_OpportunitiesElement el = (IPrivateResultView.IEp_OpportunitiesElement) node.createElement(new Zopportunities());
              el.setAttributeValue("Exp_Revenue", new BigDecimal(total1));
              el.setAttributeValue("Chancevalue", new BigDecimal(total2));
    //     totals row is added here:                    
              node.addElement(i, el);
    //     how can I make this work for background color?
              el.node().getNodeInfo().addAttribute("TextViewSemanticColor", "ddic:com.sap.ide.webdynpro.uielementdefinitions.TextViewSemanticColor");
              el.setAttributeValue("TextViewSemanticColor", WDTextViewSemanticColor.NEGATIVE);
              total1 = 0;
              total2 = 0;
         i++;
    Thanks in advance,
    Roelof

    Hello Knibbe,
    One can play with the readOnly of table cell editor (Input Field) to acheive the expected result.
    Let us take a specific case where your table has four columns say col1, col2, col3, col4 and each of these columns have Input field as the table cell editor.
    Then depending upon the condition specified below choose your option.
    <u>If you have bound the table to the model node</u>
    1. Create a new value node and create a bolean value attribute under it.
    2. Set the cardinality of the value node to 1:1 and singleton to false.
    3. Bind this attribute to the Table cell editor <b>(Inputfield)</b> in col1, col2, col3 and col4.
    4. set the value of this attribute to TRUE when the table gets filled up initially i.e for the elements/rows in which you want to display the total, as per your requirement.
    5. set the value of this attribute to FALSE for the other rows where you want the user to edit the data.
    <u>If you have bound the table to a value node</u>
    1. Create a value attribute of type boolean under the value node and follow the ONLY the steps 3, 4 and 5
    Please reward appropriate points.
    Bala
    Message was edited by: Bala Krishnan

  • Dynamically change single content

    Hi
    I learnt from Dreamweaver Missing Manual that the Spry data
    set is used with lists of information like product catalogs. What
    method do I choose in Dreamweaver for a single dynamic content? Are
    there also automated methods like the Spry data set? Thanks for
    your answers!
    Regards, Simon

    > I'm sorry for the unclear formulation, I'm actually
    looking for a method
    > of
    > displaying several Web pages in a single Web browser
    window
    Frames would be the only way (or IFrames). There are *MANY*
    disadvantages
    to choosing this method, though - so much so that you rarely
    ever see them
    used any more except by people who don't know of them (or
    don't understand
    them). Why do you need to display several pages in a single
    viewport?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "SimonBaum09" <[email protected]> wrote in
    message
    news:gnjtpl$4sl$[email protected]..
    > I'm sorry for the unclear formulation, I'm actually
    looking for a method
    > of
    > displaying several Web pages in a single Web browser
    window (. Backwards
    > this
    > was made with framesets. What is the appropriate method
    nowadays? Does
    > Dreamweaver provide a simple method for this kind of
    task?
    > I couldn't find a clear answer to this question in this
    forum.
    >
    > Kind Regards
    >
    > Simon
    >

  • Dynamically changing internal table in 'gui_download'

    Hi Experts,
                     i have to download 4 internal tables, each with different structures, to the presentation server using 'gui_download', based on which radio-button is selected in the selection screen. I am hoping to use a single 'form' and 4 'perform' calls. how can I dynamically change the tables in the 'gui_download' function modules.
    plz help.....................

    Hi ,
    Build the field catalog dynamically based on the internal table structure based on the radio button selected.Use the dynamic internal table generated from the filedcatalog and use in GUI_DOWNLOAD.
    See the below code:
    *& Report  ZRAJESH02
    REPORT  zrajesh02.
    Dynamic internal table
    TYPE-POOLS: slis.
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                  <dyn_wa>.
    DATA: alv_fldcat TYPE slis_t_fieldcat_alv,
          it_fldcat TYPE lvc_t_fcat.
    DATA: lv_monate TYPE f,
          lv_months TYPE i,
          lv_date TYPE sy-datum,
          p_check1 type n value '1'.
    lv_date = sy-datum + 360.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: p_check TYPE c.
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
      CALL FUNCTION 'MONTHS_BETWEEN_TWO_DATES'
        EXPORTING
          i_datum_bis   = lv_date
          i_datum_von   = sy-datum
          i_kz_incl_bis = ' '
        IMPORTING
          e_monate      = lv_monate.
      lv_months = lv_monate.
      PERFORM f_fcat USING 'AUFNR' 'CHAR' '12'.
      PERFORM f_fcat USING 'POSNR' 'CHAR' '06'.
      while p_check1 LE p_check.
      PERFORM f_fcat USING p_check1 'CHAR' '1'.
      p_check1 = p_check1 + 1.
      endwhile.
      PERFORM build_dyn_itab.
      LOOP AT <dyn_table> INTO <dyn_wa>.
        WRITE:/ <dyn_wa>.
      ENDLOOP.
    FORM f_fcat USING fieldname dattyp length.
      DATA:wa_it_fldcat TYPE lvc_s_fcat.
      CLEAR wa_it_fldcat.
      wa_it_fldcat-fieldname = fieldname.
      wa_it_fldcat-datatype = dattyp.
      wa_it_fldcat-intlen = length.
      APPEND wa_it_fldcat TO it_fldcat .
    ENDFORM.                    "f_fcat
    *&      Form  build_dyn_itab
          text
    FORM build_dyn_itab.
      DATA: new_table TYPE REF TO data,
      new_line TYPE REF TO data.
    wa_it_fldcat TYPE lvc_s_fcat.
    CLEAR wa_it_fldcat.
    wa_it_fldcat-fieldname = 'AUFNR'.
    wa_it_fldcat-datatype = 'CHAR'.
    wa_it_fldcat-intlen = 12.
    APPEND wa_it_fldcat TO it_fldcat .
    CLEAR wa_it_fldcat.
    wa_it_fldcat-fieldname = 'POSNR'.
    wa_it_fldcat-datatype = 'CHAR'.
    wa_it_fldcat-intlen = 6.
    APPEND wa_it_fldcat TO it_fldcat .
    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.                    "build_dyn_itab
    Thanks,
    Rajesh.

  • Dynamically change the Priority Group of Logical Table Sources in OBIEE 11g

    Hi All,
    I have 2 Logical Table Sources(LTS 1 and LTS 2 for a Logical Table in BMM Layer).
    Example: Logical Table : Sample
    LTS Source 1 : Sample 1(Priority Group Set to 1)
    LTS Source 2 : Sample 2(Priority Group Set to 0)
    I have set the Priority Group of Sample 1 LTS Source to 1 and Priority Group of Sample 2 LTS Source to 0.
    I need to dynamically change the Priority Group of Sample 1 LTS Source to 0 if my role is DEVELOPER where role is a column in database.
    If my role is not equal to DEVELOPER then the Priority Group of Sample 1 LTS Source will remain same(1).
    Please suggest how can i achieve this.
    Thanks,
    Soukath Ali

    hello Soukath Ali,
    didi you find a way to dinamically changing Priority Group?
    thanks,
    Maria Teresa Marchetti

  • Dynamically change table selecting from

    in 3.2 on 11g database is there a way to dynamically change the table used in a select statement for an interactive report? I have a series of similar tables, one for each month of the year. I want to click a month on one page and bring up a report from the table for that month. I want to use one page for this report and have all links from previous page link to the same page, just different result based on what month was clicked.
    I know I could just setup 12 different reports and conditionally display each region based on a value passed to the that page, but I'd prefer to only create one page & one report on that page.
    Thanks for any ideas or solutions.

    Your function will have the code dynamically built.. What you do is you build your sql and pass in the table name and any other items that will change based upon your requirements..
    here is an example...
    function inventory_report (p_State IN VARCHAR2) RETURN VARCHAR2 IS
    declare
      q varchar2(4000);
    begin
      q:='   select p.category, ';
      q:=q||'       p.product_name, ';
      q:=q||'       p.quantity, ';
      q:=q||'       p.unit_price '; 
    -- Here is where we substitute the passed in state name for the data table we extract data from
      q:=q||'  from ' || V('p_State') || ' p, ';
      q:=q||' where p.product_quantity > 0 ';
      return q;
    end;Thank you,
    Tony Miller
    Webster, TX

  • Dynamically changing row color in an ADF table?

    Hi,
    I am using Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660. Can anyone please let me know the code for dynamically changing the row color of an ADF table?
    Thanks,
    Vik

    well you can use EL on af:column inlineStyle property to change the color on condition
    e.g
    inlineStyle='#{(row.SelectedRow)?"background-color: Silver":""};a example can be found here it is changing color based on Checkbox selection http://baigsorcl.blogspot.com/2010/06/deleting-multi-selected-rows-from-adf.html

  • Dynamically changing table headers

    I already know the answer to this since I have spent couple of days previously trying to make this work but thought of putting this on the forum either way.
    Has anyone sucessfully been able to create dynamically changing headers before using a date column "MONYY"? Requirement is that the user is given a prompt selector for "MONYY" and the table will have values for "MONYY + and - 2 months". This "+ and -" 2 months needs to be dispayed as table headers
    E.g. User selects NOV12 and the table header needs to show "SEP12 Sales, OCT12 Sales, NOV12 Sales, DEC12 Sales, JAN13 Sales"
    I have tried everything possible by using the presentation variable in all sorts of functions, trying to pass a variable to a hidden prompt that automatically refreshes on a prompt application. This has been tawing with me and I want to put it to rest knowing that it cannot be acheived.

    It can't. At least not in that way. You could put the value (retrieved from a column or a varaible, your choice) into a column formula though and put it as a table section. Not the same as column headers, I know, but may be worth proposing as a workaround.

  • Problem with Drag & Drop and multiselection in tables

    Hi,
    we have a problem concerning drag and drop and multiselection in tables. It is not possible to drag a multiselection of table rows, as the selection event is recognized or handled before the drag event. So before the drag starts, the selection will be changed and only a single row is selected at the position where you started the drag with a mouse click.
    There was also a java bug with the id 4521075 regarding this problem a couple of years ago. See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4521075.
    This bug has been resolved but in our application we have not enabled drag by setting setDragEnabled(true) on the table as we have an own implementation of a DragSource (which is the table component), and a DragGestureRecognizer to control mimetype and data to be dragged.
    So my question is: Is there any solution for this case without calling setDragEnabled(true) on the table? Or is it possible to enable drag on the table and override some method where the drag recognition happens and the transferable object is created?
    Thanks,

    Thanks for reply,
    Steps to reproduce the problem:
    1) user clicks the ascending sorting icon in the table(the button get disabled after sorting the table).
    2) After sorting user drag and drop some row over another row.
    3) Now the table is no longer sorted.
    4) If user again wants to sort the table now, he cannot do it because the sorting button is still disabled.
    So I want the user to sort the table again, without refreshing the page
    Thanks and Regards,
    Tarun

  • Dynamic call for records in a table

    hI,
    Im having a ztable, the structure is as follows:
    tabold fldold tabnew fldnew
    The records in this table is are:
    1.yvbap  posnr xvbap posnr
    2.yvbak  auart xvbak auart
    3.yvbak  augru xvbak augru.
    Now, i have to use this table dynamically to check each and every record in the program:mv45afzz.
    So, my problem is that, i have to dynamically pass these records which contains table name and its field name.
    i can write as: xvbap-posnr = yvbap-posnr for all the three records (the values will come from sales order tranx, report: mv45afzz)
    but in future if the records are added then i have to again change the code, so this shouldn't happen.
    It should dynamically call all the records in this table and check the condition.
    Thanx
    Rohith

    Hello Rohith
    What is your question???
    You described a few ingredients of your scenario (not all of them) and do not really explain your requirements.
    Given the descriptions of the Z-table fields I assume you need to check whether OLD values are equal to NEW values.
    If this assumption is correct then the solution is quite simple (except for XVBAP / YVBAP: Does this mean single entries or looping over all entries?)
    DATA:
      lt_ztable     TYPE STANDARD TABLE OF zstructure,
      ls_ztable     TYPE zstructure.
      FIELD-SYMBOLS:
        <lt_tab>     TYPE table,
        <ls_struct_old>    TYPE any,
        <ls_struct_new>   TYPE any,
        <ld_old>    TYPE any,
       <ld_new>    TYPE any.
    " Read entries from z-table
      SELECT * FROM ztable INTO table lt_ztable.
      LOOP AT lt_ztable INTO ls_ztable.
        ASSIGN (ls_ztable-tabold) TO <ls_struct_old>.
        ASSIGN (ls_ztable-tabnew) TO <ls_struct_new>.
        ASSIGN COMPONENT (ls_ztable-fldold) OF STRUCTURE <ls_struct_old> TO <ld_old>.
        ASSIGN COMPONENT (ls_ztable-fldnew) OF STRUCTURE <ls_struct_new> TO <ld_new>.
        IF ( <ld_old> = <ld_new> ).
          " do something...
        ENDIF.
      ENDLOOP.
    For the sake of simplicity I did not add the required statements for checking successful ASSIGN's.
    Regards
      Uwe

  • Dynamic change the ALV layout

    Alle experts:
    In ALV layout report, how to dynamic change the layout int ABAP porgram?
    e.g. I have save 5 layout, I need to change them base the my selection in ABAP program? How to do this?
    Thanks in advance!

    Try to call fieldcatlog dymnamically. Refer tofollowing code. Reward if helpful.
    REPORT  zfir0001 MESSAGE-ID ztax.
                               Tables
    TABLES : glt0, t001, skat.
                          Internal Tables
    DATA: BEGIN OF itab OCCURS 0,
            racct               LIKE   glt0-racct,    "Account number
            txt20               LIKE   skat-txt20,    "G/L account short text
            co_1000          LIKE     glt0-hslvt,     "Balance carried forward for company code 1000
            co_1100          LIKE     glt0-hslvt,     "Balance carried forward for company code 1100
            co_1200          LIKE     glt0-hslvt,     "Balance carried forward for company code 1200
    DATA : BEGIN OF itab1 OCCURS 0,
             bukrs LIKE glt0-bukrs,
             waers LIKE t001-waers,
           END OF itab1.
    DATA : BEGIN OF it_itab1 OCCURS 0.
            INCLUDE STRUCTURE glt0.
    DATA : END OF it_itab1.
                          Data Declarations
    DATA : w_total   LIKE glt0-hslvt,
           w_count   LIKE glt0-bukrs,
           w_flg     TYPE c,
           lv_count  TYPE i.
          w_slash   TYPE c VALUE ' '.
                          Selection screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE tit1.
    SELECT-OPTIONS : s_bukrs FOR glt0-bukrs OBLIGATORY,
                     s_racct FOR glt0-racct OBLIGATORY,
                     s_ryear FOR glt0-ryear OBLIGATORY,
                     s_rldnr FOR glt0-rldnr OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    INITIALIZATION.
      tit1 = 'Please select:'(004).
      TYPE-POOLS: slis.                                 "ALV Declarations
      DATA: i_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
            gd_tab_group TYPE slis_t_sp_group_alv,
            gd_layout    TYPE slis_layout_alv,
            gd_repid     LIKE sy-repid.
    ********Geting the selected company code in table itab1****
    START-OF-SELECTION.
      IF NOT s_bukrs-high IS INITIAL.
        itab1-bukrs = s_bukrs-low.
        APPEND itab1.
        w_count = s_bukrs-low.
        DO.
          IF s_bukrs-high = w_count.
            EXIT.
          ELSE.
            w_count =  w_count + 1.
          ENDIF.
          SELECT SINGLE * FROM t001
              WHERE bukrs = w_count.
          IF sy-subrc = 0.
            itab1-bukrs = w_count.
            APPEND itab1.
            CLEAR itab1.
          ENDIF.
        ENDDO.
      ELSE.
        itab1-bukrs = s_bukrs-low.
        APPEND itab1.
      ENDIF.
      SELECT * FROM glt0 INTO CORRESPONDING FIELDS OF TABLE it_itab1
              WHERE rldnr   IN s_rldnr
              AND   bukrs   IN s_bukrs
              AND   ryear   IN s_ryear
              AND   racct   IN s_racct.
      SORT it_itab1 BY bukrs.
      LOOP AT it_itab1.
        AT END OF racct.
          w_flg = 'X'.
        ENDAT.
        SELECT SINGLE txt20 INTO (itab-txt20) FROM skat
                  WHERE spras = sy-langu
                  AND   saknr = it_itab1-racct.
        PACK it_itab1-racct TO it_itab1-racct.
        itab-racct = it_itab1-racct.
        w_total = it_itab1-hsl01 + it_itab1-hsl02 + it_itab1-hsl03 + it_itab1-hsl04 +
                  it_itab1-hsl05 + it_itab1-hsl06 + it_itab1-hsl07 + it_itab1-hsl08 +
                  it_itab1-hsl09 + it_itab1-hsl10 + it_itab1-hsl11 + it_itab1-hsl12 +
                  w_total        + it_itab1-hslvt.
        IF w_flg = 'X'.
          READ TABLE itab1 WITH KEY bukrs = it_itab1-bukrs.
          IF sy-subrc = 0.
            SELECT SINGLE * FROM t001
                WHERE bukrs = itab1-bukrs.
            IF t001-waers = 'JPY' OR
               t001-waers = 'HUF'.
              w_total =  w_total * 100.
            ENDIF.
            CASE it_itab1-bukrs.
              WHEN '1000'.
                itab-co_1000 = w_total.
              WHEN '1100'.
                itab-co_1100 = w_total.
              WHEN '1200'.
                itab-co_1200 = w_total.
            ENDCASE.
            COLLECT itab.
            CLEAR: itab, w_flg, w_total.
          ENDIF.
        ENDIF.
      ENDLOOP.
      SORT itab BY racct.
      IF NOT itab[] IS INITIAL.
        PERFORM field_cat1.
        lv_count = 1.
        LOOP AT itab1.
          PERFORM field_cat USING itab1-bukrs.
        ENDLOOP.
        PERFORM display_alv_report .
      ELSE.
        MESSAGE s000 WITH 'No records Found'(003).
      ENDIF.
    *&      Form  display_alv_report
          text
    FORM display_alv_report .
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = gd_repid
          is_layout          = gd_layout
          it_fieldcat        = i_fieldcat[]
          i_save             = 'X'
        TABLES
          t_outtab           = itab
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
    ENDFORM.                    "display_alv_report
    *&      Form  field_cat1
          text
    FORM field_cat1 .
      i_fieldcat-col_pos     =  0.
      i_fieldcat-fieldname   = 'RACCT'.
      i_fieldcat-seltext_m    = 'Account'(001).
      i_fieldcat-fix_column = 'X'.
    i_fieldcat-emphasize   = 'X'.
      APPEND  i_fieldcat TO i_fieldcat.
      CLEAR  i_fieldcat.
      i_fieldcat-col_pos     =  1.
      i_fieldcat-fieldname   = 'TXT20'.
      i_fieldcat-seltext_m    = 'Description'(002).
      APPEND  i_fieldcat TO i_fieldcat.
      CLEAR  i_fieldcat.
    ENDFORM.                                                    "field_cat1
    *&      Form  field_cat
          text
         -->XV_BURKS   text
    FORM field_cat USING xv_burks TYPE char4.
      lv_count = lv_count + 1.
      i_fieldcat-col_pos     = lv_count.
      CONCATENATE 'CO_' xv_burks INTO i_fieldcat-fieldname.
      i_fieldcat-seltext_m    = xv_burks.
    i_fieldcat-just = 'C'.
    i_fieldcat-no_zero = 'X'.
    i_fieldcat-do_sum = 'X'.
      APPEND  i_fieldcat TO i_fieldcat.
      CLEAR  i_fieldcat.
    ENDFORM.   "field_cat
    Edited by: dhanashree wadkar on Apr 30, 2008 6:00 AM

  • Dynamically changing Grid title  in alv using class

    Hi all,
    I need to get grid title dynamically for single screen for user actions through buttons.What is the option available in cl_gui_alv_grid.
    in reuse_alv_grid_display one field grid_title is  available .but here i could not able to find anything like this .how to solve this issue.
    thanks in advance,
    raja

    When user presses a button on the application toolbar....with function code ( say TITL ) then the grid_title field can be changed manually and can be reflected in the display by refreshing the table using the method below..
    please try this....
    flag = 1.
    FORM user_command USING u_ucomm   LIKE sy-ucomm
                         us_selfield TYPE slis_selfield.
        CASE u_ucomm.
         WHEN 'TITL'.
            IF flag EQ 1.
               flag = 2.
               grid_title = 'ALV_DISPLAY_1'.
               CALL METHOD grid->refresh_table_display
                 EXPORTING
                   IS_STABLE      =
                 I_SOFT_REFRESH =
                 EXCEPTIONS
                   FINISHED       = 1
                   others         = 2.                 
             elseif flag eq 2.
               flag = 1.
               grid_title = 'ALV_DISPLAY_2'.
               CALL METHOD grid->refresh_table_display
                 EXPORTING
                   IS_STABLE      =
                 I_SOFT_REFRESH =
                 EXCEPTIONS
                   FINISHED       = 1
                   others         = 2.
              endif.
         ENDCASE.
    ENDFORM.

  • Dynamically changing form binding

    Hi,
    I would like to dynamically change the binding variable (bind.ref) of a subform during runtime based on a "change event" triggered by a single/multiple selection in a list box, contained in a different subform.
    List box A is part of subform A, during completion of the form, the user selects one or more entries from list box A and triggers a "change event". Based on this event a table, part of subform B, is filled with entries that depend on the users selection in the list box. The rows in this table are determined by the "bind.ref" value of subform B. That means, dependent on the list box selection "bind.ref" will be assigned with a different array, that is also constructed at runtime.
    Before asking for hints to a possible solution, I would like to know whether it is possible in general to change the binding of a subform dynamically (so not in the "initialize event" as in Daniel's case), based on a "change event" triggered by a list box selection?
    Regards,
    Franz

    Hi radzmar,
    Thanks for the reply, much appreciated.
    I also found out more on that topic under another adobe forum post:
    http://forums.adobe.com/message/3607404#3607404
    So, yes it seems the binding of for instance a list box can't be modified once it's set.
    I finally solved my issue by making subforms 'hidden' or 'visible' dependent on the items selected in a list box. This worked reasonably well.
    Cheers,
    Franz

  • Adobe form from webdynpro : Getting a single row in the table

    Hello,
    I have a scenario in which I have to create a adobeform from webdynpro application.
    I have created the form and have the context designed in place.
    I am facing a problem in the table I have in my adobeform.
    I am adding rows to this table dynamically using a button using "addInstance"
    Now on the webdynpro side , when I try to read this table I get a single row from this table.
    This row is always the first row of that table.
    I checked the following things from blog   /people/juergen.hauser2/blog/2006/09/12/avoiding-common-mistakes-when-using-tables-on-sap-interactive-forms  , i.e. :
    Cardinality of the node.
    Tick on the option "Repeat Row for Each Data Item".
    But still no success.
    With deadlines to catch I had to post this question after trying a lot.Please help.

    Hello Otto,
    I had found this link before and used the same solution , but unfortunately is taking a long time.
    Now what I am doing is :
    1. I append 10 rows into the table then bind it to the node
    2. Then on the adobe form I have removed the check on "Add row for each line item" because of which it shows only 1 row 
         on the form.
         Now I add rows dynamically, but this puts a limit on the number of rows can be added to the table i.e. 10.
    But this again has added problems like while displaying the form or modifying I hav to handle it seperately and cannot use the same form as it is.( as I have removed the tick for "Add row for each line item" ).
    Thanks,
    Omkar Mirvankar

  • How to dynamically change the text of a TextObject with embedded DataField?

    Hi
    I'm trying to dynamically change the text of a TextObject at runtime, by using the .NET library. My problem is that if one or more DatabaseFieldDefinition is embedded inside my text, I'm unable to change the "static text" only, by keeping the field, e.g. I have :
    Text1 => "Contact Name: {Contact.Name}"
    and I'd like to change it to anything else like:
    Text1 => "Nom du Contact: {Contact.Name}"
    Half of my TextObject is static text while second part comes from the dataset.
    (of course the translation is dynamic - it is called at run-time and the new value to be set depends on the calling application language)
    If I simply modify the Text property of my TextObject, the {Contact.Name} embedded field is not evaluated anymore by the Crystal Engine, but considered as a single text.
    Using formulas or parameters looks quite difficult, because it means having many ones just for translation needs - I cannot control the way my users will create their reports and "force them" to use complex methods just in order to put a text and a value together...
    Anyone knows how to deal with that ?

    Only way I can think of doing this:
    1) Create a formula (call it lang) and enter the string "Contact Name" in it
    2) Place the  {Contact.Name} field next to the string
    3) So now you have:
    ContactName:  {Contact.Name}
    4) Check what localization you are after. If you need "Nom du Contact", change the lang formula so it shows "Nom du Contact" using the code below:
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim Report As New CrystalReport1()
    Dim FormulaFields As FormulaFieldDefinitions
    Dim FormulaField As FormulaFieldDefinition
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    FormulaFields = Report.DataDefinition.FormulaFields
    FormulaField = FormulaFields.Item(0)
    FormulaField.Text = "[formula text]"
    CrystalReportViewer1.ReportSource = Report
    End Sub
    I realize this may not give you consistent spacing as the translations may have strings of differnt length. Perhaps someone has other idea(s)...

Maybe you are looking for