Skip to Content

How to update User Defined Form items via xml?

Sap, Developers?

I've been trying to speed up the form drawing of our add-ons using xml via LoadBatchActions. What I want to do is basically two things:

  • While opening a user defined form, manipulate its xml string (using GetAsXml()) to include valid values into comboboxes dinamically;
  • On changing form mode or navigate through the records, update the form items acting on properties like enabled and visible and also reload valid values of the comboboxes.

So far, I managed to do it only on form properties, for instance, its title and position, but when it comes to the form items, everything seems to be ignored by the LoadBatchActions call. Here is an exemple of a xml used to update a user defined form.

<?xml version=\"1.0\" encoding=\"UTF-16\"?>

<Application>
<forms>
<action type=\"update\">

<form uid=\"1621670730\" left=\"399\" top=\"0\" width=\"759\" height=\"596\" client_width=\"725\" client_height=\"558\"> <datasources>

<DataTables>
<action type=\"add\" />
</DataTables>

<dbdatasources>

<action type=\"add\" />
</dbdatasources>
<userdatasources>
<action type=\"add\" />
</userdatasources>
</datasources>

<Menus />
<items>
<action type=\"update\">
<item enabled=\"0\" uid=\"ETDocNum\" />
<item enabled=\"1\" uid=\"FDTrackCT\" />
<item enabled=\"1\" uid=\"FDCCe\" />
<item enabled=\"1\" uid=\"FDDocAnt\" />
</action>
</items>
<ChooseFromListCollection>
<action type=\"add\" />
</ChooseFromListCollection>
<DataBrowser />
<Settings />
</form>
</action>
</forms>
</Application>

Thanks,

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jun 24, 2016 at 02:31 PM

    Hi Abel,

    Remove all tags not used.

    Here is a working sample.

    <Application>

    <forms>

    <action type="update">

    <form uid="">

    <items>

    <action type="update">

    <item uid="">

    </item>

    </action>

    </items>

    </form>

    </action>

    </forms>

    </Application>

    You need to set the uid of the form and the uid of the item at runtime.


    Pedro Magueija


    LinkedIn Logo View Pedro Magueija's profile on LinkedIn
    Follow @pedromagueija on Twitter

    ps: I once tried to remove all valid values with XML, but there was an issue in the SDK that made it impossible. Adding is possible I'll check if that is still the case and if so, report to SAP. Message was edited by: Pedro Magueija

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Pedro,

      Application.GetLastBatchResult(); doesn't return any erros. It is not very helpful.

      I don't recall now exactly if I tried to enable/disable items on user forms, so I am gonna check it out. On system forms I did it and it doesn't work as you said.

      I will also check the auto managed attribute.

      I'll post my tests as soon as I can.

      Thank you for your help!

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.