cancel
Showing results for 
Search instead for 
Did you mean: 

Hide an Item

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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)

Former Member
0 Kudos

try it as

Private Sub Hide_Item_ItemEvent (ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles Me.Load

Answers (4)

Answers (4)

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

I have tried disabling the Item, but it is still editable !

I am not sure how to move the item to another Pane ...

... I think there is something fundamentally flawed with the code, which I cannot identify ...

Former Member
0 Kudos

You cannot hide system item on system form. The solution is move the edittext out of form with oitem.left = -500

Former Member
0 Kudos

OK, thanks!

I have replaced

oItem.Visible = False

with

oItem.Left = -500

but the Item is still visible !

(I even tried -5000 !)