cancel
Showing results for 
Search instead for 
Did you mean: 

Sapscript Window Skipped Over Intermittently

Former Member
0 Kudos

Hello,

I've got a problem that I haven't seen anywhere on this forum. The Main window of our custom payment advice form is being called from driver program RFFOUS_T. We are occasionally seeing that the line item element is being called by the program and is being skipped over. I have watched in the sapscript debugger and can see that flow control goes to the first line, /E 625, and then immediately returns to the calling program without stepping into the element logic. What's supremely baffling, it sometimes will step into the logic, and I can see no indication of why it sometimes does and sometimes doesn't. In the test data I was given, the first line steps into the element and works fine and the second one does not. I've check the return code from the driver program's call to function 'WRITE_FORM', and it is 0 in both cases.

Here is the code in the driver:

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = '625'

function = 'APPEND'

EXCEPTIONS

window = 1

element = 2.

Here is the line item element in the main window:

/E 625

/* -


Line items -


/: PROTECT

T1 ,,&REGUP-XBLNR&,,&REGUP-BLDAT&,,&REGUP-BELNR&

= ,,&REGUD-WRBTR(13)&

= ,,&REGUD-WABZG(12)&,,&REGUD-WNETT(13)&

/* Change description based on first character of vendor field

/: IF &REGUH-LIFNR(1)& = '9'

ZE ,,<I>&REGUP-SGTXT&</>

/: ELSE

/: PERFORM GET_SGTXT IN PROGRAM ZFI_CHECK_FOR_USA_FORM

/: USING &REGUP-BUKRS&

/: USING &REGUP-BELNR&

/: USING &REGUP-GJAHR&

/: USING &REGUP-BUZEI&

/: CHANGING &V_SGTXT&

/: ENDPERFORM.

ZE ,,<I>&V_SGTXT&</>

/: ENDPROTECT

Is there any reason any of you can think of why this would happen? I will explore all ideas.

Thanks,

Nathan Beeler

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

The solution (after working with an analyst): one section had an if/else statement that was missing its endif. So the following section that was getting skipped was doing so because it was being lumped into the non-used side of the else statement (until its own endif statement was hit). I still think this is an incredibly horrible way to handle an obvious syntax error by the sapscript transaction, but there you have it. Thanks for the suggestions, all.

matthiasengel01
Discoverer
0 Kudos

Thank you thats it !

When there is a direct skip in the textelement it could be because an unclosed IF statement in the former textelement.

Yes sapscript has no syntax check for that ....

Former Member
0 Kudos

Hey all,

Perhaps I wasn't clear in what I'm asking for above - I'd just like to hear anyone's ideas about why this behaviour would exist at all. Does anyone know of any configuration setting or form setting or anything that would send flow control into the sapscript element only to immediately jump back out again? There is no visible difference I can see in why it would enter the element logic one time and not another, so I'm hoping that the community can give me ideas about where to look.

Thanks,

Nathan Beeler

Former Member
0 Kudos

Nathan,

It could be because of the PROTECT command.

It is able to go into the text element for the first item because the system is able to protect the element from a page break.

For the second item maybe there is not enough space to protect it.

Please check that.

Hope it solves the problem.

Regards,

-Ramesh

Former Member
0 Kudos

Hello Ramesh,

Thanks for the reply. I have already tried removing the protect command, thinking it might be the problem, but it made no difference. It still doesn't step into the element the second time. Moreover, the protect command would create a second page if the combined length of the new text turned out to be too much to fit on the page. The program isn't even getting into the logic to find out if it's too much (nor is it sending it to a second page).

Thank you for the suggestion.

Nathan