Smartform Dynamic colour in the item table

Hi Experts,
I have a requirement wherein we need different colours for each item in the table according to a particular condition.
If the value in the  column two is 1 ,first item should have a colour blue in the last column
If the col2 is 2, second item should have red colour in the last column.
and accordingly.
                      Col 1       Col2       Col3      Col4
Row1                                1                   Blue colour
Row2                                2                   Red colour
Row3                                3                   Green colour
Is this possible in smartforms.
Already tried giving condition in the condition tab and choosing the colour for different text elements,which is not possible.
Tried writing the below code in initialisation which is also not helping.
* Color
*DATA: l_tabdef  TYPE ssftabdef,     " Work Area for the Table
*     t_ltypes  TYPE tsfltype,      " Table - Line types
*     l_ltypes  TYPE ssfltype,      " Work Area for the table
*     t_colinfo TYPE tsfcolinfo,    " Table - Columns
*     l_colinfo TYPE ssfcolinfo,    " Work area for the table
*     t_border  TYPE tsfctaba,      " Tables - Borders
*     l_border  TYPE ssfctaba.      " Work Area for the borde
* FIELD-SYMBOLS : <f_tab> type tsftabdef.
*ASSIGN ('(SAPLSTXBC)TABDEFS') TO <f_tab>.
*bREAK-POINT .
*LOOP AT <f_tab> INTO l_tabdef  where name = 'ITEM_VALUES'.  "  only for one template
** Table line Types
**  Line type TYPE1 from the table MAIN_TABLE
*  LOOP AT l_tabdef-tltype INTO l_ltypes where linetype = 'L2'.  " only for one line type is required
** Coloum information
**   Column1 (cell) of the TYPE1
*    LOOP AT l_ltypes-tcolinfo INTO l_colinfo." where widthv = '1.31'. .
** Borders
**   Background color and borders for that cell
*      LOOP AT l_colinfo-borders INTO l_border.
** Clearing the color parameters for the cell
*        CLEAR: l_border-intensity,              " Intensity
*        l_border-fillcolor-red,          " Red
*        l_border-fillcolor-used,         " Color Used
*        l_border-cfillcolor-color,       " Red color in Hexa
*        l_border-cfillcolor-xred.        " Color used in Hexa
*        l_border-fillcolor-red = '255'.
*        l_border-fillcolor-green = '000'.
*        l_border-fillcolor-blue = '000'.
*        l_border-fillcolor-used = 'X'.
*        l_border-cfillcolor-color  = 'X'.
*        l_border-cfillcolor-xred = 'FF'.
*        l_border-cfillcolor-xgreen = '00'.
*        l_border-cfillcolor-xblue = '00'.
*        MODIFY l_colinfo-borders FROM l_border.
*      ENDLOOP.
*      MODIFY l_ltypes-tcolinfo FROM l_colinfo.
*    ENDLOOP.
*    MODIFY l_tabdef-tltype FROM l_ltypes.
*  ENDLOOP.
*  MODIFY <f_tab> FROM l_tabdef.
*ENDLOOP.
Please suggest and help on how to proceed.
Thanks in advance.
Jojy

Can you try creating 3 identical line types in Smartform with just 3 different colors. Add a field to the internal table to specify the color. Add a condition to the line types to output based on the color field.
Thanks,
Juwin

