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

Error Message Handling in ECATT !

Former Member
0 Likes
2,537

Hey Friends,

I have Done SAPGUI Recording for PFCG and Everything Works Fine.

Now I tried Upoading the Flat File which contains Roles against which there are Multiple transactions.

Problem is that one of the Transactions in the file was Wrong.

vl01n was wrongly written as vl01m.

While Uploading the File it gave a status message on Status bar saying vl01m does not exist.

all my transactions for a particular Role before vl01m were saved however after coming to vl01m it stopped there.

now wht i need 2 do is whenever i get such type of wrong entries in The File I need 2 capture that wrong entry and want the file to continue uploading after that entry...I dont want the Script to Stop in middle.

How do i Do That.

Regards,

Essam

11 REPLIES 11
Read only

Former Member
0 Likes
1,844

Hello,

Use Message ... Endmessage block.

Thanks & Best regards,

Ajay

Read only

Former Member
0 Likes
1,844

Dear Ajay,<br>

My Test Script is a bit Complex.<br>

can i have ur email Id so that I could Mail u the complete Steps so that you could guide me in a better way.

or if possible could u give me ur contact no.<br>

<br>

My problem is that when an error comes..The script should not terminate but instead continue with the next Record in my File.

Mostly the File contains few wrong Entries.<br>

Eg:-<br>

<br><pre>

ROLE1 VL01N

ROLE1 VL02N

ROLE1 VL0MN

ROLE1 VL03N

ROLE2 SE37

ROLE2 SE38</pre><br><br>

Now while executing the script when the 3rd record is read it tells methat transaction VL0MN does not exist and terminates showing the Log.<br><br>

My main concern is it shall not terminate..instead it should go 2 the next record and continue the script.<br>

I have tried Message and end message.<br>

but iam Not getting a Soln.<br>

<br>

If You want i Can Show you the Code as well.<br>

<br><pre>

  • ABAP BLOCK TO GET THE NUMBER OF TEST CASES.

ABAP.

  • TOT : holds total number of records

  • FILE: holds file path of test file

DATA : TOT TYPE I VALUE 0,

FILE TYPE STRING.

  • ITAB TO HOLD TEST DATA FROM FILE

DATA : BEGIN OF I_ROLE OCCURS 0,

role like AGR_DEFINE-AGR_NAME,

  • desc like MAKT-MAKTX,

tcode like tstct-tcode,

END OF I_ROLE.

DATA : WA LIKE I_ROLE.

DATA : V_READINDX TYPE I,

INDX TYPE I VALUE 0.

  • TO OPEN FILE DIALOG FOR TEST DATA FILE

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'FILE'

IMPORTING

FILE_NAME = FILE_V-PATH.

FILE = FILE_V-PATH.

  • LOADING DATA FROM THE FILE

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = FILE

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = I_ROLE.

  • GETTING NUMBER OF RECORDS IN THE TABLE

DESCRIBE TABLE I_ROLE LINES TOT.

  • STORING NUMBER OF RECORDS IN LOCAL VARIABLE

COUNT = TOT.

  • CLEARING INTERNAL TABLE

CLEAR I_ROLE.

ENDABAP.</pre>

<br><br>

*Step 2:.<br>

*Looping through the records count number of times and reading from the internal table and passing them to the screen field values.<br>

*This sample code explains how to read, and pass values to the screen.<br><pre>

*LOOPING THROUGH (COUNT) NUMBER OF RECORDS.

MESSAGE ( MSG_1 ).

DO ( COUNT ).

ABAP.

  • V_READINDX : holds index number to read the internal table

  • FILE: holds file path of test file

DATA : V_READINDX TYPE I,

FILE TYPE STRING,

INDX TYPE I VALUE 0.

DATA : BEGIN OF I_ROLE OCCURS 0,

role like AGR_DEFINE-AGR_NAME,

  • desc like MAKT-MAKTX,

tcode like tstct-tcode,

END OF I_ROLE.

  • WORKAREA TO HOLD THE I_MARA DATA

DATA : WA LIKE I_ROLE.

FILE = FILE_V-PATH.

  • LOADING MASTER DATA FROM THE FILE

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = FILE

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = I_ROLE.

  • INT_LOC : is a local variable hold the current index to read I_MARA

  • V_READINDX = INT_LOC.

V_INDEX = V_INDEX + 1.

READ TABLE I_ROLE INDEX V_INDEX INTO WA.

V_ROLE = WA-ROLE. " role like AGR_DEFINE-AGR_NAME,

  • V_DESC = WA-DESC. " desc like MAKT-MAKTX,

V_TCODE = WA-TCODE. " tcode like tstct-tcode

*Aftab Page Down V_TC_INDEX needs to be kept constant as 1.i.e

  • v_tc_index = '1',

