Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SAP GUI SCRIPTiNG data from excel the script and integration with vbs works, but instead insert all the data one by one on the spreadsheet,

SAP GUI SCRIPTiNG data from excel
the script and integration with vbs works, but instead insert all the data one by one on the spreadsheet, is there a better way to export the data from excel to SAP? I have materials, Tarq. Quantity and Net Price. Instead put all of this data on my macro, would like to insert some function or code on vba to help me with this automatization. the code, part of, is:
session.FindById("wnd[0]").Maximize
session.FindById("wnd[0]/tbar[0]/okcd").Text = "me31k"
session.FindById("wnd[0]").SendVKey 0
session.FindById("wnd[0]/usr/ctxtEKKO-LIFNR").Text = Sheet2.Cells(5, 6).Value
session.FindById("wnd[0]/usr/ctxtRM06E-EVART").Text = Sheet2.Cells(3, 13).Value
session.FindById("wnd[0]/usr/ctxtRM06E-VEDAT").Text = Sheet2.Cells(3, 14).Value
session.FindById("wnd[0]/usr/ctxtEKKO-EKORG").Text = Sheet2.Cells(3, 15).Value
session.FindById("wnd[0]/usr/ctxtEKKO-EKGRP").Text = Sheet2.Cells(3, 16).Value
session.FindById("wnd[0]/usr/ctxtEKKO-EKGRP").SetFocus
session.FindById("wnd[0]/usr/ctxtEKKO-EKGRP").CaretPosition = 3
session.FindById("wnd[0]").SendVKey 0
session.FindById("wnd[0]/usr/ctxtEKKO-KDATE").Text = Sheet2.Cells(12, 3).Value
session.FindById("wnd[0]/usr/txtEKKO-KTWRT").Text = "1000000"
session.FindById("wnd[0]/usr/txtEKKO-KTWRT").SetFocus
session.FindById("wnd[0]/usr/txtEKKO-KTWRT").CaretPosition = 7
session.FindById("wnd[0]/tbar[1]/btn[5]").Press
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/ctxtEKPO-EMATN[3,0]").Text = "543"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/ctxtEKPO-EMATN[3,1]").Text = "544"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/ctxtEKPO-EMATN[3,2]").Text = "545"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/ctxtEKPO-EMATN[3,3]").Text = "546"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/ctxtEKPO-EMATN[3,4]").Text = "547"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/ctxtEKPO-EMATN[3,5]").Text = "548"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-KTMNG[5,0]").Text = "10"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-KTMNG[5,1]").Text = "5"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-KTMNG[5,2]").Text = "15"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-KTMNG[5,3]").Text = "100"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-KTMNG[5,4]").Text = "200"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-KTMNG[5,5]").Text = "10"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-NETPR[7,0]").Text = "150"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-NETPR[7,1]").Text = "50"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-NETPR[7,2]").Text = "25"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-NETPR[7,3]").Text = "1,5"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-NETPR[7,4]").Text = "5"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-NETPR[7,5]").Text = "500"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-NETPR[7,5]").SetFocus
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-NETPR[7,5]").CaretPosition = 14
session.FindById("wnd[0]").SendVKey 0
session.FindById("wnd[0]").SendVKey 0
session.FindById("wnd[0]").SendVKey 0
session.FindById("wnd[0]").SendVKey 0
session.FindById("wnd[0]").SendVKey 0
session.FindById("wnd[1]").Close
session.FindById("wnd[0]").SendVKey 0
session.FindById("wnd[1]").Close
session.FindById("wnd[0]").SendVKey 0
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-NETPR[7,3]").Text = "1,50"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-NETPR[7,4]").Text = "5,00"
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-NETPR[7,4]").SetFocus
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-NETPR[7,4]").CaretPosition = 11
session.FindById("wnd[0]").SendVKey 0
session.FindById("wnd[0]/tbar[0]/btn[11]").Press
session.FindById("wnd[1]/usr/btnSPOP-OPTION1").Press
End Sub

So on the spreadsheet have all the values, but like materials that start with 543, the Tarq. Qty and Net Price, insert all the data and not do one by one.
EMATN[3,0]").Text = "543" like this one
session.FindById("wnd[0]/usr/tblSAPMM06ETC_0220/txtEKPO-KTMNG[5,0]").Text = "10" and this
and etc.
thanks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions