Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Multiple line items with eCATT....again

Former Member
0 Likes
1,581

Hi folks,

I am struggling with adding multiple lines in an eCATT script. For this example I will use the Airline demo example from SAP help: http://help.sap.com/saphelp_nw70ehp1/helpdata/en/fd/4f6b3f3d643b3be10000000a114084/content.htm.

(You initialize the Airline demo data with SE38>>SAPBC_DATA_GENERATOR first.)

The demo is based on transaction EC_TUTORIAL_SAPGUI.

Start transaction EC_TUTORIAL_SAPGUI

Open an airline and flight

Right click on a date and select New Booking

Pick a customer from F4 list

Select Passengers tab

Enter a last name, title and date of birth.

I have created the script, system and test data containers and test configuration. Everything runs great.

Now I want to modify it a little so I can add multiple passengers into one flight booking request.

I have read Sapna Modi & Rakesh Kumar Jain's excellent blogs and have been able to start using eCATT productively with their help. Also from reading all the SDN posts I think I need the DO...ENDDO loop. (I would like to do it without inline ABAP mainly because I don't know ABAP at all and we will want to do similar things in the future with other non-ABAP'ers.)

Here is my test script ZTUTORIAL_TS_LOOP:

SAPGUI ( EC_TUTORIAL_SAPGUI_100_1 ).

SAPGUI ( EC_TUTORIAL_SAPGUI_120_1 ).

GETGUI ( EC_TUTORIAL_SAPGUI_100_4 ).

  • Switch to Passengers tab. Cursor in Class field.

SAPGUI ( EC_TUTORIAL_SAPGUI_100_STE_1 ).

  • Delete first row so I start with empty table.

SAPGUI ( EC_TUTORIAL_SAPGUI_100_STE_2 ).

  • This is where I am stuck. I don't know how to add as many rows as there are variants (records) in my test data containter.

  • The way it is below, it inserts the same record twice and the whole script repeats for each record in the TDC.

DO ( 2 ).

  • Insert row and type passenger name, title, DOB.

SAPGUI ( EC_TUTORIAL_SAPGUI_100_STE_3 ).

ENDDO.

  • Save.

SAPGUI ( EC_TUTORIAL_SAPGUI_100_STE_4 ).

  • Confirm pop-up.

SAPGUI ( EC_TUTORIAL_SAPGUI_110_STE_1 ).

  • Show message in status bar.

SAPGUI ( EC_TUTORIAL_SAPGUI_100_STE_5 ).

I know I have to pass the DO a parameter and somehow get that into the command and use that to loop through the test data container, I just haven't been able to put the pieces together. Can anybody help? Thank you,

David

1 ACCEPTED SOLUTION
Read only

Vny12
Product and Topic Expert
Product and Topic Expert
0 Likes
1,191

Hi David,

Since you are updating the row and not columns( you are doing correct here).

Within each loop you should also put new value.

For that you should create a table of entries with table type of parameter.

For example type of SPFLI.

Now inside the parameter IT_SPFLI, enter more data.

When you loop in DO loop

DO ( 2 ).

  • Insert row and type passenger name, title, DOB.

SAPGUI ( EC_TUTORIAL_SAPGUI_100_STE_3 ).

ENDDO.

pass the data it_spfli[&lpc]-field to fields on screen.

Else same data will repeat.

best regards

vinay

7 REPLIES 7
Read only

Vny12
Product and Topic Expert
Product and Topic Expert
0 Likes
1,192

Hi David,

Since you are updating the row and not columns( you are doing correct here).

Within each loop you should also put new value.

For that you should create a table of entries with table type of parameter.

For example type of SPFLI.

Now inside the parameter IT_SPFLI, enter more data.

When you loop in DO loop

DO ( 2 ).

  • Insert row and type passenger name, title, DOB.

SAPGUI ( EC_TUTORIAL_SAPGUI_100_STE_3 ).

ENDDO.

pass the data it_spfli[&lpc]-field to fields on screen.

Else same data will repeat.

best regards

vinay

Read only

Former Member
0 Likes
1,191

Hi Vinay,

That looks like what I want to do but where do I create a table in eCATT? How do I create a parameter of type table; I only know how to make Import, Export or Local Variable parameters?

I think I've read the eCATT help but I must be totally missing something. Thanks for your time.

David

Read only

Former Member
0 Likes
1,191

Hi David,

create your parameter with a parameter reference. Add to the reference these brackets: []

For example - Table for the CustomerIDs

Paramname: I_TAB_CUSTOMER

Reference: S_CUSTOMER[]

Get the values with

 I_TAB_CUSTOMER[Index]-TABLE_LINE

Is your reference a structured parameter use the fieldnames instead of "-TABLE_LINE".

Best regards

Sebastian

Read only

Former Member
0 Likes
1,191

Thank you Vinay and Sebastian,

OK, I'm making some progress. I created three import parameters (I changed CUSTOMER to PASSNAME since that is the rows I want to add):

I_TAB_PASSNAME S_PASSNAME[]

I_TAB_TITLE S_FORM[]

I_TAB_DOB S_BIRTHDAT[]

I assume I should parameterize the command interface with these params. So I put the new parameters I created like so:

