cancel
Showing results for 
Search instead for 
Did you mean: 

How to Validate When Click Add Button

Former Member
0 Kudos

Hi,

Iam using SDK - 2005 SP1 my problem is

Iam execute a code (Using Update Method to store the values to my user tables.) when

i click the add button my code is working fine and update the data as well as PO table and User tables.

.

For ex : In PO Form if i forget to enter the data in warehouse coloumn and click ADD Button SAP default Error Message is shown in status bar is fine .

My Requirement is If SAP default Error Message is shown in status bar my code is not Execute when i enter the warehouse coloumn and click ADD Button only save the PO Document as well as my code is executed.

How do i validate Pl help me out. pl give me some code you have

Regards

Jambu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

In Sbo there is a Itemevent called validate.

You add the code for the fields that need to be validated as shown below

if pval.beforeaction=true then

if pVal.EventType= SAPbouiCOM.BoEventTypes.et_VALIDATE Then

If pVal.ItemUID = "TxtWare" Then

' Add your validation logic if fails make give error message Bubble event false

BubbleEvent = False

End If

End if

End if

and you create a function called Validate Data

in which any of your validation fails return false

in beforeaction=true call the validate method if it returns false,give error message Bubble event false

regards

Vishnu

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Any other method is there ?

Regards

Jambu

Former Member
0 Kudos

Hi,

use the Application.FormDataEvent instead of the Application.ItemEvent

like this (vb.net code):

Private Sub SBO_Application_FormDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean) Handles SBO_Application.FormDataEvent

If BusinessObjectInfo.BeforeAction = False _

And BusinessObjectInfo.ActionSuccess = True _

And BusinessObjectInfo.Type = SAPbobsCOM.BoObjectTypes.oPurchaseOrders Then

If BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD Then

'your Code for Add

ElseIf BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE Then

'Your Code for Update

End If

End If

End Sub

I hope this helps

Former Member
0 Kudos

Hi,

I tried pval.ActionSuccess=true , Still iam facing a problem.

my code is not executed in both the case

1.With Status Bar message shown

2.without status Bar Message. PO is added if any other declaration i made using

this pval.ActionSuccess=true

Regards

Jambu

Former Member
0 Kudos

Hi,

I tried with BeforeAction = False ,Still iam facing problem both

will shown the status bar message and My code is executed and update

the records in user table but PO is not allow to save.

When PO is saved without status bar message at the same time my code

is executed and update the records.

When PO is not save at the same time my code is also not executed

and not update the records in user table.

If any method is there how to get a system status bar message ?

Regards

JAmbu

Former Member
0 Kudos

Hi

try this.

If pVal.FormType = "142" And pVal.FormMode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Then

If pVal.ItemUID = "1" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.BeforeAction = true and pval.ActionSuccess=trueThen

'Your code here

End if

Endif

Endif

if it helps please reward the points.it will surely help you

Former Member
0 Kudos

Hi,

Iam not check the particular field (WareHouse) so icant give

If pVal.ItemUID = "TxtWare".

When i click ADD Button i want to validate

IF any <b>status bar message is there</b>(By Default SAP Status bar message ) then

My Code <b>is not executed</b> (Update Records in User Table)

ELSE

<b>My Code ist executed</b> (Update Records in User Table)

ENDIF

iam Using Following

If pVal.FormType = "142" And pVal.FormMode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Then

If pVal.ItemUID = "1" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.BeforeAction = True Then

End if

Endif

Endif

How to validate this. Now Default when i click ADD Button My code is Executed

as well as Status Bar Message is also shown.

Regards

Jambu

Former Member
0 Kudos

Hi

then you have to make a simple change in condition (before action=false)

If pVal.FormType = "142" And pVal.FormMode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Then

If pVal.ItemUID = "1" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.BeforeAction = FalseThen

End if

Endif

Endif