Check inventory and change quantity color Answered

Daniel Sellen

I am trying to set a UF that if quantity ordered on sales order is greater than available in stock, it will turn the quantity red, and if there is enough to cover what is ordered it will be green. I can get it to work for one item, but the second I add a line that is the opposite, it changes all the colors. 

For example, item AA111-green

                     item AA112-green

                     item AA113-Red (turns the previous green one to red)

if($[$38.11.0]>$[$38.87.0]) //quantity ordered> available UDF

Begin ForeColor($[$38.11.NUMBER]|RED);

end

else

begin ForeColor($[$38.11.NUMBER]|GREEN);

END

 

Any advice would be appreciated.

Comments

6 comments

  • Comment author
    Yaremi Miranda Lopez
    • Edited
    • Official comment

    Hello Alain,

    This is not supported by SAP's UI for macros, this is a limitation and we don't have a workaround for this.

  • Comment author
    Nadav Caridi

    Hi, 

    According to https://help.boyum-it.com/B1UP/index.html?macro.html this is not officially supported. (Matrix Cells / Matrix Rows in the table) 

    You can achieve that however with the .net code option but I think(?) you'll need to color the table every time your form gets new data otherwise the matrix settings will hold the previous colors  

     

     

    0
  • Comment author
    Daniel Sellen

    So what would the .net code be? I am not familiar with this code. Any help would be appreciated.

    0
  • Comment author
    Nadav Caridi

    Hi,

    Suppose you'd like to color the first row : 

    Item itm = form.Items.Item("38"); // Set form item
    Matrix oMtx = (Matrix)itm.Specific; // Access Matrix
    oMtx.CommonSetting.SetRowFontColor(1, 4678655); //color red first row

     

    problem is you'll have to re-color the rows whenever your data changes, otherwise the color you chose remains.

    e.g. the above code will set a red color for the first row until you reopen the form . 

     

    Hope that helps . 

     

     

     

    0
  • Comment author
    Alain Seys

    Hi,

    Nadav is there a way you can query this with a sql query.

    like : eg

     SQL(SELECT ItemCode FROM OSPP WHERE ItemCode = $[$38.1.0] AND CardCode = $[$4.0.0])

    Nadav Caridi

    0
  • Comment author
    Nadav Caridi

    Hi Alain, 

    not sure I understand  .. 

    If using dynamic code you can use recordset object to query . 

    But I fee like it would be easier to use line loop . 

    0

Please sign in to leave a comment.