*We Would be setting the Flag v_tc_flag = 'X' after Page Down.

IF V_TC_FLAG = ' '.

V_TC_INDEX = V_INDEX - 1.

ENDIF.

ENDABAP.

*Initially V_role_prev will always be Blank.

  • Hence we will Check Condition.

IF ( V_FIRST = 'X' ) .

IF ( V_ROLE_PREV <> V_ROLE ) .

  • MESSAGE ( MSG_1 ).

SAPGUI ( PFCG_320_STEP_39 ).

SAPGUI ( PFCG_300_STEP_6 ).

SAPGUI ( PFCG_300_STEP_7 ).

SAPGUI ( PFCG_121_STEP_8 ).

  • ENDMESSAGE ( E_MSG_1 ).

CLEAR ( V_ROLE_PREV ).

CLEAR ( V_TC_INDEX ).

CLEAR ( V_NEW_INDEX ).

*Setting V_BEG = '1' Since Index After Page Down Would be Greater then 1 after Page Down.

V_BEG = '1'.

V_FIRST = ''.

V_TC_FLAG = 'Y'.

  • EXIT ( V_ROLE_PREV <> V_ROLE ).

ENDIF.

ENDIF.

IF ( V_TC_FLAG = 'Y' ) .

V_NEW_INDEX = V_NEW_INDEX + 1.

ENDIF.

IF ( V_TC_FLAG = 'Y' ) .

V_TC_INDEX = V_NEW_INDEX - 1.

ENDIF.

IF ( V_INDEX = '1' OR V_BEG = '1' ) .

**.

  • MESSAGE ( MSG_1 ).

SAPGUI ( PFCG_121_STEP_5 ).

SAPGUI ( PFCG_121_STEP_6 ).

SAPGUI ( PFCG_121_STEP_7 ).

SAPGUI ( PFCG_300_STEP_4 ).

SAPGUI ( PFCG_100_STEP_2 ).

SAPGUI ( PFCG_300_STEP_5 ).

  • ENDMESSAGE ( E_MSG_1 ).

*1st Tcode.

  • MESSAGE ( MSG_1 ).

SAPGUI ( PFCG_320_STEP_6 ).

  • ENDMESSAGE ( E_MSG_1 ).

V_BEG = ''.

ELSE.

*2ND Tcode.

IF ( ( ( V_NEW_INDEX <= 17 ) AND ( V_NEW_INDEX <> 0 ) ) OR ( V_INDEX <= 17 ) ) .

  • MESSAGE ( MSG_1 ).

SAPGUI ( PFCG_320_STEP_7 ).

  • ENDMESSAGE ( E_MSG_1 ).

ENDIF.

IF ( V_INDEX = '17' ) OR ( V_NEW_INDEX = '17' ) .

*PAGEDOWN.

  • MESSAGE ( MSG_1 ).

SAPGUI ( PFCG_320_STEP_23 ).

  • ENDMESSAGE ( E_MSG_1 ).

ENDIF.

IF ( ( ( V_INDEX >= 18 ) AND ( V_NEW_INDEX = 0 ) ) OR ( V_NEW_INDEX >= 18 ) ) .

  • IF V_INDEX = '18' OR V_INDEX = '34'.

IF ( V_INDEX = '18' ) OR ( V_NEW_INDEX = '18' ) .

V_TC_INDEX = '1'.

ENDIF.

*After Page Down.

  • MESSAGE ( MSG_1 ).

SAPGUI ( PFCG_320_STEP_24 ).

  • ENDMESSAGE ( E_MSG_1 ).

V_TC_INDEX = '1'.

V_TC_FLAG = 'X'.

ENDIF.

V_ROLE_PREV = V_ROLE.

V_FIRST = 'X'.

ENDIF.

ENDDO.

*MESSAGE ( MSG_1 ).

SAPGUI ( PFCG_320_STEP_39 ).

SAPGUI ( PFCG_300_STEP_6 ).

SAPGUI ( PFCG_300_STEP_7 ).

SAPGUI ( PFCG_121_STEP_8 ).

ENDMESSAGE ( E_MSG_1 ).</pre><br><br><br>

Thanks Awaiting,<br>

Essam<br><br>

<br>Edited by: Matt on May 17, 2010 10:00 AM - Fixed formatting

Read only

Former Member
0 Likes
1,844

Sorry,

The Text got scrambled.

Re: Error Message Handling in ECATT !

Posted: May 15, 2010 9:40 PM in response to: essamsaud Edit Reply