Similar Messages

  • Deleting a row from the item table

    Hi All,
    I have a requirement where I need to put a button to delete the selected row from the item table and for this I have written the following code:
    DATA lo_nd_t_bseg TYPE REF TO if_wd_context_node.
        DATA lo_el_t_bseg TYPE REF TO if_wd_context_element.
        DATA ls_t_bseg TYPE wd_this->element_t_bseg.
        data: it_tab type table of wd_this->element_t_bseg.
      lo_nd_t_bseg = wd_context->path_get_node( path = `Z.T_BSEG` ).
      lo_el_t_bseg = lo_nd_t_bseg->get_element( ).
      lo_el_t_bseg->get_static_attributes(
        IMPORTING
          static_attributes = ls_t_bseg ).
        lo_nd_t_bseg = wd_context->path_get_node( path = `Z.T_BSEG` ).
        lo_el_t_bseg = lo_nd_t_bseg->get_element( ).
        IF lo_el_t_bseg IS not INITIAL.
          lo_nd_t_bseg->remove_element( lo_el_t_bseg ).
        ENDIF.
    Now the problem is although it's deleteing the selected line correctly but because of this I am losing one line on the screen for the user to enter... my form has a fixed number of lines and in my case it's 10... so everytime I am using deleting a line item I am losing one line to enter..... can you please tell me how can I avoid this?
    Edited by: rajatg on Aug 4, 2011 3:12 PM

    lets say...
    i have 1,2,3 documents
    i have cleared , document 2....
    1. when the user selects this record.... you can read the context_element....using the context element you can get the values and clear those values and set the blank values...
    when the user click on save ...you can have only those two records in the table.
    2. conitnue with your logic .... remove_element. once it is done ,,, create_element at the deleted index...
    3. when clicked on delete ...remove_element ( current code).... bind the table to the node... and you will have ur values

  • Dynamic name for the physical table

    Hi Guys,
    How to setup dynamic names for the physical table? Where it is useful?*
    Pls help me out on this.
    thanks

    Check this similar post which might be of help dynamic physical table source schema
    Cheers,
    KK

  • Is any relation between tables bbp_pdatt with any of the item table

    Hi all,
    I have created shopping cart with 2 line items and each line item is having 2 attachments.
    Now I am having the attachment data in table bbp_pdatt .and we have item data also.
    I could not get the line item number or data in table bbp_pdatt.In table bbp_pdatt only attachment data exist.
    I want to know for which line item the attachment belongs to.
    Please tell me if there is any table having the attachment data as well as item data.in single table.
    Thanks,
    Prashanth.

    Hello ,
    You can establish the link as follows:
    Read CRMD_LINK table with  GUID_HI  = 'Item Guid'  AND
                                                 OBJTYPE_SET '33'
    The above will give you the result set which contains  set guids (GUID_SET) values for attachment. This value can be joined with the (SET_GUID) of the BBP_PDATT table.
    This will give you the attachments for the Shopping cart at item level.
    Best Regards,
    Sapna.

  • Add the diffrent colour to the items which have affected the release me28

    Hi all,
    I want to show the items which have affected the release in the diffrent colour in the  in alv report of standard SAP Program ME28 Screen.
    Ur help is required
    Thanks
    kanishak

    There's no Automator action for editing multiple contacts…
    Well, essentially, there is. You just pass a group of contacts that you have filtered or found to an applescript action that does the changes.
    However, I can't find a way to get an image into the contact info. If someone could make that work, we could make the applescript.
    Also, there is not email address field specifier in the Find or Filter actions, so you'd have to use Company field to filter by.

  • Add a new field in the item table control of sales order

    Hi Experts,
                   We have created a new custom field in Material master table. Now, they want to add the custom field from material master to the last field of item control of sales order.
    Please, let me know the steps to do it.
    Regards,
    M.Saravanan

    Hi,
      take program: SAPMV45A
    take screen 8459 and add the new field.
    Also add the validation in the flow logic.
    Refer
    https://forums.sdn.sap.com/click.jspa?searchID=10547810&messageID=3132651
    Regards
    Kiran

  • Dynamic to generate the data tables

    Hi, I would like to dynamically generate data tables or faces components based on some parameter ? Might I have some suggestion or examples ?
    Thanks

    Here is the codes in my jsp page and opHandler class.Is anything wrong ?
    In jsp page :
         <h:dataTable border="0" binding="#{opHandler.test1}">                                        
         </h:dataTable>
    ====================================================
    In opHandler class:
         * @return Returns the test1.
         public HtmlDataTable getTest1() {
              System.out.println("TEST");
              test1 = createDataTable();
              return test1;
         private HtmlDataTable createDataTable()
         String el ;
         ValueBinding val;
         HtmlDataTable dataTable = new HtmlDataTable();
    System.out.println("getTable");
    // Faces Application
    FacesContext context = FacesContext.getCurrentInstance();
    Application application = context.getApplication();
    // DataTable
    el = "#{" + "opHandler.shpModel" + "}";
    val = application.createValueBinding(el);
    dataTable.setValueBinding("value", val);
    dataTable.setVar("shpList1");
    dataTable.setStyleClass("dataTable");
    dataTable.setWidth("98%");
    dataTable.setColumnClasses("columnClass1");
    dataTable.setRowClasses("oddRow,evenRow");
    // Column1
    UIColumn fltColumn = new UIColumn();
    // Column 1 : Header information
    HtmlOutputText fltHeader = new HtmlOutputText();
    fltHeader.setValue("Flight");
    fltColumn.setHeader(fltHeader);
    // Column 1 : Output content information
    HtmlOutputText fltOutput = new HtmlOutputText();
    el = "#{" + "shpList1.dest" + "}";
    val = application.createValueBinding(el);
    fltOutput.setValueBinding("value",val);
    fltOutput.setId("flt");
    fltOutput.setStyleClass("outputText");
    fltColumn.getChildren().add(fltOutput);
    dataTable.getChildren().add(fltColumn);
    return dataTable;
    }

  • SMARTFORMS - dynamic amount of the columns

    Hi Everyone.
    Please, would you give me some advice? I need to print a table with variable amount of columns. Is it possible to do it in SMARTFORMS?
    Thanks in advance for any answer.
    Pavel

    Hello Pavel,
    Please go these links:
    Smart forms query
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d937ec90-0201-0010-0ca8-b6cb3b6dd1ef
    If useful reward.
    Regards,
    Vasanth

  • How to change the Destination URI value of a item table at run time

    I'd like to change the Destination URI of item of a table region when a column X of my view is not NULL. Where should I set the new Destination URI value for the item table region for specific row? Is in the RowImpl for the view object or in the Controler of the page?
    I'd really appreciate any suggestion.
    Thanks in advance.

    Hi,
    Thanks for the help, but I still dont know where I should to use setAttributeValue(DESTINATION_ATTR,OADataBoundValueViewObject());
    All examples that I saw till now here, suggestes to change something in the page in Controller but based on something entered in the page. In my case is IN to OUT, I will render some item table with a specific value parameter based what is in the database. Being more specific, I have a html table and one column Col1 has a value and it will have a DESTINATION URL if another column Col2 is Null. I believe I would have to check somewhere if the Col2 is null or not and change the DESTINATION URL property.
    Thanks again..

  • How can i join the header and item table to fetch the data

    hi experts,
                   i have a doubt in using inner join or for all entries, for fetching the data from the item table mseg, by taking the doc.no from mkpf. Plz sort out the difference, what happens, if i use the both statements for fetching data

    Hi,
    Both has same functionality.
    but if u are using FAE, u ahev to check for the
    ~intial condition of the source table,
    ~ duplicate entries, if any
    Inner join will fetch the data from all the join tables at once. FAE will fetch the date from a table first then use that data to fetch data from subsequent table.
    say in ur case, if u r using FAE,
    1.select from mkpf.
    2.select from mseg fae in I_MKPF.
    first try using JOIN. if it is taking lots of time, then try FAE.
    regards,
    madhu

  • Working with the line item table in CAF application service

    Hello SDNs,
    I am trying to retrive a value from the Nested list of one of my application service.
    for example,  suppose i have 2 operations in a application service, 1, calls the BAPI_PO_GETDETAIL1 based on the PO number given it returns the POItem, POServices tables.
    2, operation accepts itemno and PO number as a input, and inside calls the 1st operation and wants deal with the POItem and POServices tables which of type standard BAPI classes nested under the main structure created in application service.
    For example, i want to compare the item number given as input with the item numbers in the Item table, which is a output of 1st operation .
    How to get the itemnumber from the POItem table, as this is a nested structure under POOut(defined in AS level) and how to compare this.
    i have written the code as follows but it is returning the error. Can any look into this and suggest me.
    public com.xxx.demo.goodsnserviceack.types.POProcessOut getPOServices(@javax.jws.WebParam(name="PONumber")
    *     java.lang.String PONumber, @javax.jws.WebParam(name="POItem")*
    *     java.lang.String POItem) {*
    // POProcessOut is a output node of current operation
    *          POProcessOut PPO= new POProcessOut();*
    //POHeader details is the nested structure under POProcessOut
    *          POHeaderdetails header=new POHeaderdetails();*     
    //POOutDetails is the output structure of 1st operation     
    *          POOutDetails pt=new POOutDetails();*
    *          try{
    //calling the first operation          *
    *          pt= executeBAPIPOGetDetail(PONumber,"X","X");*
    *          //setting header details*
    *          header.setPO_NUMBER(pt.getPOHeader().getPO_NUMBER());*
    *          header.setVendor(pt.getPOHeader().getVENDOR());*
    *          header.setCOMP_CODE(pt.getPOHeader().getCOMP_CODE());*
    *          header.setSTATUS(pt.getPOHeader().getSTATUS());*
    *          PPO.setPOHeaderdetails(header);*
    *     //comparing the POItem number from POItem table and input of current operation
                       List<BAPIMEPOITEM> itemlist= pt.getPOItem();*
    *          while(itemlist.isEmpty()==false){*
    *          String itemnum= itemlist.get(0).getPO_ITEM();*
    *          if(itemnum.equals(POItem))*
    *               PPO.setItemno(itemnum);*
    *          catch(CAFServiceException e){*
    *               e.printStackTrace();*
    *          return PPO;*
    Your inputs will be appreciated.
    Thanks,
    Sireesha.

    Have you accessed the external webservice in this way:
    EJBLocalHome localHome = HomeFactory.getInstance().getLocalHome("localejbs/sap.com/comptest/ACCRJAVAWSVI__DOCUMENT");
    Method m = localHome.getClass().getMethod("create", new Class[]{});
    ACCRJAVAWSVI__DOCUMENTLocal srv = (ACCRJAVAWSVI__DOCUMENTLocal)m.invoke(localHome, new Object[] {});
    srv.validateLogin(input) ;
    Aliaksei

  • Can we get the item data in smart form

    i have a header table with 3 records and item with 10 records.. i am passing both of them to the function module ( fm_name) and then in the smartform i have to get 3 pages output. but right now i am getting only one page..
    to display the header data i am using secondary windows and for displaying the item data i am using tables node in the main window ( in the data tab of the tables node i am giving it as loop it_item1 into wa_item1 ). before the header row of that table node i have created a table node and in that i am prearing the item table it_item..as
    describe table i_hdr line h_lines.
    if h_idx LE h_lines.
    READ TABLE i_hdr into wa_hdr index h_idx.
    if sy-subrc eq o.
    loop at it_item into wa_item where belnr = wa_item-belnr.
    move wa_item to wa_item1.
    append wa_item1 to i_item1.
    clear wa_item1.
    endloop.
    endif.
    this is what i am doing it right now.. and at the last row in the footer of table node i have created a command node and in that i have selected the option go to page : first page.
    please correct me if my approach is wrong
    <MOVED BY MODERATOR TO THE CORRECT FORUM>
    Edited by: Alvaro Tejada Galindo on Dec 29, 2009 12:03 PM

    Hi,
    You try ur logic in
    do                      ---endo.
    after describing the table .
    Do the loop for the number of records available.
    i.e. as per your logic.
    describe table i_hdr line h_lines.
    do h_lines times.
    put your above code and enddo.
    Hope this will work.

  • Creating dynamic field in the form

    Hi,
    How to create a dynamic block?
    The item in the block could be autochanged with the changing of
    table's field.
    I don't want to rebuild the form.
    Thanks!

    You can base a block on a from clause.
    SO base your block on something like
    select ename a, deptno b from emp;
    define 2 fields in the block a and b.
    Now you can use set_block_property to change the underlying SQL
    for example select dname a ,loc b from dept.

  • "The new table link contain TargetFieldNames that are not valid?

    I am designing a report based on a sql stored procedure with 3 parameters required.  I have a parameter that I would like to make dynamic based on an "Item" table for multiple selections.
    I keep getting this error when I run the report
    Prompting failed with the following error message: 'List of VAlues failure: fail to get values. (Cause of error: the new table link contains TargetFieldNames that are not valid.  Error source: prompt.dll
    Error code: 0x8004380d
    Can someone point me to an example or tell me if this even possible to do?
    Edited by: SHARON SCHMIDT on Feb 17, 2009 3:16 PM

    Hi Sharon,
    Searching for the error message got many KBase but I hope referring to the following would help you:
    1211133 - Using parameters to select one, some or all values in a record selection formula
    1220118 - Error: "List of Values failure"prompt.dll Error code: 0x8004380D"
    Regards,
    Sheeba

  • Possible to link the two tables?

    Dear All,
    I am currently trying to create a report where the user will enter in the customer code and then using discounts on item groups to create a sales price (list price - customer discount = sales price). I'm currently trying to do this in crystal reports but I just can't seem to get the values.
    The problem I have is the OITM.Itemgroupcode is of type number (from the item table) where the OSPG.ObjKey is of type string (this represents the itemgroup code in the Discount table). Because of the different types I cannot link the two fields. If they were the same then it should be easy but I can't seem to get around this.
    Does anyone have any idea of what I could do to resolve my issue, while I am trying to do this with crystal currently I'm not locked into using this platform.
    Any help and comments are much appreciated.
    Troy

    Hi Troy,
    Welcome you post on the forum.
    Try this to start:
    SELECT T0.ItemCode, T1.CardCode, T1.Discount
    FROM OITM T0
    INNER JOIN OSPG T1 ON CAST(T1.ObjKey AS INT)=T0.ItmsGrpCod
    WHERE T0.ItmsGrpCod like '[%0\]%'
    If you get result, you can create a Command for your CR report.
    Thanks,
    Gordon

Maybe you are looking for