on 02-20-2007 4:24 PM
Hello All,
I'm having a big headache with the following automation scenario on VL02N transaction:
- open a DN number
- use position button to trigger screen where u can select a line
- enter a line (script parameter)
- validate the line
- use the delete button to delete selected line
- confirm the deletion message
- save and exit
I recorded the whole good case in one step of SAPGUI.
Problem is:
A)without catching any message, if line does not exist (ex line is 20 and 20 is already deleted),
the script raise no error BUT erases the first line in the screen (ie the lowest remaining one)
B) the proper error msg ("Line does not exists") is only triggered when i enter the next interface of the screen but this interface do the deletion of the lowest line!!
so either:
- i don't put the deletion interface in the MSG block and the message is not raised
- i put the deleting interface in the MSG block , the message is raised but too late.
Do i handle the message badly?
Is there a way to split the deletion interface to have separately the error detection and the deletion?
See code below
VL02N_111_STEP_1 = choice of line to position on
VL02N_1000_STEP_2 = deletion of selected line
MESSAGE ( VERIF_LINE_EXISTS ).
SAPGUI ( VL02N_111_STEP_1 ). <= this is the dialog where i select the line and get the error msg in record time
ENDMESSAGE ( E_VERIF_LINE_EXISTS ).
DO &TFILL.
IF ( VERIF_LINE_EXISTS[&LPC]-MSGID = 'VL' ).
IF ( VERIF_LINE_EXISTS[&LPC]-MSGNR = 341 ).
LOG ( VERIF_LINE_EXISTS[&LPC]-MSGV1 ).
LOG ( VERIF_LINE_EXISTS[&LPC]-MSGV2 ).
SAPGUI ( VL02N_10_1). <= exiting without deleting anything
SAPGUI ( VL02N_1000_1 ).
SAPGUI ( VL02N_4004_1 ).
ENDIF.
ELSE.
LOG ( "LINE EXISTS" ).
SAPGUI ( VL02N_1000_STEP_2 ). <= deleting the line
ENDIF.
ENDDO.
===below is saving and existing the transaction
Hi Woody,
Position button would retrive/result in the desired result only when the value is present, else it would select those elements/lines which are possibly the next or the previous.
Like, suppose you are searching for 21 out of 20, 22, 23.. The search result would select 20 in some cases or 21 in some other cases. Its basically done on the alphabetical/numeric order in decending manner...
That might be one reason that you are not able to get a message saying wrong selection. To overcome such situation, I would have taken a list of database entries for the respective DN number and would have compared with the result.
One thumb rule which I follow is, when ever I am going to use position button, I would also use a gettab to retrive values from the table, which has helped me almost 95% of the times.
If that is a structure and/or there are multiple tables that are associated with the grid values, its always suggested to use SQL queries in INLINE ABAP.
Also, you could substitute a single IF instead of nested IF in your statements..
IF ( VERIF_LINE_EXISTS[&LPC]-MSGID = 'VL' AND VERIF_LINE_EXISTS[&LPC]-MSGNR = 341 ).
LOG ( VERIF_LINE_EXISTS[&LPC]-MSGV1 ).
LOG ( VERIF_LINE_EXISTS[&LPC]-MSGV2 ).
SAPGUI ( VL02N_10_1). <= exiting without deleting anything
SAPGUI ( VL02N_1000_1 ).
SAPGUI ( VL02N_4004_1 ).
ELSE.
LOG ( "LINE EXISTS" ).
SAPGUI ( VL02N_1000_STEP_2 ). <= deleting the line
ENDIF.
Also, see if the deletion is taken place basing on the row & col id of the line. If it is always deleting the line item 0,0 then you should make sure that you have to take the id of that line which is to be deleted.
Hope this info helps.
Best regards,
Harsha
PS: Reward points accordingly for all responding.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.