Skip to Content
author's profile photo Former Member
Former Member

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


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



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!

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Apr 19, 2004 at 12:00 PM

    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....


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.