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

SAPscript errors

aris_hidalgo
Contributor
0 Likes
1,538

Hi guys,

Currently I am experimenting on SAPscripts and I encountered an error. the first error is "bad_pageformat_for_print". Also, what is the use of element? do i need to declare that? how can I know the value of that particular element in write_form?

Also, if you can give me some examples and tips on SAPscriptI would really appreciate it.

Thanks!

1 ACCEPTED SOLUTION
Read only

amit_khare
Active Contributor
0 Likes
1,239

Hi Viray,

You can check out your mail ID.

Don't forget to reward helpful answer.

Amit

9 REPLIES 9
Read only

abdul_hakim
Active Contributor
0 Likes
1,239

Hi

Check your page format and ensure that it wont exceeds the window boundaries.

Well u have the option to use text elements or avoid it altogether but using will be recommended.

Once you have defined your layout setting then write your print program by making use of the FMs like OPEN_FORM,

START_FORM,WRITE_FORM and END_FORM.The FMs requirement may vary based on your requirement.

Regards,

Abdul

Read only

amit_khare
Active Contributor
0 Likes
1,239

Hi,

The elements are very necessary part of the SAPscripts as they tell the driver functions to call which part of the script at what time.

The error you are getting is due to the fact that data you are displaying is not well formed on the paragraph formats.

Kindly check them through.

If you can give me your email id I can provide you with a stepwise tutorial for SAPscript which will help you a lot.

Regards

Amit.

Read only

0 Likes
1,239

Hi! here is my e-mail address: viraylab@yahoo.com

Also, pasted below is the report that I made to call the form. Please give comments and suggestions.

REPORT ZRPT_ARIS_PRACTICE_11 .

*/----


*/ Table Definition

*/

TABLES ZMOVIES.

*/----


*/ Internal Table/Work Area Definition

*/

DATA: BEGIN OF IT_ZMOVIES OCCURS 0,

TITLE LIKE ZMOVIES-TITLE,

GENRE LIKE ZMOVIES-GENRE,

YEAR_RELEASED LIKE ZMOVIES-YEAR_RELEASED,

CASTS LIKE ZMOVIES-CASTS,

PRODUCER LIKE ZMOVIES-PRODUCER,

DIRECTOR LIKE ZMOVIES-DIRECTOR,

REVIEW LIKE ZMOVIES-REVIEW,

SYNOPSIS LIKE ZMOVIES-SYNOPSIS,

END OF IT_ZMOVIES.

*/----


*/ Selection Screen

*/

SELECTION-SCREEN BEGIN OF BLOCK BLOCK1 WITH FRAME TITLE TEXT-001.

PARAMETERS: SP_TITLE LIKE IT_ZMOVIES-TITLE.

SELECTION-SCREEN END OF BLOCK BLOCK1.

/----


/ Main Routine Program

*/

START-OF-SELECTION.

PERFORM GET_RECORDS.

PERFORM OPEN_FORM.

END-OF-SELECTION.

FORM GET_RECORDS.

SELECT *

FROM ZMOVIES

INTO TABLE IT_ZMOVIES.

ENDFORM.

*form open_form

FORM OPEN_FORM.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

DEVICE = 'PRINTER'

FORM = 'ZFRM_ARIS'

DIALOG = 'X'

EXCEPTIONS

CANCELED = 1

DEVICE = 2

FORM = 3

OPTIONS = 4

UNCLOSED = 5

OTHERS = 6.

IF SY-SUBRC <> 0.

WRITE 'Error in open_form'.

EXIT.

ENDIF.

CALL FUNCTION 'START_FORM'

EXCEPTIONS

OTHERS = 1.

IF SY-SUBRC <> 0.

WRITE 'Error in start_form'.

EXIT.

ENDIF.

*write_form

PERFORM WRITE_FORM.

CALL FUNCTION 'END_FORM'

EXCEPTIONS

OTHERS = 1.

IF SY-SUBRC <> 0.

WRITE 'Error in end_form'.

EXIT.

ENDIF.

CALL FUNCTION 'CLOSE_FORM'

EXCEPTIONS

OTHERS = 1.

IF SY-SUBRC <> 0.

WRITE 'Error in close_form'.

ENDIF.

ENDFORM.

*write_form

FORM WRITE_FORM.

LOOP AT IT_ZMOVIES.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'XXX'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

EXCEPTIONS

ELEMENT = 1

FUNCTION = 2

TYPE = 3

UNOPENED = 4

UNSTARTED = 5

WINDOW = 6

BAD_PAGEFORMAT_FOR_PRINT = 7.

IF SY-SUBRC = 1.

WRITE: 'error in element!'.

ELSEIF SY-SUBRC = 2.

WRITE: 'error in function'.

ELSEIF SY-SUBRC = 3.

WRITE: 'error in type'.

ELSEIF SY-SUBRC = 4.

WRITE: 'unopened'.

ELSEIF SY-SUBRC = 5.

WRITE: 'unstarted'.

ELSEIF SY-SUBRC = 6.

WRITE: 'error in window'.

ELSE.

WRITE: 'bad_pageformat_for_print!'.

EXIT.

ENDIF.

ENDLOOP.

ENDFORM.

Read only

Former Member
0 Likes
1,239

Try to Give DINA4 or some proper page format, and align..

and elements you need to go to layout and and check for

elements , element command '/E' and look for them and specify them in write form, otherwise text or variables under that element will not print (if they are under some element)...

regards

vijay

Read only

Former Member
0 Likes
1,239

Hi,

The error may be because the page format you have specified doesnt suit the printer you are using. Change the printer settings for this.

Elements are declared for logical processing of a part of the code in script.

If you want some part of teh code to be executed based on some conditional statement, then you give this under one element and while calling from the program call this element seperately.

Regards.

Lavanya.

Read only

Former Member
0 Likes
1,239

elements are required wen u want a particular piece of information to be displayed in sapscript at a particular time in the program( eg, if some condition is met or after a loop, etc ).

Regards,

Bikash

Read only

amit_khare
Active Contributor
0 Likes
1,240

Hi Viray,

You can check out your mail ID.

Don't forget to reward helpful answer.

Amit

Read only

0 Likes
1,239

hi

element can be declared in the script using prefix '/', it tells the script thru the driver program that which part of the script should be processed based on the selected element name!!

regarding ur error....since it's related to bad page format ...do check ur page format and make it DINA4 if that suits( u can find that in basic settings of the form)

Also, after u have created the form ..go to menu (form->check->text..check the first two option and press enter)..next window will ask for the print program appen dur print program and click on copy..it will display all the relevant errors that may have creaped in)

hope this helps!

PLz reward valuable points by clicking on the star!!

Regards

Gunjan

Read only

aris_hidalgo
Contributor
0 Likes
1,239

Thanks guys for your help! I really appreciate it.