cancel
Showing results for 
Search instead for 
Did you mean: 

forms

Former Member
0 Kudos

in scripts and smart forms how can we identify the no pages given to the print?

how can we identify the current printing page in scripts and smart forms?

how can we get the totals in scripts ?as will as smart forms?

how can we get the sub totals in scripts and smart forms?

in scripts and smart forms how can we go from 1 page to last page directly?

is it possible to send form output directly to the mail in scripts/smart forms?if possible how?

in scripts is it possible to print in first page some data in port rot , and on second page i want to print some data in landscape? how?

in smart forms is it possible to print in first page some data in port rot , and on second page i want to print some data in landscape? how?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

HI,

How do I create Boxes in SAPScript?

You can create Boxes in the SAPScript using the BOX command specifying the x,y co-ordinates and the width and the height

BOX XPOS '0' CM YPOS '0.5' CM WIDTH '9.2' CM HEIGHT '3.5' CM FRAME 8 TW

How do I set tabs between the fields in display?

In the Paragraph Format tab, create a new paragraph format. In the "Tabs" Tab, enter the tab position and the alignment for the fields.

How do I create standard texts for the scripts?

You can create standard texts using the transaction SO10. Then to insert these standard texts in the SAPScript choose the menu, Insert->Text->Standard and choose the standard text that you want to choose.

Alternatively, you can display standard texts in your SAP Scripts using the command:

INCLUDE ZSTEXT OBJECT TEXT ID ST LANGUAGE EN

where ZSTEXT refers to the Standard Text name.

How can I debug my SAPScript?

Go to the transaction SE71.

Enter the form name.

Choose the menu Utilities->Activate Debugger to enable debugging.

I have created a script in language DE. Now I need to translate it to EN. How could I do this?

Open your script in transaction SE71.

In the Header screen, in the Language Attributes Option, choose Translate to... Option to translate to other languages.

How can I Word Wrap the text being displayed in SAPScript?

Use the Function Module RKD_WORD_WRAP to wrap the text and use this for output.

How can I display barcodes in SAPScripts?

Create a character format in the SAPScript.

Choose the Bar Code for the character format.

And finally to display barcodes, in the command enter:

<C1>&vbeln&</>

where C1 is the character format created and vbeln is the variable for which the barcode is to be created.

How can I print logos in SAPScripts?

Convert the logo to a TIFF(*.tif) file.

Use the program RSTXLDMC to convert the TIFF file to standard text.

Print this using the INCLUDE command:

INCLUDE ZLOGO OBJECT TEXT ID ST

For bitmaps (*.bmp)

Go to transaction SE78

Choose BMAP under GRAPHICS

Choose Import Graphic (F5)

Select the image and upload

In SE71 choose Insert->Graphics and then choose the image for display

How can I copy SAPScripts from one client to another?

In the transaction SE71, enter the Form name and choose the menu, Utilities->Copy from client to copy SAPScripts from one client to another.

Use RSTXSCRP to import/export SAPScripts.

How can I trigger new page in SAPScripts?

Use the command NEW-PAGE to trigger a new page in SAPScript.

How can I prevent page-break in the message that is to be displayed?

Enclose the text that you want to prevent page-break in PROTECT... ENDPROTECT

SAPscript will ensure that each line of this text is printed together on the same page.

/: PROTECT

  • Text

  • Within

  • The same page

/: ENDPROTECT

How can I set the position of the leading sign to left/right?

You can use the SET SIGN command to output the leading sign at the left or right.

/: SET SIGN LEFT

/: SET SIGN RIGHT

What are the various text formatting options in SAPScript?

&symbol(Z)& Omit Leading Zeros

&symbol(S)& Omit Leading Sign

&symbol(<)& Display Leading Sign to the Left

&symbol(>)& Display Leading Sign to the Right

&symbol(C)& Compress Spaces

&symbol(.N)& Display upto N decimal places

&symbol(T)& Omit thousands separator

&symbol(R)& Right justified

&symbol(I)& Suppress output of the initial value

Frequently Used System Variables in SAPScript?

&DATE& Currentdate

&DAY& Day

&MONTH& Month

&YEAR& Year

&TIME& Time of the day

&HOURS& Hours

&MINUTES& Minutes

&SECONDS& Seconds

&PAGE& Page

&NEXTPAGE& Next page number

&SPACE& Blank

&ULINE& Underline

&VLINE& Vertical line

&NAME_OF_MONTH& Name of the Month

&SAPSCRIPT-FORMPAGES& Total number of pages in currently formatted layout set

&SAPSCRIPT-JOBPAGES& Total number of pages in currently formatted print request

What are the different types of windows in SAP Scripts?

Windows are defined in the Layout sets which define the position and the text to displayed.

The different types of windows are:

MAIN - Main Window

The main window is a continous window which can extend over several pages. If the text in the main window fills up a page, a new page is created.

