cancel
Showing results for 
Search instead for 
Did you mean: 

eCATT Script with multiple variants exporting only last value

Former Member
0 Kudos

Hi all,

my testscript creates debitors with a new debitornumber.

There is also an export parameter E_LIEFNR to hold the debitornumber.

In testdata container there are 2 internal variants which creates two different debitors.

What i want is, to store these two debitornumbers in an internal variable.

So i created something like this in the testscript:

local variables:

V_LIEFNRLIST as LIEFNR[]

V_COUNT Numeric

some SAPGUI recordings.

*exporting the Parameter E_LIEFNR

GETGUI ( ZFK2331_2110_3 , NONE ).

V_COUNT = V_COUNT + 1.

V_LIEFNRLIST[V_COUNT]-TABLE_LINE = E_LIEFNR.

Running the script through the testconfiguration with both variants,

with every variant the first entry in V_LIEFNRLIST is overwritten

with the last E_LIEFNR. How can I store all E_LIEFNR from all variants?

Regards

Holger

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member181959
Contributor
0 Kudos

Hi,

To do that use ABAP...ENDABAP comand in the DO...ENDDO loop.

then Append the requried debit numbers to the internal table as we generally do in ABAP coding.

For example...

DO.

GETGUI ( ZFK2331_2110_3 , NONE ).

ABAP.

apppend record here.

ENDABAP.

ENDDO.

Hope this helps.

Cheers,

Prasad Babu,

http://prasadbabu.blogspot.com

former_member585451
Active Participant
0 Kudos

Hello Holger,

Initialize V_COUNT = 1 before entering the loop as the int. table starts with 1.

V_COUNT = 1.

        • DO ( < Some number / Varaible > ). A Do loop to iterate through the total variants.

some SAPGUI recordings.

*exporting the Parameter E_LIEFNR

GETGUI ( ZFK2331_2110_3 , NONE ).

V_LIEFNRLIST[V_COUNT]-TABLE_LINE = E_LIEFNR.

V_COUNT = V_COUNT + 1.

        • ENDDO.

This is a very generic answer, coz I am not sure how you are proceeding with the logic in your script. But you need to initialize the V_COUNT value and then you also need a loop to iterate and pass value to the V_LIEFNRLIST.

Hope this helps.

Best regards,

Harsha

PS: Reward points accordingly for all responding

Former Member
0 Kudos

Hello Harsha,

the result of your suggestion is as follows, and not what i expected:

For example there are two variants in testconfiguration:

variant 1: create debitor 1 within BUKRS=0010.

variant 2: create debitor 2 within BUKRS=0080.

This is the result when looping 2 times (one for each variant):

load variant 1 from testconfiguration

v-count = 1

do 2

*loop 1

create debitor 1 *BUKRS=0010

save creditornr in liefnrlist[v-count] *first place

v-count = v-count + 1

*loop 2

create debitor 1 *again the same BUKRS as above

save creditornr in liefnrlist[v-count] *second place

v-count = v-count + 1

enddo

  • liefnrlist[1,2] filled with two debitornumbers of variant 1 (BUKRS=0010)

load variant 2 from testconfiguration

v-count = 1

do 2 (times)

*loop 1

create debitor 2 *BUKRS=0080

save creditornr in liefnrlist[v-count] *first place

v-count = v-count + 1

*loop 2

create debitor 2 *again the same as above

save creditornr in liefnrlist[v-count] *second place

v-count = v-count + 1

enddo

  • liefnrlist[1,2] filled with two debitornumbers of BUKRS=0080

How can I achieve a result with a liefnrlist[1,2] filled

with debitornr of BUKRS=0010 and debitornr of BUKRS=0080

-> 1 for each variant?

Best regards

Holger

former_member585451
Active Participant
0 Kudos

Hi Holger..

Would it be possible for you to paste the code as it is in your Script.

I am actually confused why you have initialized V_COUNT = 1, twice. I mean before both the loops. Here if you initialise again at the second loop, the Value for the V_COUNT would be again 1 and that replaces the value of the first variant in the liefnrlist[v-count]. First try to delete/comment the second initialization of V_COUNT = 1 and try, else paste the code.

If you could paste the code, I would try to give you some solution.

