Micro Focus QTP (UFT) Forums
.vbs script error when trying to insert a value in a sapguitable - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: .vbs script error when trying to insert a value in a sapguitable (/Thread-vbs-script-error-when-trying-to-insert-a-value-in-a-sapguitable)



.vbs script error when trying to insert a value in a sapguitable - frebuffi - 11-14-2012

hi friends,

i create this piece of code and it is running ok as a .vbs script. the problem is only the last line of code. It is saying that the method is not supported, how can i fixed this problem ?..now the code:

Code:
set WshShell = CreateObject("WScript.Shell")
Set proc = WshShell.Exec("C:\Archivos de Programa\SAP\FrontEnd\SAPgui\saplogon.exe")
      Do While proc.Status = 0
            WScript.Sleep 500
      Loop
Set SapGui = GetObject("SAPGUI")
Set Appl = SapGui.GetScriptingEngine

Set Connection = Appl.Openconnection("BST - Integracion", True)
Set session = Connection.Children(0)
session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "l0609285"
session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "dm5srH5c"
session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "ES"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[0]/okcd").Text = "/n/BGBA/LM_LOAN_01"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtGV_TIPO_DOC").Text = "CUIL"
session.findById("wnd[0]/usr/txtGV_NRO_DOC").Text = "30515838399"
session.findById("wnd[0]/usr/btnLC_BUSCAR").press
Do While proc.Status = 0
            WScript.Sleep 100
Loop
session.findById("wnd[0]/usr/ctxtCN_BEGIN_D").Text = "20.11.2008"
session.findById("wnd[0]/usr/ctxtGV_DATA-VTA_ORGUNIT").Text = "0063"
session.findById("wnd[0]/usr/ctxtGV_DATA-PROD_COM").Text = "SF_FIJOFUL"
session.findById("wnd[0]/usr/ctxtGV_DATA-INST_ORGUNIT").Text = "0063"
session.findById("wnd[0]/usr/btnLC_SAVE").press
Do While proc.Status = 0
            WScript.Sleep 100
Loop
session.findById("wnd[0]/usr/tabsFICHA/tabpFICHA_FC1/ssubFICHA_SCA:/BGBA/SAPMLM_LOAN_CREATE:0201/ctxtGV_DATA-DESTINO").Text = "CAP"
session.findById("wnd[0]/usr/tabsFICHA/tabpFICHA_FC1/ssubFICHA_SCA:/BGBA/SAPMLM_LOAN_CREATE:0201/ctxtGV_DATA-COND_GAR").Text = "PAG"
session.findById("wnd[0]/usr/tabsFICHA/tabpFICHA_FC1/ssubFICHA_SCA:/BGBA/SAPMLM_LOAN_CREATE:0201/ctxtGV_DATA-DOC_LEG_GAR").Text = "PAGARE"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/tabsFICHA/tabpFICHA_FC3").select
session.findById("wnd[0]/usr/tabsFICHA/tabpFICHA_FC3/ssubFICHA_SCA:/BGBA/SAPMLM_LOAN_CREATE:0203/cmbGV_DATA-FIN_COND-AC_CONTRACT-DIVISOR").key = "365"
set session.findById("wnd[0]/usr/tabsFICHA/tabpFICHA_FC3/ssubFICHA_SCA:/BGBA/SAPMLM_LOAN_CREATE:0203/tbl/BGBA/SAPMLM_LOAN_CREATETASAS").SetCellData 1, "Tasa","14"

the message: "the object does not support setcelldata method"... it seems that the operations are different than in qtp..


RE: .vbs script error when trying to insert a value in a sapguitable - Ankesh - 11-14-2012

set will return an object, you simply can not use setcelldata for that.

it shld be something like

Code:
Set variable=session.findById("wnd[0]/usr/tabsFICHA/tabpFICHA_FC3/ssubFICHA_SCA:/BGBA/SAPMLM_LOAN_CREATE:0203/tbl/BGBA/SAPMLM_LOAN_CREATETASAS")

now you should check the property of the 'variable ' to see the possible option to be used.

Regards,
Ankesh


RE: .vbs script error when trying to insert a value in a sapguitable - frebuffi - 11-14-2012

i also tried :
Code:
session.findById("wnd[0]/usr/tabsFICHA/tabpFICHA_FC3/ssubFICHA_SCA:/BGBA/SAPMLM_LOAN_CREATE:0203/tbl/BGBA/SAPMLM_LOAN_CREATETASAS/ctxt/BGBA/CA_TASAS_T-TASA[3,0]").text = "14"

[3,0] means column and row

and it works fine.


RE: .vbs script error when trying to insert a value in a sapguitable - Ankesh - 11-15-2012

good to know that it worked for you... Smile


RE: .vbs script error when trying to insert a value in a sapguitable - Malleswari - 07-18-2013

@ frebuffi / Ankesh

Code:
session.findById("wnd[0]/usr/tabsFICHA/tabpFICHA_FC3/ssubFICHA_SCA:/BGBA/SAPMLM_LOAN_CREATE:0203 /tbl/BGBA/SAPMLM_LOAN_CREATETASAS

this is the id of the table, but how the fallowing string is derived ?


Code:
/ctxt/BGBA/CA_TASAS_T-TASA



RE: .vbs script error when trying to insert a value in a sapguitable - Staff - 07-18-2013

Please ensure to include your code between [code] tags while asking or replying to questions. I have done this for you for this time.