cancel
Showing results for 
Search instead for 
Did you mean: 

Validation

Former Member
0 Kudos

Hi Freinds,

I am trying to code certain validations required on Purchase order. I have my Supplier's code starting with State Code e.g DELV001, BLR001. Like wise i have my document series the same way BLR1, DEL1. I want to make sure if some one has selected a supplier for say DEL state and if the series if of different state it should not let the user add the po.

I tried coding it but it does not allow to add even if the combination is right. Here is my code.......

Public BPCode As SAPbouiCOM.EditText

Public Series As SAPbouiCOM.ComboBox

If pVal.ItemUID = "1" And pVal.BeforeAction = True And (oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Or oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE) Then ' Validation

BPCode = oForm.Items.Item("4").Specific

Series = oForm.Items.Item("88").Specific

If (BPCode.Value Like "DEL*" And Series.Value <> "DEL-11-12") Then

BubbleEvent = False

SBO_Application.SetStatusBarMessage("Check Series and Supplier", SAPbouiCOM.BoMessageTime.bmt_Short, True)

Exit Sub

End If

End If

Thank you

Accepted Solutions (0)

Answers (3)

Answers (3)

Johan_H
Active Contributor
0 Kudos

Just a quick word of caution about the basic logic you are employing: what happens when a supplier moves to a different state ?

Former Member
0 Kudos

Hun, i've never came across such scenario where people do good business jumping around states. Opening up branches is ok.

Johan_H
Active Contributor
0 Kudos

Like I said, its just a word of caution. If you know for sure that this can't happen, you will have no problem. But remember Murpy's Law:

If it can happen, it will happen.

Former Member
0 Kudos

Hi Siva,

Thanks for yor reply

Using "StartsWith" gives lost focus error.

Regards

Former Member
0 Kudos

Hi,

Try this code.it will work.

Public BPCode As SAPbouiCOM.EditText

Public Series As SAPbouiCOM.ComboBox

If pVal.ItemUID = "1" And pVal.BeforeAction = True And (oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Or oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE) Then ' Validation

BPCode = oForm.Items.Item("4").Specific

Series = oForm.Items.Item("88").Specific

If not Series .StartsWith("DEL") Then

BubbleEvent = False

SBO_Application.SetStatusBarMessage("Check Series and Supplier", SAPbouiCOM.BoMessageTime.bmt_Short, True)

Exit Sub

End If

End If

Regards,

Siva