Best regards,

Harsha

PS: Reward points accordingly for all responding.

Former Member
0 Kudos

Hi Harsha,

thank you for answering.

this is the code of TopScript:

*initalizing table.

V_COUNT = 1.

do 5.

V_LIEFNRLIST[V_COUNT]-TABLE_LINE = 0.

V_COUNT = V_COUNT + 1.

enddo.

*

*referencing SAPGUI Script exporting E_LIEFNR

REF ( Z_T01_KKM_LIEF_ANL , Z_T01_KKM_LIEF_ANL_1 ).

*

*search for next free tableline and saving E_LIEFNR in int. table

V_COUNT = 1.

do 5.

IF V_LIEFNRLIST[V_COUNT]-TABLE_LINE = 0.

V_LIEFNRLIST[V_COUNT]-TABLE_LINE =

Z_T01_KKM_LIEF_ANL_1-EXPORTING-E_LIEFNR.

endif.

exit V_LIEFNRLIST[V_COUNT]-TABLE_LINE =

Z_T01_KKM_LIEF_ANL_1-EXPORTING-E_LIEFNR.

V_COUNT = V_COUNT + 1.

enddo.

this is the testconfiguration from which testscript is started:

Selection for running / Variant

' ' / ECATTDEFAULT

'X' / ANL_LIEF1

'X' / ANL_LIEF2

Best regards,

Holger

former_member585451
Active Participant
0 Kudos

Hi Holger,

Please do not use the bolded part at all. You dont need the above part at all.

<b>*initalizing table.

V_COUNT = 1.

do 5.

V_LIEFNRLIST[V_COUNT]-TABLE_LINE = 0.

V_COUNT = V_COUNT + 1.

enddo.</b>

The initialization I meant was just to set the V_COUNT to 1. Not to populate values into each and every row.

Here in your code, you are refering the script Z_T01_KKM_LIEF_ANL only once right. So, you would get only one E_LIEFNR.

Instead of uding the DO loop for 5 times, take some dynamic number(May be the number of vairants/debitors created).

Please use this in your script and let me know if you have any issues.

*referencing SAPGUI Script exporting E_LIEFNR

REF ( Z_T01_KKM_LIEF_ANL , Z_T01_KKM_LIEF_ANL_1 ).

*

*search for next free tableline and saving E_LIEFNR in int. table

V_COUNT = 1.

DO 5.

V_LIEFNRLIST[V_COUNT]-TABLE_LINE = Z_T01_KKM_LIEF_ANL_1-EXPORTING-E_LIEFNR.

      • SOME EXIT statement.

V_COUNT = V_COUNT + 1.

ENDDO.

Best regards,

Harsha

Former Member
0 Kudos

Hi Harsha,

first of all: thank you very much for your patience!

Because of starting the script via the above mentioned testcontainer, the referenced script Z_T01_KKM_LIEF_ANL is running <b>twice</b> (one time for each variant).

At the end of the first run the value of E_LIEFNR is stored in V_LIEFNRLIST[1].

At the time the system starts the second run (variant two) the value of V_LIEFNRLIST[] is resetted by system and therefore <b>initial</b>. The stored number of the first created debitor is deleted. After finishing the second run (variant two) the Parameter V_LIEFNRLIST[] holds the value of the last exported E_LIEFNR at Line 1.

My problem is the <b>reset</b> between the runs of each variant.

I'd like to have both E_LIEFNR (one for each variant) in V_LIEFNRLIST[].

former_member585451
Active Participant
0 Kudos

Hi Holger..

I am sorry for replying your post very late.

When they are 2 different executions(though in the same log), we cannot save both the values into one parameter as after each execution, the parameters used would be set to null again. I have tried many ways for giving you a proper solution but couldnot find any.

But pl try the Store & Retrieve commands available in eCATT. They may also not help the situation, but do give a try.

Best regards,

Harsha

Former Member
0 Kudos

Hi Harsha,

thanks for your reply; I sensed that there is no way to solve this problem by using variants.

Breaking down the variants into single testcases, referenced by a top-script, with each storing the export value into a local variable solves the problem, but is no good style.

Many Thanks for trying to help!

Best regards

Holger