Dear Ajay, My Test Script is a bit Complex. can i have ur email Id so that I could Mail u the complete Steps so that you could guide me in a better way. or if possible could u give me ur contact no. My problem is that when an error comes..The script should not terminate but instead continue with the next Record in my File. Mostly the File contains few wrong Entries. Eg:- ROLE1 VL01N ROLE1 VL02N ROLE1 VL0MN ROLE1 VL03N ROLE2 SE37 ROLE2 SE38 Now while executing the script when the 3rd record is read it tells methat transaction VL0MN does not exist and terminates showing the Log. My main concern is it shall not terminate..instead it should go 2 the next record and continue the script. I have tried Message and end message. but iam Not getting a Soln. If You want i Can Show you the Code as well. * ABAP BLOCK TO GET THE NUMBER OF TEST CASES. ABAP. * TOT : holds total number of records * FILE: holds file path of test file DATA : TOT TYPE I VALUE 0, FILE TYPE STRING. * ITAB TO HOLD TEST DATA FROM FILE DATA : BEGIN OF I_ROLE OCCURS 0, role like AGR_DEFINE-AGR_NAME, * desc like MAKT-MAKTX, tcode like tstct-tcode, END OF I_ROLE. DATA : WA LIKE I_ROLE. DATA : V_READINDX TYPE I, INDX TYPE I VALUE 0. * TO OPEN FILE DIALOG FOR TEST DATA FILE CALL FUNCTION 'F4_FILENAME' EXPORTING PROGRAM_NAME = SYST-CPROG DYNPRO_NUMBER = SYST-DYNNR FIELD_NAME = 'FILE' IMPORTING FILE_NAME = FILE_V-PATH. FILE = FILE_V-PATH. * LOADING DATA FROM THE FILE CALL FUNCTION 'GUI_UPLOAD' EXPORTING FILENAME = FILE HAS_FIELD_SEPARATOR = 'X' TABLES DATA_TAB = I_ROLE. * GETTING NUMBER OF RECORDS IN THE TABLE DESCRIBE TABLE I_ROLE LINES TOT. * STORING NUMBER OF RECORDS IN LOCAL VARIABLE COUNT = TOT. * CLEARING INTERNAL TABLE CLEAR I_ROLE. ENDABAP. *Step 2:. *Looping through the records count number of times and reading from the internal table and passing them to the screen field values. *This sample code explains how to read, and pass values to the screen. *LOOPING THROUGH (COUNT) NUMBER OF RECORDS. MESSAGE ( MSG_1 ). DO ( COUNT ). ABAP. * V_READINDX : holds index number to read the internal table * FILE: holds file path of test file DATA : V_READINDX TYPE I, FILE TYPE STRING, INDX TYPE I VALUE 0. DATA : BEGIN OF I_ROLE OCCURS 0, role like AGR_DEFINE-AGR_NAME, * desc like MAKT-MAKTX, tcode like tstct-tcode, END OF I_ROLE. * WORKAREA TO HOLD THE I_MARA DATA DATA : WA LIKE I_ROLE. FILE = FILE_V-PATH. * LOADING MASTER DATA FROM THE FILE CALL FUNCTION 'GUI_UPLOAD' EXPORTING FILENAME = FILE HAS_FIELD_SEPARATOR = 'X' TABLES DATA_TAB = I_ROLE. * INT_LOC : is a local variable hold the current index to read I_MARA * V_READINDX = INT_LOC. V_INDEX = V_INDEX + 1. READ TABLE I_ROLE INDEX V_INDEX INTO WA. V_ROLE = WA-ROLE. " role like AGR_DEFINE-AGR_NAME, * V_DESC = WA-DESC. " desc like MAKT-MAKTX, V_TCODE = WA-TCODE. " tcode like tstct-tcode *Aftab Page Down V_TC_INDEX needs to be kept constant as 1.i.e * v_tc_index = '1', *We Would be setting the Flag v_tc_flag = 'X' after Page Down. IF V_TC_FLAG = ' '. V_TC_INDEX = V_INDEX - 1. ENDIF. ENDABAP. *Initially V_role_prev will always be Blank. * Hence we will Check Condition. IF ( V_FIRST = 'X' ) . IF ( V_ROLE_PREV V_ROLE ) . * MESSAGE ( MSG_1 ). SAPGUI ( PFCG_320_STEP_39 ). SAPGUI ( PFCG_300_STEP_6 ). SAPGUI ( PFCG_300_STEP_7 ). SAPGUI ( PFCG_121_STEP_8 ). * ENDMESSAGE ( E_MSG_1 ). CLEAR ( V_ROLE_PREV ). CLEAR ( V_TC_INDEX ). CLEAR ( V_NEW_INDEX ). *Setting V_BEG = '1' Since Index After Page Down Would be Greater then 1 after Page Down. V_BEG = '1'. V_FIRST = ''. V_TC_FLAG = 'Y'. * EXIT ( V_ROLE_PREV V_ROLE ). ENDIF. ENDIF. IF ( V_TC_FLAG = 'Y' ) . V_NEW_INDEX = V_NEW_INDEX + 1. ENDIF. IF ( V_TC_FLAG = 'Y' ) . V_TC_INDEX = V_NEW_INDEX - 1. ENDIF. IF ( V_INDEX = '1' OR V_BEG = '1' ) . **. * MESSAGE ( MSG_1 ). SAPGUI ( PFCG_121_STEP_5 ). SAPGUI ( PFCG_121_STEP_6 ). SAPGUI ( PFCG_121_STEP_7 ). SAPGUI ( PFCG_300_STEP_4 ). SAPGUI ( PFCG_100_STEP_2 ). SAPGUI ( PFCG_300_STEP_5 ). * ENDMESSAGE ( E_MSG_1 ). *1st Tcode. * MESSAGE ( MSG_1 ). SAPGUI ( PFCG_320_STEP_6 ). * ENDMESSAGE ( E_MSG_1 ). V_BEG = ''. ELSE. *2ND Tcode. IF ( ( ( V_NEW_INDEX <= 17 ) AND ( V_NEW_INDEX <> 0 ) ) OR ( V_INDEX <= 17 ) ) . * MESSAGE ( MSG_1 ). SAPGUI ( PFCG_320_STEP_7 ). * ENDMESSAGE ( E_MSG_1 ). ENDIF. IF ( V_INDEX = '17' ) OR ( V_NEW_INDEX = '17' ) . *PAGEDOWN. * MESSAGE ( MSG_1 ). SAPGUI ( PFCG_320_STEP_23 ). * ENDMESSAGE ( E_MSG_1 ). ENDIF. IF ( ( ( V_INDEX >= 18 ) AND ( V_NEW_INDEX = 0 ) ) OR ( V_NEW_INDEX >= 18 ) ) . * IF V_INDEX = '18' OR V_INDEX = '34'. IF ( V_INDEX = '18' ) OR ( V_NEW_INDEX = '18' ) . V_TC_INDEX = '1'. ENDIF. *After Page Down. * MESSAGE ( MSG_1 ). SAPGUI ( PFCG_320_STEP_24 ). * ENDMESSAGE ( E_MSG_1 ). V_TC_INDEX = '1'. V_TC_FLAG = 'X'. ENDIF. V_ROLE_PREV = V_ROLE. V_FIRST = 'X'. ENDIF. ENDDO. *MESSAGE ( MSG_1 ). SAPGUI ( PFCG_320_STEP_39 ). SAPGUI ( PFCG_300_STEP_6 ). SAPGUI ( PFCG_300_STEP_7 ). SAPGUI ( PFCG_121_STEP_8 ). ENDMESSAGE ( E_MSG_1 ). Thanks Awaiting, Essam

