cancel
Showing results for 
Search instead for 
Did you mean: 

UI: show form created with Screen Painter (.srf)

Former Member
0 Kudos

Hello

I have created a form in the Screen Painter - can somebody please post the code needed for using this form in an add-on application??

This is what i've got - and it's not working: ( i have connected to SAP BO already)

-


Dim XMLDoc1 As New MSXML2.DOMDocument

XMLDoc1.load("VareAddOn.srf")

SBO_Application.LoadBatchActions(XMLDoc1.xml)

Dim oForm As SAPbouiCOM.Form

oForm = SBO_Application.Forms.Item("frmVareOpslag")

oForm.Visible = True

-


VareAddOn.srf is the form i created in screen painter, and frmVareOpslag is the UID for the form.

I get an error when i run the project (a NullReferenceException). Please help!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Henrik,

I had problems at first because in the SRF file there is always the following line at the beginning of the file (the XML object doesn't seem to like it for some reason):

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

I usually copy the SRF file to an XML file and delete the line above. My code is as follows.... (fmDiscount is my FormUID)

Set oXMLForm = New MSXML.DOMDocument

oXMLForm.Load ("itemdisc.xml")

SBO_Application.LoadBatchActions oXMLForm.xml

Set oDiscForm = SBO_Application.Forms.Item("fmDiscount")

Hope this helps....

Daniel

Former Member
0 Kudos

Another method to fix an .srf is to open it in Notepad and then save it again. This is a Unicode file, and Notepad adds some codes at the beginning that some programs require for reading Unicode.

I simply associate the file type .srf with Notepad, so that I can double-click it from explorer to open it and then I save it as .xml.