cancel
Showing results for 
Search instead for 
Did you mean: 

Copy data from SAP script

Jordan2
Explorer
0 Kudos

How do I SAP script to copy and paste, so it can go into excel as Ctrl + C, Ctrl + V doesn't record any sort of actions when recording a macro. I have 6 columns to copy the entirety of:

- Document

- Cust. No.

- Customer Name

- Doc. Date

- Net Value

- Internal Comment

session.findbyID("wnd[0]").maximize
session.findbyID("wnd[0]/tbar[0]/okcd").Text = "zvak"
session.findbyID("wnd[0]").sendVKey 0
session.findbyID("wnd[0]/usr/chkP_ANG").Selected = False
session.findbyID("wnd[0]/usr/chkP_GUT").Selected = False
session.findbyID("wnd[0]/usr/ctxtS_VBELN-LOW").Text = ""
session.findbyID("wnd[0]/usr/ctxtS_KUNNR-LOW").Text = ""
session.findbyID("wnd[0]/usr/chkP_GUT").SetFocus
session.findbyID("wnd[0]").sendVKey 8
session.findbyID("wnd[0]/tbar[1]/btn[33]").press
session.findbyID("wnd[1]/usr/subSUB_CONFIGURATION:SAPLSALV_CUL_LAYOUT_CHOOSE:0500/cntlD500_CONTAINER/shellcont/shell").setCurrentCell 33, "TEXT"
session.findbyID("wnd[1]/usr/subSUB_CONFIGURATION:SAPLSALV_CUL_LAYOUT_CHOOSE:0500/cntlD500_CONTAINER/shellcont/shell").selectedRows = "33"
session.findbyID("wnd[1]/usr/subSUB_CONFIGURATION:SAPLSALV_CUL_LAYOUT_CHOOSE:0500/cntlD500_CONTAINER/shellcont/shell").clickCurrentCell
session.findbyID("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[0]/shell").SelectAll

TIA.

Accepted Solutions (0)

Answers (1)

Answers (1)

oliroe82
Explorer
0 Kudos

Hi. Are you trying to input data into SAP or extract SAP data into Excel?

Excel into SAP can just be done by name the cell as a variable and using that variable for a field in SAP (as below)

objSess.findById("wnd[0]/usr/ctxt*PROJ-PSPID").Text = Var1

Jordan2
Explorer
0 Kudos
Hi,
Jordan2
Explorer
0 Kudos
Hi, I'm trying to get it from SAP to excel. I've just put my full code for when it gets to where I'm trying to copy all the grid tables data