Skip to Content
avatar image
Former Member

Excel VBA Script for Services for Object ToolBox - the "Import File" dialog Box

Dear Community,

I'm trying to automate the creation of attachments using Services for Object in SAP transaction IW22 via Excel VBA.

My issue is similar to what Former Member  faced 3 years ago, which was solved together with @Script Man  in this thread:

From what I understand from the discussion, the solution was to start a script which loops to detect for the "Import File" window and if found send the filename string via sendkey method to the dialog box. Concurrently, run the main script to execute Services for Object create attachment i.e. the following:

session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX"

session.findById("wnd[0]/titl/shellcont/shell").selectContextMenuItem "%GOS_PCATTA_CREA"

(****the "Import File" dialog box pops here****)

Is there a better way to do this i.e. Is there any method or properties within the SAP Scripting API or VBA that allow to send data to the "Import File" dialog box directly?

BTW, script recording does not record the selection of files in the "Import File" dialog box or capture any path and filename string. This is because the dialog box is not an SAP screen but a native Windows screen.

Thanks in advance for any tips.


Message was edited by: Sayuti Azmi

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 07, 2013 at 11:43 PM

    Hi Sayuti. In another thread I have posted an VBA coding how USER32 API can handle this (in that case for SaveAs Dialog called by SAP). For development I use Microsoft 'Spy' to get the right indicators for identifing.

    Hope this give you some ideas. Br, Holger

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      The IW22 is the transaction in which I need the file to be uploaded. The variable mynotification is to take the IW22 Notification number as argument.

      You can disregard this variable.and replace the subroutine SAP_IW22_Upload with your codes above.