on 09-15-2010 1:44 PM
hi experts
i need to get the DocEntry while handling the item pressed event
If pVal.ItemUID = "1" And (pVal.ActionSuccess = True) And pVal.FormMode = 2 Then
rs.DoQuery("exec SP_Update_Attendance '" & VDOC & "'")
end if
i declared VDOC as integer variable, i need to get the docEntry of this active form into this variable
how to do that?
please help me
thanks in advance
ajith
Hi
Try using this method.
Public Sub GetNewObjectCode( _
ByRef ObjectCode As String _
)
or
Public Function GetNewObjectKey() As String
Both are members of Company object.
If you have any issue using these methods, just use the "Add" action of "FormDataEvents" event.
Private WithEvents SBO_Application As SAPbouiCOM.Application
Private Sub SBO_Application_FormDataEvent( ByRef BusinessObjectInfo As SAPbouiCOM. BusinessObjectInfo , ByRef BubbleEvent As Boolean) Handles SBO_Application.FormDataEvent
Anoop
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
thank you for reply
can explain bit more regarding the same ,
this is my code
If pVal.ItemUID = "1" And (pVal.ActionSuccess = True) And pVal.FormMode = 3 Then
Dim VDOC As Integer
Dim rs As SAPbobsCOM.Recordset = objMain.objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
rs.DoQuery("select max(DocEntry) from [@ZAM_CO1]")
VDOC = rs.Fields.Item(0).Value
Dim OCB As SAPbouiCOM.ComboBox
OCB = objForm.Items.Item("24").Specific
If OCB.Selected.Value = "Granted" Then
rs.DoQuery("exec SP_Update_Attendance '" & VDOC & "'")
End If
Me.GetDocNumdStatusDates()
End If
here i am taking the DocEntry value from the database by using the max function,i think its not a right method ,
i couldn't get you exactly,what should i do with the above function which is mentioned in your reply ,could you please help me to solve this issue,
i searched forum too regarding this ,but i couldn't make out anything.
thanks in advance
ajith
ajith,
The standard GetNewObjectKey is not valid for UDO-s
2 solutions exist for you problem.
a, Based on FormTypeEx and formdataevent. In this case you need a field (edittext which connected to docentry field)
Private Sub sbo_application_FormDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean) Handles sbo_application.FormDataEvent
If BusinessObjectInfo.BeforeAction = False AndAlso BusinessObjectInfo.FormTypeEx = "YOURFORMID" Then
If BusinessObjectInfo.EventType = BoEventTypes.et_FORM_DATA_ADD Then
Dim objForm As SAPbouiCOM.Form = sbo_application.Forms.Item(BusinessObjectInfo.FormUID)
Dim VDOC As Integer
Dim oEditText As SAPbouiCOM.EditText = objForm.Items.Item("FIELD_HOLDS_DOCENTRY").Specific
VDOC = oEditText.Value
Dim OCB As SAPbouiCOM.ComboBox
OCB = objForm.Items.Item("24").Specific
If OCB.Selected.Value = "Granted" Then
Dim rs As SAPbobsCOM.Recordset = objMain.objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
rs.DoQuery("exec SP_Update_Attendance '" & VDOC & "'")
End If
Me.GetDocNumdStatusDates()
End If
End If
end sub
b, Based on Sp_TransactionNotification (UDO is connected there)
You can execute your stored procedure directly on SQL server. This is the safest solution. Here you may know, the combobox (24) is which data connected.
Regadrs
János
hi
thank you so much for reply
i think my problem is almost solved now,
i used Sp_transactionNotification,the code which i created is the following
if(@object_type='CO_OBJECT' and @transaction_type in ('A','U'))
begin
select @status=U_Status from [@ZAM_CO1] where DocEntry = @list_of_cols_val_tab_del
if (@status = 'Granted')
begin
exec SP_Update_Attendance @list_of_cols_val_tab_del
end
end
more over i need to display the message using @error_message variable, which is returned by the SP
i have one doubt usually functions only will return values ,but here SP too how its possible ?,and how i can catch this in message in code.
thanks a lot
regards
ajith
Hello
These is no way. You may use a custom table to get the return value by the following steps:
1. Create a Table (any table not UDF, from SQL)
2. Put the docentry and the return value inside, and a flag, where you mark this is a new message or an old message.
3. When your code runs, you fails, read this value from the table, and change the flag
Regards
János
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.