Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating multiple lines under a header - SAP
#1
Not Solved
Sorry for the duplication - was originally created in General area:

Dear all,
i will like an assistance on how to get around this problem:

1. I created a new Characteristic "QTWTEST2"
2. I added a Char value "QTW002"(can add more than one value) under the header
3. Some characteristis have more that one Char value in my data table
4. How can i let qtp recognise the single/multiple Char. values from the data table.

I am attaching the composition of my data table and qtp codes

I will be glad of any input.

Code:
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiEdit("Characteristic").Set "QTWTEST2"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiButton("Create").Click
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiEdit("Description").Set "QTP characteristics test2"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiComboBox("Data Type").SetFocus
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiComboBox("Data Type").Select "Character Format"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiEdit("Number of Chars").Set "6"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTabStrip("TABSTRIP1").Select "Descriptions"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTabStrip("TABSTRIP1").Select "Values"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTable("Allowed Values").SetCellData 1,"Char. Value","QTW002"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTable("Allowed Values").SetCellData 1,"Description","TEST2"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTable("Allowed Values").SelectCell 1,"Description"

Character name Char. Value Description
1 QTPXTEST1 QTX001 TEST1
2 QTWTEST2 QTW002 TEST2
3 QTWTEST2 QTW003 TEST3
4 QTPBRUN1 QTB001 RUN1
5 QTPBRUN1 QTB002 RUN2
6 QTPBRUN1 QTB003 RUN3

Line 1 - 1 char. value
Line 2/3 - 2 char value
Line 4,5,6 - 3 char value


Attached Files
.doc   Tweek2.doc (Size: 75 KB / Downloads: 74)
Reply
#2
Not Solved
Does anyone have an idea on how to solve this problem? I guess I can insert a "IF, THEN, ELSE". But where and on what reference?
Reply
#3
Not Solved
pass mulitple values in datatable separated by comma(,) and then split it in your code. Insert those values in the SAPGUiTable.
Reply
#4
Not Solved
Thank you Ankesh,

I am new to this but willing to learn. Please give me some guidiance....an example i can build on. Sorry for taking up some of your valuable time.
Reply
#5
Not Solved
Please correct me if i have misunderstood your requirement.

All you want to do is pass multiple values in one column and then use it in your script.

Say, datatable has a column named "InputCharacters" which has values as QTW002,QTW003,QTW004

Please note i have separated the values by comma.
Now the code goes as
Code:
strCharacters=Datatable("InputCharacters",dtGlobalSheet)'get the datatable values
'Now you need to split the values
arrCharacters=Split(strCharacters,".")'i am splitting on comma as the values were separated by comma
arrCharacters will have all the values now.

to get the values, you can use the index. Let us consider our example
arrCharacters(0) will give QTW002
arrCharacters(1) will give QTW003
arrCharacters(2) will give QTW004

you can use these values to set in the table as
Code:
For i=0 to Ubound(arrCharacters)
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTable("Allowed Values").SetCellData i+1,"Char. Value",arrCharacters(i)
Next
Note: You can always modify the code to fit in ur requirement.

Regards,
Ankesh
Reply
#6
Not Solved
Ankesh,

big thanks to you and the web......exactly what i was trying to do. According to your instructions, I made the following and will like to hear from you if it is ok.

Please see also the attached file:

‘my final code might look like this (2 coloms where multiple values may exist - Char. Value and Description)
Code:
strCharacters=Datatable("InputCharacters",dtGlobalSheet)'get the datatable values
strDescription=Datatable("InputDescription",dtGlobalSheet)'get the datatable values
arrCharacters=Split(strCharacters,".")
arrDescription=Split(strDescription,".")
For i=0 to Ubound(arrCharacters)
For i=0 to Ubound(arrDescription)

SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiEdit("Characteristic").Set "QTWTEST2"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiButton("Create").Click
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiEdit("Description").Set "QTP characteristics test2"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiComboBox("Data Type").SetFocus
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiComboBox("Data Type").Select "Character Format"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiEdit("Number of Chars").Set "6"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTabStrip("TABSTRIP1").Select "Descriptions"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTabStrip("TABSTRIP1").Select "Values"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTable("Allowed Values").SetCellData i+1,"Char. Value",arrCharacters(i)
next
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTable("Allowed Values").SetCellData i+1,"Description","arrDescription(i)"
next
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTable("Allowed Values").SelectCell 1,"Description"

Is this correct?


Attached Files
.doc   Tweek3.doc (Size: 25.5 KB / Downloads: 88)
Reply
#7
Not Solved
Hello Ankesh,

still need a help on this. I ran this script below and the result is halfway, please see the attachment.
Please help review my script:

Code:
strCharacters=Datatable("Characters",dtGlobalSheet)'get the datatable values
strDescription=Datatable("Description",dtGlobalSheet)'get the datatable values
arrCharacters=Split(strCharacters,",")
arrDescription=Split(strDescription,",")
For i=0 to Ubound(arrCharacters)

SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiEdit("Characteristic").Set "QTWTEST2"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiButton("Create").Click
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiEdit("Description").Set "QTP characteristics test2"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiComboBox("Data Type").SetFocus
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiComboBox("Data Type").Select "Character Format"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiEdit("Number of Chars").Set "6"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTabStrip("TABSTRIP1").Select "Descriptions"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTabStrip("TABSTRIP1").Select "Values"
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTable("Allowed Values").SetCellData i+2, "Char. Value",arrCharacters(i)
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTable("Allowed Values").SetCellData i+2, "Description",arrDescription(i)
next
Reply
#8
Not Solved
Use For loop only for the last last 2 statements rather than entire code.

Code:
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTabStrip("TABSTRIP1").Select "Values"
For i=0 to UBound(arrCharacters)  

SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTable("Allowed Values").SetCellData i+2, "Char. Value",arrCharacters(i)
SAPGuiSession("Session").SAPGuiWindow("Characteristics").SAPGuiTable("Allowed Values").SetCellData i+2, "Description",arrDescription(i)
Next

Regards,
Saleel
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Creating Random String SomeIntern 0 4,747 08-21-2013, 09:10 PM
Last Post: SomeIntern
  Unable to right click column header sudhirzpatil 4 6,062 07-18-2013, 09:42 PM
Last Post: sudhirzpatil
  Problem in creating excel object kriday 1 2,187 07-13-2013, 12:45 PM
Last Post: Ankur
  Add Simple Text Header mot0rola 2 2,341 07-09-2013, 10:30 AM
Last Post: Ankur
  Datatable header inserting error Prashanth 0 2,630 05-21-2013, 03:39 PM
Last Post: Prashanth

Forum Jump:


Users browsing this thread: 1 Guest(s)