cancel
Showing results for 
Search instead for 
Did you mean: 

GuiXT script steps into on-error process even if V[_lasterror] stays init.

former_member646435
Discoverer
0 Kudos

Hi!

I write a GUIXT Input script which calls PO13 transaction several times, where data come from a file. When an error occurs in a screen, the process must be continued with the next record from the file.

If the script doesn't find any error, it works well. When it finds an error, it still works well, as it steps into the on-error process. But with the next data record - which is correct - it steps again in the on-error process, however the _lasterror variable stays initial this time.

// Create Relationships 
Screen MP100100.2000
  Set F[Relationship type/relationship] 	"A"
  Set F[P1001-RELAT] 	"011"
  Set F[Type of related object] 	"K"
  Set F[ID of related object] 	&[s_kostl]
  Enter OnError="Continue"
 
  Set V[error] "1" 
  enter "/npo13"
  goto restart

// Create Relationships 
Screen MP100100.2000
  Enter "/11"      	// Save

Does anyone have an idea, what the problem is?

Thanks

Ákos

Accepted Solutions (1)

Accepted Solutions (1)

script_man
Active Contributor
0 Kudos

Hi Ákos,

The definition for onError = "Continue" is saying something else, but I have solved a similar problem as follows:


// Create Relationships 
Screen MP100100.2000
  Set F[Relationship type/relationship] 	"A"
  Set F[P1001-RELAT] 	"011"
  Set F[Type of related object] 	"K"
  Set F[ID of related object] 	&[s_kostl]
  Enter OnError="Continue"
   
// Create Relationships 
Screen MP100100.2000
    if V[_lasterror] or V[_lastwarning]
     Set V[error] "1" 
     set V[_lasterror] ""
     set V[_lastwarning] ""
     enter "/npo13"
     goto restart
   endif
   Enter "/11"      	// Save

Unfortunately I can't test it in detail, because I had not the transaction PO13.

Regards,

ScriptMan

Answers (1)

Answers (1)

former_member646435
Discoverer
0 Kudos

Hi ScriptMan!

Thanks for your answer. Your idea was good. Unfortunately after on-error I can't a call new screen - even if it is the same - but with your idea I found a solution which works.

// Create Relationships 
Screen MP100100.2000
  Set V[_lasterror] ""
  Set F[Relationship type/relationship] 	"A"
  Set F[P1001-RELAT] 	"011"
  Set F[Type of related object] 	"K"
  Set F[ID of related object] 	&[s_kostl]
  Enter OnError="Continue"
 
    if V[_lasterror]
    Set V[error] "1" 
    enter "/npo13"
    goto restart
    else
    enter "/11"
   endif 
  
// Create Relationships 
Screen MP100100.2000
    Enter "/11"      	// Save

Thanks again!

Ákos