on 04-07-2009 10:34 AM
Hi
The code below has been adapted from SAP examples, but it refuses to hide the Item 34 (Unit Price -which exists in Pane 0) on the form 150 (Item Master Data)
I am a novice at this, so I hope many of you will know the solution instantly
Once this issue is resolved, I hope to hide an item at Pane level.
I am using VB Express 2008 and running in SB1 2007A PL47.
Private Sub Hide_Item_ItemEvent(ByVal FormUID As String, ByVal pVal As SAPbouiCOM.ItemEvent, ByVal BubbleEvent As Boolean)
If pVal.FormType = 150 And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD And pVal.BeforeAction = True Then
Try
Dim oForm As SAPbouiCOM.Form
Dim oItem As SAPbouiCOM.Item
oForm = SBO_Application.Forms.Item(FormUID)
oItem = oForm.Items.Item("34")
oItem.Visible = False
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
Thanks Tibi for the FromPane/ToPane example
Thanks Petr for trying the code !
If I have understood your suggestion correctly, I have inserted a messagebox in the Try to see if the code is run. There is no pop-up message. Therefore, the code is not run. Does this suggest the Sub command is wrong ?
Private Sub Hide_Item_ItemEvent(ByVal FormUID As String, ByVal pVal As SAPbouiCOM.ItemEvent, ByVal BubbleEvent As Boolean)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried exactly your code as
If pVal.FormType = 150 And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD And pVal.BeforeAction = True Then
Try
Dim oForm As SAPbouiCOM.Form
Dim oItem As SAPbouiCOM.Item
oForm = SBO_Application.Forms.Item(FormUID)
oItem = oForm.Items.Item("34")
oItem.Left = -500
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
and it works. I think that the problem on your side is in itemevent, because you call the action from Hide_Item_ItemEvent(..
Try to add inside the sub breakpoint and check, if is this code fired or not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think you're not doing all the hiding. I've tried with Item.left =5000 and it works.
The only thing is the label is still there . You also have to move the label ( uid 52).
The PaneLevel thing also works. oItem.FromPane =100; oItem.ToPane =100;
You should also try it with the event on BeforeAction = false
Edited by: Tibi Ionel on Apr 7, 2009 1:01 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you really need the item not to show ? You could make it Enable false ( it will show but won't be editable).
You may also try to modify it's FromPane and ToPane properties to a panelevel that is not shown. ( like 50).
Or you can try adding a Label on top of it .
These are just suggestions, i haven't tried any.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You cannot hide system item on system form. The solution is move the edittext out of form with oitem.left = -500
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
9 | |
8 | |
5 | |
4 | |
3 | |
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.