Only one main window can be defined in the SAP Script whereas upto 100 instances of main window can be created in a page.

VAR - Variable Window

This window can have the variable contents displayed on them. The contents of the window cannot exceed the window size. The content can be formatted for each page.

CONST - Constant Window

The constant window can have a fixed content and is formatted only once.

How can I format the date being displayed in the SAP Script?

The date fields in SAP Scripts can be formatted using the SET DATE MASK control command.

Eg.:

/: SET DATE MASK = 'MMMM DD, YY'

This displays the date as : September 26, 07

The following are the codes that can be used in the date mask:

YY Year (2 digits)

YYYY Year (4 Digits)

MM Month (2 Digits)

MMM Month Name (Abbreviated)

MMMM Month Name (Full)

DD Day as two digits

DDD Day name (Abbreviated)

DDDD Day name

Using the SET DATE MASK causes the subsequent date fields to be displayed using the same formatting. To return to the default formatting use the following command:

/: SET DATE MASK = ' '

How can I format the time in the SAP Script?

Similar to SET DATE MASK for date fields we can use SET TIME MASK for formatting time fields.

Eg.:

/: SET TIME MASK = 'HH hrs MM min SS sec'

This displays the time as : 11 hrs 43 min 37 sec'

The following are the codes that can be used in the time mask:

HH Hours

MM Minutes

SS Seconds

The time formatting can be reset to the default setting using:

/: SET TIME MASK = ' '

How can I apply shading for the BOXes in SAP Script?

Use the addition INTENSITY in the BOX command to apply gray shading to the boxes.

Eg:

BOX XPOS '0' CM YPOS '0.5' CM FRAME 8 TW INTENSITY 10

What is the difference between the SAP Script texts, 'Customer &KNA1-KUNNR&' and '&Customer KNA1-KUNNR&'?

In the first case of 'Customer : &KNA1-KUNNR&',

the text 'Customer : ' is displayed regardless of the variable KNA1-KUNNR even if it is having Initial value.

In the second case of '&Customer : KNA1-KUNNR&',

The text 'Customer :' and KNA1-KUNNR is displayed only when the variable KNA1-KUNNR has non-initial values.

How can I change the page size of the layout?

In the SAP Script, Goto -> Header -> Basic Settings

Here you could configure the page settings and their orientation.

How can I set the header and footer in the main window?

The TOP...ENDTOP and BOTTOM...ENDBOTTOM commands are used to set the header and footer texts in the main window respectively.

These texts will be displayed on the start and end of every new page in the output.

To disable these texts enclose empty commands between the commands.

Eg.:

/: TOP

/: ENDTOP

What the conditional statements used in SAP Scripts?

The following conditional statements are used in SAP Scripts:

IF..ELSE...ENDIF

CASE...ENDCASE

What is the use of the POSITION and SIZE command in SAP Scripts?

The POSITION command is used to x, y coordinate position which is used by the BOX command. The offset from the current window positions are specified which could be either positive or negative.

/: POSITION XORIGIN YORIGIN WINDOW PAGE

Eg.:

/: POSITION XORIGIN '2' CM YORIGIN '-1.5' CM

Similarly the SIZE command sets the width and height parameters.

/: SIZE WIDTH HEIGHT WINDOW PAGE

Eg.:

/: SIZE WIDTH 10 TW HEIGHT 10 TW

How to find the Driver Program for the given SAPscript ?

Step:1: Goto to the Table TNAPR using SE11

Step:2: Get the Contents of the Table(CNTRLSHIFTF10)

Step:3: On the Table Content Selection Screen, Type the SAPScript Name for which we have find the Driver Program in the field FONAM and execute(F8)

Step:4: PGNAM field of the result display contains the Driver Program Name for our SAPscript

Smartforms:

What are the differences between SAP Scripts and Smartforms?

SAP Scripts are client dependent whereas Smartforms are client independent.

SAP Scripts require a driver program to display the output whereas iHow to Create smartform Outpout as a PDF file and save it n smartforms the form routines can be written so that it is standalone.

An integrated Form Builder helps to design Smartforms more easily than SAP Scripts

An Table Painter and Smartstyles to assist in building up the smartforms

On activation a function module is generated for Smartforms

It is possible to create a Smartform without a main window

Smartforms generates XML output which can be viewed through the web

Multiple page formats is possible in smartforms

How can I insert symbols in Smartforms?

Select the Text node.

Change Editor (Click the button above Check near the Editor)

Go to menu Include->Characters->SAP Symbols

Choose the SAP symbol that you want to insert.

I have a smartform which works fine in DEV. After trasnsporting it to PROD, there is no Function module generated for this smartform. As a result my program dumps in PROD?

The Smartform that is created in the Development may not have the same name in the Production server. So it is always advised to use the Function Module SSF_FUNCTION_MODULE_NAME to get the Function Module name by passing the Smartform name.

