Logic to check each line in Grid and update flag

Shrikanthn

Well Known Member
Hi list, I am trying to check each line in an SO grid in P4210 and compare the LOB field and EUSE field. If LOB field has value but End Use field is blank in any line I want to update a flag. This flag should trigger an error when user presses OK button. Can anybody help by suggesting in which event rule to code the logic for flag update and how do i ensure that the logic runs for all the lines even in an edit mode?

Currently i have used the Row Exit and Changed - Inline to code the flag update logic, and OK button to code the error display logic. But this has a bug since it works only for new order entry but does not work when we update the existing SO.

Help greatly appreciated.

Best regards
Shrikanth
 
Hi Shrikanthn,

Looping through on all lines you can use System Function in Grid Category.
=====================================
Get Max Grid Rows(FC Grid, VA frm_nMaxGridRows_INT01)
VA frm_nGridRowNumber_INT01 = [VA frm_nMaxGridRows_INT01]-1
//
While VA frm_nGridRowNumber_INT01 is greater than <Zero>
Get Grid Row(FC Grid, VA frm_nGridRowNumber_INT01)
*** Here GC values cointain the value of the frm_nGridRowNumber_INT01 row ***
VA frm_nGridRowNumber_INT01 = [VA frm_nGridRowNumber_INT01]-1
End While
=====================================
...OR...
=====================================
Get Max Grid Rows(FC Grid, VA frm_nMaxGridRows_INT01)
VA frm_nGridRowNumber_INT01 = 1
//
While VA frm_nGridRowNumber_INT01 is less than frm_nMaxGridRows_INT01
Get Grid Row(FC Grid, VA frm_nGridRowNumber_INT01)
*** Here GC values cointain the value of the frm_nGridRowNumber_INT01 row ***
VA frm_nGridRowNumber_INT01 = [VA frm_nGridRowNumber_INT01]+1
End While
=====================================

You can adjust the While condition by 1, depending on has the actual grid an Entry row on the end or has not.

Regards,

Zoltán
 
Hi Zoltan, thanks a ton for such a quick response. I was suddenly doubtful whether just by getting max rows the system knows it has to go through all the rows. Thanks for clarifying the doubt. Also the get grid row function was new to me. thanks again..
 
Back
Top