Read only

Former Member
0 Likes
1,844

This message was moderated.

Read only

matt
Active Contributor
0 Likes
1,844

I have fixed the formatting for you. Please note that communication via email is discouraged, please share information on the forum. Also note that publishing email addresses on the forums is NOT permitted. Please use your business card if you wish to be contactable via email

matt

Read only

prakashsaurav
Active Participant
0 Likes
1,844

This message was moderated.

Read only

Former Member
0 Likes
1,844

Thx mat For Formatting it for me.

Do u have an Idea as 2 how do i proceed with the Next Record in my Flat File.

After Getting an Error entry in my File.

Thanks Awaiting.

Essam

Read only

matt
Active Contributor
0 Likes
1,844

A couple of other rules you need to know about

1) Do not discuss your problem offline via email - the purpose of these forums is to share knowledge.

2) Spell words out in full. "You" not "u". These are professional forums, and professional communication is expected - not the kind you'd use sending a text message to a friend.

I am not an ECatt expert so cannot help you with your problem.

matt

Read only

Former Member
0 Likes
1,844

Hi,

In execution of Test configuration try change the start options.

Steps:

1. Select Execute button in Test Configuration.

2.In Shared Tab: a) Error Behavior: V Termination, Continue with next variant.

3. UI Control Tab: i) Error Mode for SAPGUI: C Continue

ii) Stop when : N Do not stop.

Thanks,

Srini

Read only

Former Member
0 Likes
1,844

Thankyou Srinivas,

But it didnt workout.

any other Solution.

Regards,

Essam

Read only

0 Likes
1,844

Hi,

Firstly in the Message interface define a Message Rule for the kind fo error you get while you execute PFCG for a particular role.

Use multiple Message and End Message Block, capture the errors. Now use control structures to decide what is to be done while an error occurs.

The error behaviour also will help you if u want to totally coem out the trasaction n start with a new session.

Regards,

Justin

Edited by: WishM@$ter on May 18, 2010 1:37 PM