DATA: fm_name TYPE rs38l_fnam.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZSMARTFORM'

IMPORTING

fm_name = fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CALL FUNCTION fm_name

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

How can I make the Smartforms to choose a printer name by default?

In the CALL FUNCTION of the Smartform Function Module, set the output options parameter to set the printer name.

The output options is of the type SSFCOMPOP which contains the field TDDEST. Set the TDDEST field to your default printer name.

How can I make the Smartforms to display a print preview by default without displaying the popup for print parameters?

In the SSF_OPEN function module,

Set the OUTPUT OPTIONS paramter TDDEST to your printer name.

Set the CONTROL PARAMETERS and control parameters as shown below,

control-preview = 'X'.

control-no_open = 'X'.

control-no_close = 'X'.

control-no_dialog = 'X'.

control-device = 'PRINTER'.

control_parameters-no_dialog = 'X'.

control_parameters-no_open = 'X'.

control_parameters-no_close = 'X'.

OUTPUT_OPTIONS-TDDEST = 'PRINTER NAME'.

OUTPUT_OPTIONS-TDNOPRINT = 'X'.

CALL FUNCTION 'SSF_OPEN'

EXPORTING

output_options = output_options

control_parameters = control

user_settings = ' '

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

How can I display the total number of pages in Smartforms?

Use SFSY-FORMPAGES to display the total number of pages in the Smartforms

&SFSY-PAGE& Current page number

&SFSY-FORMPAGE& Total number of pages in the currently formatted layout set

&SFSY-JOBPAGE& Total number of pages in the currently formatted print request

&SFSY-COPYCOUNT& Original-1,1st copy-2

&SFSY-DATE& Date

&SFSY-TIME& Time

&SFSY-USERNAME& Username

I'm using the variable SFSY-FORMPAGES, I get a star "*" instead of the total number of pages.

There may not be enough space in the window to display the variable, either increase the window dimensions or condense the spaces using &SFSY-FORMPAGES(C)&

What are the various text formatting options in Smartforms?

&symbol(Z)& Omit Leading Zeros

&symbol(S)& Omit Leading Sign

&symbol(<)& Display Leading Sign to the Left

&symbol(>)& Display Leading Sign to the Right

&symbol(C)& Compress Spaces

&symbol(.N)& Display upto N decimal places

&symbol(T)& Omit thousands separator

&symbol(R)& Right justified

&symbol(I)& Suppress output of the initial value

How can I provide a background shading to the table?

In the Table Painter, you can specify the color and shading for the table lines.

Where can I provide the input parameters to the smartform?

The input parameters for the smartform can be defined in Global Settings->Form Interface.

The Associated Type must be defined in the ABAP Dictionary.

Where can I define my own global types for the smartform?

The global types(within the smartform) can be defined in Global Settings->Global Definitions->Types

The types defined here will be global through the entire smartform.

Also the form routines can be defined Global Settings->Global Definitions->Form Routines

I have defined my own Program Lines, where I have used a global variable G_TEXT. I get an error G_TEXT is not defined?

Whenever using the global variables in the Program Lines, enter the variable name in Input Parameters if you are going to use(read) the variable. If you are going to both read/write the variable value enter the same in Output Parameters.

I have created a table node for display. Where can I check the condition which must satisfy to display the table?

The conditions can be defined in the Conditions tab. In smartforms all the nodes have a condition tab where you can specify the condition to be satisfied to access the node.

How can I define Page Protect in Smartforms?

To define Page Protect for a node go to the Output options and check the Page Protection checkbox.

What is the difference between Template and Table in Smartforms?

The Template contains a fixed number of rows and columns, where the output is fixed.

The Table can have variable number of rows

Where can I define the paragraph and character format for the smartforms?

The paragraph and character format for the smartforms can be defined in the transaction SMARTSTYLES

How to add watermark to smartform output?

Go to the properties of 'PAGE', tab 'Background Picture'. Add the grapic image name here.

MAILfrom scripts and smartform ,directly we can send mail using

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = w_doc_data

put_in_outbox = 'X'

sender_address = ld_sender_address

sender_address_type = ld_sender_address_type

commit_work = 'X'

IMPORTING

sent_to_all = w_sent_all

TABLES

packing_list = t_packing_list

contents_bin = t_attachment

contents_txt = it_message

receivers = t_receivers

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

document_type_not_exist = 3

operation_no_authorization = 4

parameter_error = 5

x_error = 6

enqueue_error = 7

OTHERS = 8.

Regards,

Shiva.

former_member184657
Active Contributor
0 Kudos

use the system fields

&sfsy-page& and &sfsy-formpages& to get the current and total pages.

u can get the totals by having a footer and do normal addition of fields values, by giving the right formula.

u can set the page setting to potrait and landsacpe by double clicking on Pages and then clicking the tab output options and select the format.

pk