Id 'wnd[0]/usr/tabsTABSTRIP1/tabpPASS/ssubTAB1_REF1:EC_TUTORIAL_SAPGUI:0102/cntlCUSTOM102/shellcont/shell'

modifyCell

Parameter 0

Parameter 'PASSNAME'

Parameter I_TAB_PASSNAME << Param I created

modifyCell

Parameter 0

Parameter 'PASSFORM'

Parameter I_TAB_TITLE << Param I created

modifyCell

Parameter 0

Parameter 'PASSBIRTH'

Parameter I_TAB_DOB << Param I created

Now I can't see how to get values into these parameters. It seems I need to build a table somewhere. Can I somehow read records into these parameters from the system data container?

You say "get the values with I_TAB_PASSNAME(Index)-TABLE_LINE." What is "(Index)" and TABLE_LINE? Is there a command before that? Is it inside the DO...ENDDO loop? By fieldnames do you mean 'PASSNAME', 'PASSFORM' & 'PASSBIRTH'?

Sorry for sounding so stupid but there are so many pieces and I haven't done anything close to this before so I don't know how to fit them all together. I will go back to online help with the new information on table parameters and see what I can find. Thank you for your efforts,

David

Read only

Former Member
0 Likes
1,191

Wow! There's a light at the end of the tunnel. So here's what I've got now.

In desperation I found that if you double click a table parameter you can create lines for it and voila there's that "TABLE_LINE" Sebastion mentioned. So I added three rows for each of my new table parameters.

Now looping three times with the DO...ENDDO thusly:

DO ( 3 ).

        • Rows in ALV start at zero so row number is one less than loop counter.

V_ROWNUM = &LPC - 1.

        • Insert row

SAPGUI ( EC_TUTORIAL_SAPGUI_100_STE_9 ).

        • Enter Name, Title, DOB

SAPGUI ( EC_TUTORIAL_SAPGUI_100_STE_15 ).

ENDDO.

And in the command interfaces I've parameterized like so:

EC_TUTORIAL_SAPGUI_100_STE_9

insertRows

Parameter\[1\] V_ROWNUM << This is $LPC-1 declared above

EC_TUTORIAL_SAPGUI_100_STE_15

modifyCell

Parameter\[1\] V_ROWNUM

Parameter\[2\] 'PASSNAME'

Parameter\[3\] I_TAB_PASSNAME\[&LPC\]-TABLE_LINE

modifyCell

Parameter\[1\] V_ROWNUM

Parameter\[2\] 'PASSFORM'

Parameter\[3\] I_TAB_TITLE\[&LPC\]-TABLE_LINE

modifyCell

Parameter\[1\] V_ROWNUM

Parameter\[2\] 'PASSBIRTH'

Parameter\[3\] I_TAB_DOB\[&LPC\]-TABLE_LINE

So I can now add three passengers to the booking request. Almost there!

Now all I need to do is find a way to populate the table parameters at runtime, from the system data container I presume, and then loop as many times as there are rows in the table parameters. But it's getting late now and my brain hurts.

David

Read only

Former Member
0 Likes
1,191

Thanks Vinay and Sebastian,

I'm going to call this solved; I'm close enough that I can work with it. I double clicked on the parameter in the test data container and added rows there for each variant. Thank you both so much for your help.

David

Read only

Former Member
0 Likes
1,191

Dear David,Vinay and Sebastian,

I have an issue....I am new to ECATT.

iam Using SECATT Transaction.

I need 2 record PFCG to Create Role and assign Multiple Transactions.

Now I have Gone through th eBlogs of Sapna and many other links.

Firstly I have Tried Both the Methods,

TCD and GUI as well.

My Case is as Follows....

1)while Creating Role in PFCG(Recording).

I give

a)Role Name

b)Description Then Navigate to Menu Tab

c)Click on Transaction Button

d)now this is where the Problem Arises.

I first Enter VA01 and press enter

Then Enter Va02 and Press enter

Similarly I make Multiple Entries.

After that I Click on Assign Transaction and then Save my Recording and then go back.

Now I am Done with my recording.

Now issue is after creating my Test Script...When i Create the Test Configuration.

I provide the Test Script Name and Download the Template.

Now after Creating Template I give Entries as follows in tab Delimit Format.

I modified my File as follows.

[VARIANT] [DESCRIPTION] V_ROLE_NAME V_DESC V_TCODE

  • BDC field value BDC field value BDC field value

*ECATTDEFAULT X104 A1 VL03N

1 ROLE1 A1 SE37

2 ROLE1 A1 SE38

3 ROLE1 A1 SE51

Problems:-

1)Whenever I Execute The Recording it Shows Previous Entry which i made during Recording and says that the Role already Exists

2)while recording in Foreground Teh File Picks ROLE1 then picks the Desc A1 then when it Picks the Transaction se37.

now when it Goes to second line it Shows the Previous Entry I JUST ENTERED.i.e SE37 and says that Tcode laready Exists.

How do i Clear this previus variables.

2ndly if i Program My Code and dont Use External Vaiant.

I made the File as Below as Text Delimit and This Time iam not using The Template.

But when i Execute it It Gives Error.

Is there any Problem with My File..Please Suggest.

It has been 3 Days and iam Still Stuck at this issue.

ROLE2 DES1 MB5B

ROLE2 DES2 ME23N

Please Respond.

Thanks Awaiting.

Essam