0

I would like to automate several transactions, so I import my data into a buffer file (I would prefer ".txt" format).

Then I will use this buffer file which will always have the same name for the example (TEST.txt).

Then I want to copy this data to transfer it to my Excel file, the file where I have to paste all my data (I'm going to call it FOS).

  Public Sub RunGUIScript()
  Dim W_Ret As Boolean
 ' Connect to SAP
  W_Ret = Attach_Session
  If Not W_Ret Then
  Exit Sub
  End If
  On Error GoTo myerr
  objSess.findById("wnd[0]/usr/tabsTABSTRIP_TABBL1/tabpUCOM2/ssub%_
  SUBSCREEN_TABBL1:RFBILA00:0002/ctxtBILAGKON").text = "3"
  objSess.findById("wnd[0]/usr/tabsTABSTRIP_TABBL1/tabpUCOM2/ssub%_
  SUBSCREEN_TABBL1:RFBILA00:0002/ctxtBILAVART").text = "1"
  objSess.findById("wnd[0]/usr/tabsTABSTRIP_TABBL1/tabpUCOM2/ssub%_
  SUBSCREEN_TABBL1:RFBILA00:0002/ctxtBILASKAL").text = 
  "0/0"
  objSess.findById("wnd[0]/usr/tabsTABSTRIP_TABBL1/tabpUCOM2/
  ssub%_SUBSCREEN_TAB BL1:RFBILA00:0002/ctxtBILASKAL").setFocus
  objSess.findById("wnd[0]/usr/tabsTABSTRIP_TABBL1/tabpUCOM2/
  ssub%_SUBSCREEN_TAB BL1:RFBILA00:0002/ctxtBILASKAL").caretPosition = 3
  objSess.findById("wnd[0]/tbar[1]/btn[8]").press
  objSess.findById("wnd[0]/mbar/menu[0]/menu[3]/menu[2]").select
  objSess.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/
  sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").select
  objSess.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/
  sub:SAPLSPO5: 0150/radSPOPLI-SELFLAG[1,0]").setFocus
  objSess.findById("wnd[1]/tbar[0]/btn[0]").press
  objSess.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "TEST.TXT"
  objSess.findById("wnd[1]/usr/ctxtDY_FILENAME").caretPosition = 11
  objSess.findById("wnd[1]/tbar[0]/btn[0]").press
  Exit Sub

After executing this code I would like to search for the file at this path: C:\Users\p100789\Documents\SAP\SAP GUI then paste it into the Excel FOS file on a sheet called Table30.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Guimove
  • 17
  • 7
  • please help me i struggle :( – Guimove Jun 05 '19 at 12:26
  • This sort of questions were asked thousands time ([1](https://stackoverflow.com/questions/45465172/export-sap-to-excel-completely-via-vba) [2](https://stackoverflow.com/questions/24297063/pulling-data-from-sap-using-excel-macros) [3](https://stackoverflow.com/questions/50009772/selecting-sap-fields-using-a-do-loop-vba) [4](https://stackoverflow.com/questions/19452461/vba-pulling-data-from-sap-for-dummies/19456656#19456656)), don't be lazy to search – Suncatcher Jun 06 '19 at 12:32
  • Possible duplicate of [VBA pulling data from SAP for dummies](https://stackoverflow.com/questions/19452461/vba-pulling-data-from-sap-for-dummies) – Suncatcher Jun 06 '19 at 12:33

0 Answers0