cancel
Showing results for 
Search instead for 
Did you mean: 

Export attachments from SAP

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

Could anyone reply to this post if you have any answer or please confirm that it is not possible to get the script for above query?

michael_hobbins
Active Participant
0 Kudos

Hello Dan: we've worked with attachment downloads sometime ago, but with a very different approach. The solution was an ABAP report. Here are some details, if you think it's usefull I'll give you more details.

The idea was to download the attachments of the purchase requests. Table SRGBTBREL has a record of each attachment in SAP (as far as I know for any module). Searching there we got an ID for the attachment, which is used with function module  SO_DOCUMENT_READ_API1 to download the attachment to a file on our network.

Cheers,

Michael

Former Member
0 Kudos

Thanks Michael for the reply but through which T-code should i download these attachments as i will be end user and not developer in SAP.

Please do let me know if there is any way to download the attachments.

michael_hobbins
Active Participant
0 Kudos

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