Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9091

Find from SAP and Copy and Paste in Excel

$
0
0

Hello,

 

I am trying to find a specific value from my output data and copy and paste into a specific excel spreadsheet (C:\Users\raw_geek\Desktop\ACR-TSO_Macro/SAP.xlsm)

 

I can find the specific value

but I can not copy and paste the find item into the excel spreadsheet.  (C:\Users\raw_geek\Desktop\ACR-TSO_Macro/SAP.xlsm)

Is it possible to copy the find item and paste in excel spreadsheet?

Here is what I have ...I’m doing through VBA script through excel 2010.

 

I know it's hard.... I mean Hard for me but like you , it's easy !!! I know there is some smart people can help me on this .. Any help will be appreciate!!!!!

 

I'm not sure this is the correct forum so if it needs to be moved please let me know. Thanks all...

 

 

Private Sub CommandButton1_Click()

 

 

Dim SapGuiApp As Object

Dim oConnection As Object

Dim session As Object

Dim SAPCon As Object, SAPSesi As Object

Dim SAPGUIAuto As Object, SAPApp As Object

'Dim sapConnection As Object

 

 

If SapGuiApp Is Nothing Then

    Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")

End If

If oConnection Is Nothing Then

    Set oConnection = SapGuiApp.OpenConnection("L&R General Ledger – PRD", True)

End If

If SAPSesi Is Nothing Then

   Set SAPSesi = oConnection.Children(0)

End If

   

    'sapConnection.Client = "100"

    'sapConnection.User = "USER"

    'sapConnection.Password = "PASSW"

    'sapConnection.Language = "EN"

    'If nsapConnection.Logon(1, True) = True Then

    'MsgBox "No connection to R/3!"

    'End If

    

     'Set SAPCon = SAPApp.Children(0)

     'Set SAPSesi = SAPCon.Children(0)

    

    'Application.DisplayAlerts = False

   

With SAPSesi

       

    .findById("wnd[0]/usr/txtRSYST-MANDT").text = "100"

    .findById("wnd[0]/usr/txtRSYST-BNAME").text = "ABCD"

    .findById("wnd[0]/usr/pwdRSYST-BCODE").text = "XXXXXX"

    .findById("wnd[0]/usr/txtRSYST-LANGU").text = "EN"

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

 

    'start extraction

   

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

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

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

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

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

    .findById("wnd[0]/usr/lbl[5,8]").setFocus

    .findById("wnd[0]/usr/lbl[5,8]").caretPosition = 0

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

    .findById("wnd[0]/usr/lbl[9,10]").setFocus

    .findById("wnd[0]/usr/lbl[9,10]").caretPosition = 0

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

    .findById("wnd[0]/usr/lbl[16,13]").setFocus

    .findById("wnd[0]/usr/lbl[16,13]").caretPosition = 0

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

    .findById("wnd[0]/usr/ctxt$ALLCOMP").text = ""

    .findById("wnd[0]/usr/ctxt$ALLCOMP").setFocus

    .findById("wnd[0]/usr/ctxt$ALLCOMP").caretPosition = 0

    .findById("wnd[0]/usr/btn%__ALLCOMP_%_APP_%-VALU_PUSH").press

    .findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL-SLOW_I[1,0]").text = "205"

    .findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL-SLOW_I[1,1]").text = "243"

    .findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL-SLOW_I[1,1]").setFocus

    .findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL-SLOW_I[1,1]").caretPosition = 3

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

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

    .findById("wnd[0]/shellcont/shell/shellcont[2]/shell").hierarchyHeaderWidth = 300

    .findById("wnd[0]/shellcont/shell/shellcont[2]/shell").selectedNode = "000002"

 

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

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

.findById("wnd[1]/usr/txtRSYSF-STRING").text = "220702"

.findById("wnd[1]/usr/txtRSYSF-STRING").caretPosition = 6

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

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

.findById("wnd[2]/usr/lbl[5,2]").setFocus

.findById("wnd[2]/usr/lbl[5,2]").caretPosition = 2

.findById("wnd[2]").sendVKey 2

.findById("wnd[0]/shellcont/shell/shellcont[2]/shell").unselectAll

 

 

End With

 

 

End Sub


Viewing all articles
Browse latest Browse all 9091

Trending Articles