Skip to Content
avatar image
Former Member

Export attachments from SAP

Hi Team,

Happy Christmas to All.

I want to automatically download the attachment from SAP which are uploaded through T-code FB03.

I have recorded below script for downloading the attachments but save as doalog box is not getting recorded.

If Not IsObject(application) Then

   Set SapGuiAuto  = GetObject("SAPGUI")

   Set application = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(connection) Then

   Set connection = application.Children(0)

End If

If Not IsObject(session) Then

   Set session    = connection.Children(0)

End If

If IsObject(WScript) Then

   WScript.ConnectObject session,     "on"

   WScript.ConnectObject application, "on"

End If

session.findById("wnd[0]").maximize

session.findById("wnd[0]/tbar[0]/okcd").text = "/nfb03"

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/usr/txtRF05L-GJAHR").setFocus

session.findById("wnd[0]/usr/txtRF05L-GJAHR").caretPosition = 4

session.findById("wnd[0]").sendVKey 0

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

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

session.findById("wnd[1]/usr/cntlCONTAINER_0100/shellcont/shell").currentCellColumn = "BITM_DESCR"

session.findById("wnd[1]/usr/cntlCONTAINER_0100/shellcont/shell").selectedRows = "0"

session.findById("wnd[1]/usr/cntlCONTAINER_0100/shellcont/shell").contextMenu

session.findById("wnd[1]/usr/cntlCONTAINER_0100/shellcont/shell").selectContextMenuItem "%ATTA_EXPORT"

session.findById("wnd[1]/tbar[0]/btn[0]").press

Could somone help me to get the script for downloading attachments from SAP T-code Fb03.

Thanks for your support.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Dec 29, 2014 at 06:36 AM

    Hi Team,

    I forgot to attach the image

    If Not IsObject(application) Then
       Set SapGuiAuto  = GetObject("SAPGUI")
       Set application = SapGuiAuto.GetScriptingEngine
    End If
    If Not IsObject(connection) Then
       Set connection = application.Children(0)
    End If
    If Not IsObject(session) Then
       Set session    = connection.Children(0)
    End If
    If IsObject(WScript) Then
       WScript.ConnectObject session,     "on"
       WScript.ConnectObject application, "on"
    End If
    session.findById("wnd[0]").maximize
    session.findById("wnd[0]/tbar[0]/okcd").text = "/nfb03"
    session.findById("wnd[0]").sendVKey 0
    session.findById("wnd[0]/usr/txtRF05L-BELNR").text = "100001235"
    session.findById("wnd[0]/usr/ctxtRF05L-BUKRS").text = "3300"
    session.findById("wnd[0]/usr/txtRF05L-GJAHR").text = "2015"
    session.findById("wnd[0]/usr/txtRF05L-GJAHR").setFocus
    session.findById("wnd[0]/usr/txtRF05L-GJAHR").caretPosition = 4
    session.findById("wnd[0]").sendVKey 0

    session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX"
    session.findById("wnd[0]/titl/shellcont/shell").selectContextMenuItem "%GOS_VIEW_ATTA"
    session.findById("wnd[1]/usr/cntlCONTAINER_0100/shellcont/shell").currentCellColumn = "BITM_DESCR"
    session.findById("wnd[1]/usr/cntlCONTAINER_0100/shellcont/shell").selectedRows = "0"
    session.findById("wnd[1]/usr/cntlCONTAINER_0100/shellcont/shell").contextMenu
    session.findById("wnd[1]/usr/cntlCONTAINER_0100/shellcont/shell").selectContextMenuItem "%ATTA_EXPORT"

    After this script line, i get the popup box which i have attached in JPG format for your reference.

    Could any of you help me to get the complete script which will enable me to download 1 by 1 attachments on the basis of the information pulled from the excel through below script line

    session.findById("wnd[0]/usr/txtRF05L-BELNR").text = "100001235"

    session.findById("wnd[0]/usr/ctxtRF05L-BUKRS").text = "3300"

    session.findById("wnd[0]/usr/txtRF05L-GJAHR").text = "2015"

    Thanks for your support and will be waiting for better solution on this.


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      This solution requires an ABAP resource, I'm sorry, including some other IT guy to configure some folder on your network where the attachments will be downloaded 😔

      If you get help of a developer I can share the ABAP code for him/her to start with.

      Michael

  • avatar image
    Former Member
    Jul 17, 2016 at 07:48 PM

    Hi

    I have the same problem, i can't open the window explorer for atachment from fb03 with VBA, I have been reading ABAP resource but is not working yet.

    Someone can reply with code? Or is not possible, thanks

    Bst Regardings

    Lucas

    Add comment
    10|10000 characters needed characters exceeded