Skip to Content
0

How to place an EditText at a precise position on a System Form?

May 25, 2017 at 11:17 AM

68

avatar image

Hi, everybody

Please see the attached picture which explains my problem. I cannot place an EditText on a system form at the exact place I wish. If I place it too near the vertical centre line, SAP pushes it to the right hand side (not at all the place I intend!).

My theory (?) is that this happens because the SAP System Form is sizable, not fixed.

Anyone has met with such a problem?

Here is my code:

 oItem3 = oARInvForm.Items.Item("Static2")
oNewItem = oARInvForm.Items.Add("EditText2", SAPbouiCOM.BoFormItemTypes.it_EXTEDIT)
            oNewItem.Left = oItem3.Left + 100 ' 80
            oNewItem.Width = 200
            oNewItem.Top = oItem3.Top
            oNewItem.Height = 70
            oEditText = oNewItem.Specific
            oEditText.DataBind.SetBound(True, "OINV", "U_BillingAddress")

Any help will be much appreciated.

Thanks

Leon

capture.jpg (335.1 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Best Answer
ANKIT CHAUHAN
May 25, 2017 at 12:13 PM
1

Hi Leon,

SDK Help Center says:

  • Put your items in the empty space you have on the screen.

In this issue, I could notice there is no "LinkTo" property provided in your sample code. Try to set that property and let me know your concerns after the testing.

Kind regards,

ANKIT CHAUHAN

SAP SME Support

Share
10 |10000 characters needed characters left characters exceeded
Danilo Kasparian May 25, 2017 at 02:06 PM
1

Hi Leon,

I saw this problem many times, I usually avoid using this middle part because if the form is small it will not fit.

Anyway, if there is no way to avoid it, you can try to LinkTo your static to your EditText as usual, then LinkTo your EditText for example to the Static "Customer Ref No", not sure which is the Item Id or even the "Local Currency" Combo Item Id.

Hope it works

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi, Danilo

Thanks for your reply.

I will try your suggestion during the week end and will let you know how it goes.

It would be very sad indeed if we cannot choose where to put our items on the System Form. This problem has been nagging me for years.

.

In a recent post, I got a similar problem, but with a user form. I finally found out (with Ankit's help) that it was because my form was of type sizable. We always have this problem when the form is sizable. If we make the form fixed, the problem disappears.

.

The problem with System Forms is that they are always Sizable, and cannot be made Fixed.

I am trying to find ways to bypass this problem.

I also got the idea that you proposed, but have not yet tested it.

I am also thinking if we could open the System Form first, and only then in the AfterFormLoad event create our item we in the System Form.

.

The tendency for SAP to push away our items is more serious than this because:

(a) SAP does not divide the screen into 2 vertical halves, but into 4 quadrants. There is a vertical line and a horizontal one which divide the screen into 4 equal quadrants.

(b) the dividing quadrant lines are very thick.

(c) If any item falls on one of these very thick lines, SAP simply pushes it sideways or downwards depending where our item is.

Please continue sharing your ideas. Even if they are wrong, they can help to find the correct solution.

Best Regards,

Leon





0
Leon Lai Kan May 26, 2017 at 12:42 PM
-1

Hi, Ankit

I tried your code today. I am glad to inform you that the code works perfectly!

Now, I can place my StaticTexts and EditTexts anywhere on the form, and SAP will not move them.

It's great!

I found it works also if you LinkTo the StaticText to a Reference Item (Item "80") and then

also LinkTo the EditText to the SAME Reference Item, although in this case there will be no connecting line between the EditText and StaticText. If I use your method, then we also have the connecting line like in SAP.

Many thanks to you and also to Danilo (I gave him marks) who hinted at the same idea.

Best Regards

Leon

Share
10 |10000 characters needed characters left characters exceeded
Leon Lai Kan May 25, 2017 at 12:51 PM
0

Hi, Ankit

We used the foll. code, and everything seems right!

.

oItem3 = oARInvForm.Items.Item("Static2")

oNewItem = oARInvForm.Items.Add("EditText2",

SAPbouiCOM.BoFormItemTypes.it_EXTEDIT)

oNewItem.Left = oItem3.Left + 200 'oItem3.Left + 100

oNewItem.Width = 200

oNewItem.Top = oItem3.Top

oNewItem.Height = 70

oEditText = oNewItem.Specific

oEditText.Item.LinkTo = oStaticText.Item.UniqueID ' // Code 1

oEditText.DataBind.SetBound(True, "OINV", "U_BillingAddress")

.

However, we have a few comments:

We are familiar with the LinkTo property. We use it to draw a connecting line between the Static Text and the Edit Text as in the SAP system Forms, but we always use it in the reverse way, like this:

oStaticText.Item.LinkTo = oEditText.Item.UniqueID ' // Code 2

If we use code 2, it's disastrous in this present example. If we reverse and use code 1, it appears fine for the moment.

But if the StaticText is just a little bit to the right of the vertical middle line and we link as in code 1, then BOTH the Static and the Edit are displaced to the extreme right (although they are near each other).

.

This comes out as a big surprise to us, so we would like you to comment on our findings.

So, our problem is only half solved.

Best Regards,

Leon Team

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hi Leon,

Check this:

SAPbouiCOM.StaticText oStaticNew;
SAPbouiCOM.Item oExistingOne= (SAPbouiCOM.Item)oOrderForm.Items.Item("80");
oNewItem = oOrderForm.Items.Add("Static", SAPbouiCOM.BoFormItemTypes.it_STATIC);
oNewItem.Top = oExistingOne.Top + 15;
oNewItem.Left = oExistingOne.Left;
oStaticNew = (SAPbouiCOM.StaticText)oNewItem.Specific;
oStaticNew.Caption = "TEST";
            


SAPbouiCOM.EditText oEditNew;
SAPbouiCOM.Item oExistingOneNew = (SAPbouiCOM.Item)oOrderForm.Items.Item("80");
oNewItem = oOrderForm.Items.Add("Edit", SAPbouiCOM.BoFormItemTypes.it_EDIT);
oNewItem.Top = oExistingOneNew.Top + 15;
oNewItem.Left = oExistingOneNew.Left+90;
oEditNew = (SAPbouiCOM.EditText)oNewItem.Specific;


try
{
     oEditNew.DataBind.SetBound(true, "ORDR", "U_TEST");
     oEditNew.Item.LinkTo = "15";
     oStaticNew.Item.LinkTo = oEditNew.Item.UniqueID;
}


catch (Exception ex)
{
     string str = ex.Message;
}

Hope it helps!

Kind regards,

ANKIT CHAUHAN

SAP SME Support

0

Hi, Ankit

I am trying your suggestion.

Where is Item("80") on the Sales Order Form? ///' I just found it: the Choose From List

Is there anyway (other than turning System Information On and hunting with the mouse) we can discover the answer?

Thanks

Leon

0

Hi Leon,

"80" is the Choose From List Icon just next to 'Contact Person' ComboBox. Here is how you can get access to Form Items.

foreach (Item item in form.Items)
{

    if (BoFormItemTypes.it_MATRIX == item.Type)

    {
        var matrix = (Matrix)item.Specific;
    }
}

Kind regards,

ANKIT CHAUHAN

SAP SME Support

0
Leon Lai Kan May 25, 2017 at 02:01 PM
0

Hi Ankit,

I experimented with the SDK Sample: 11. SystemFormManipulation, and I get the SAME STRANGE RESULTS.

See attached pictures, and let me have your opinion


screen1.jpg (198.4 kB)
screen-2.jpg (203.2 kB)
screen-3.jpg (234.6 kB)
Share
10 |10000 characters needed characters left characters exceeded