Application Development 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: 

SAP Scripts and Forms

Former Member
0 Kudos

Hi experts...Can someone give me a push start on SAP Scripts and Forms with simple examples and simple guidelines on how i go about creating them.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI

SAPScripts

Link for SAP Scripts (step by step procedure)

http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Create_A_SAPSCRIPT_Form/How_to_Create_SAPS...

http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf

http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf

http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf

http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf

http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf

http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-sub...

SAP SCRIPT FIELDS

http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/8033ea454211d189710000e8322d00/content.htm

scripts easy material

http://www.allsaplinks.com/sap_script_made_easy.html

DIFFERENCE BETWEEN SMARTFORMS AND SAPSCRIPTS ARE:

1. script is client dependent one while smartform is client independent.

2. In scripts we have to write print program while in smart forms it is not necessary.

3. In scripts we can print background logo while in smartforms we cant print background logo

4. In scripts we have 99 main windows while in smartforms we have only 1 main window.

5. In scripts we should write paragraph format otherwise we cant execute program while in smartforms no need to create paragraph formats .

6. In scripts we can print the text in only two character formats.

while in smartforms we can do with more.

7. In scripts we dont have line types while in smartforms we have linetypes.

8.Multiple page formats are possible in smartforms which is not the case in SAPScripts

9.It is possible to have a smartform without a main window .

10.Labels cannot be created in smartforms.

11.Routines can be written in smartforms tool.

12.Smartforms generates a function module when activated.

SAPscript technology is based on a mainframe product from the 1980s, while Smart Forms have only been around since (roughly) 2001. With that sort of time gap, there are bound to be significant differences between the two tools. Client dependence is a fundamental one. Although SAPscript has had some incremental improvements over time, its forms have always been -- under the hood -- relatively ...

also refer

Whenever a smartform is created, a funciton module gets generated. So, we can access the smartform in different clients. But in case of scripts, it is not so.. So, scripts are client dependent.

Smart Forms are implemented using the Function Module SSF*, and all the logic lies in the FM. Function Modules are client independent objects, so Smart forms are also client independent

SAP Scripts are the Layout Forms that you design and there are aviable in the client in which you have created them, for making them available you have to copy across the clients.

Because, Sapscripts are saved in ITF format as text in client dependant tables STXH and STXL. smartforms are not saved in client dependant tables and visible across clients.

SAPscript technology is based on a mainframe product from the 1980s, while Smart Forms have only been around since (roughly) 2001. With that sort of time gap, there are bound to be significant differences between the two tools. As you have noted correctly, client dependence is a fundamental one.

Although SAPscript has had some incremental improvements over time, its forms have always been -- under the hood -- relatively passive objects, with minimal embedded logic. These forms were designed to be driven and controlled by ABAP programs, much in the way ABAP programs read in database tables to produce reports; if you ever download a SAPscript form (e.g., via utility program RSTXSCRP), and look at the portable text file it produces you'll see what I mean. Many text objects (e.g., invoice header texts) are bound directly to documents which are client-dependent, so it makes sense for these text objects to also be client-dependent. From a complexity standpoint, SAPscript forms are close enough to these text objects where I can see how it made sense at the time to make them client-dependent too.

Conversely, a Smart Form is significantly more robust and complex. For instance, it can contain program nodes and nested tables with patterns. When a Smart Form is compiled, it generates an ABAP function module – and these are always client-independent. This is appropriate, given that this form has more in common with an ABAP program than its predecessor. For instance, when a print program calls a Smart Form, the form itself takes over to produce output, without any further direction from the print program. In fact, the join is so seamless that I often find myself using a Smart Form's Initialization section for logic to handle any data gathering not handled by the print program. I would never even think to attempt this with SAPscript.

I suspect several factors figured into SAP's decision to make Smart Forms client-independent, including customer feedback. There are significant advantages to client-independence. For instance, a change made in one development client happens immediately across all development clients. Among other things, this means we don't have to waste time figuring which client contains the most recent version -- they all do! In addition, transporting Smart Forms is easier, since we can safely bundle them together in the same transport as their client-independent print programs (no worry about mixing client-dependent and independent objects).

Structure of a print program

OPEN_FORM function

CLOSE_FORM function

WRITE_FORM

START_FORM function

END_FORM function

CONTROL_FORM function

The print program is used to print forms. The program retieves the necesary data from datbase tables, defines the order of in which text elements are printed, chooses a form for printing and selects an output device and print options.

Function modules in a printprogram:

• When you print a form you must used the staments OPEN_FORM and CLOSE_FORM. To combine forms into a single spool request use START_FORM and END_FORM.

• To print textelements in a form use WRITE_FORM. The order in which the textelements are printed, is determined by the order of the WRITE_FORM statements. Note: for printing lines in the body, you can also use the WRITE_FORM_LINES function module.

• To transfer control command to a form use CONTROL_FORM.

Structure of a print program

  • Read data

Tables: xxx.

SELECT *

FROM xxx.

  • Open form printing - Must be called before working with any of the other form function modules.

  • Must be ended with function module CLOSE FORM

call function 'OPEN_FORM'.....

  • To begin several indentical forms containing different data within a single spool request, begin each form using START_FORM, and end it using END_FORM

call funtion 'START_FORM'.....

  • Write text elements to a window of the form

call function 'WRITE_FORM'.....

  • Ends spool request started with START_FORM

call funtion 'END_FORM'.....

  • Closes form printing

call function 'CLOSE_FORM'...

OPEN_FORM function

Syntax:

CALL FUNCTION 'OPEN_FORM'

  • EXPORTING

  • APPLICATION = 'TX'

  • ARCHIVE_INDEX =

  • ARCHIVE_PARAMS =

  • DEVICE = 'PRINTER'

  • DIALOG = 'X'

  • FORM = ' '

  • LANGUAGE = SY-LANGU

  • OPTIONS =

  • MAIL_SENDER =

  • MAIL_RECIPIENT =

  • MAIL_APPL_OBJECT =

  • RAW_DATA_INTERFACE = '*'

  • IMPORTING

  • LANGUAGE =

  • NEW_ARCHIVE_PARAMS =

  • RESULT =

  • EXCEPTIONS

  • CANCELED = 1

  • DEVICE = 2

  • FORM = 3

  • OPTIONS = 4

  • UNCLOSED = 5

  • MAIL_OPTIONS = 6

  • ARCHIVE_ERROR = 7

  • INVALID_FAX_NUMBER = 8

  • MORE_PARAMS_NEEDED_IN_BATCH = 9

  • SPOOL_ERROR = 10

  • OTHERS = 11

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Some important parameters:

FORM Name of the form

DEVICE • PRINTER : Print output using spool

• TELEFAX: Fax output

• SCREEN: Output to screen

OPTIONS Used to control attrubutes for printing or faxing (Number of copies, immediate output....

The input for the parameter is structure ITCPO.

CLOSE_FORM function

CALL FUNCTION 'CLOSE_FORM'

  • IMPORTING

  • RESULT =

  • RDI_RESULT =

  • TABLES

  • OTFDATA =

  • EXCEPTIONS

  • UNOPENED = 1

  • BAD_PAGEFORMAT_FOR_PRINT = 2

  • SEND_ERROR = 3

  • SPOOL_ERROR = 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.

Paramerters:

RESULT Returns status information and print/fax parameters after the form has been printed. RESULT is of structure ITCPP.

WRITE_FORM function

CALL FUNCTION 'WRITE_FORM'

  • EXPORTING

  • ELEMENT = ' '

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

  • WINDOW = 'MAIN'

  • IMPORTING

  • PENDING_LINES =

  • EXCEPTIONS

  • ELEMENT = 1

  • FUNCTION = 2

  • TYPE = 3

  • UNOPENED = 4

  • UNSTARTED = 5

  • WINDOW = 6

  • BAD_PAGEFORMAT_FOR_PRINT = 7

  • SPOOL_ERROR = 8

  • OTHERS = 9

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Some important parameters:

ELEMENT Specifies which textelement is printed

WINDOW Specifies which window is printed

TYPE Specifies the output area of the main window. This can be:

• TOP - Used for headers

• BODY

• BOTTOM - Used for footers

FUNCTION Specifies whether text is to be appended, replaced or added

Example of how to use the WRITE_FORM function module together with a script.

Form layout of the MAIN window

/E INTRODUCTION

  • Dear Customer

...........................

/E ITEM_HEADER

IH Carrier, Departure

/E ITEM_LINE

IL &SBOOK-CARRID&, &SPFLI-DEPTIME&

/E CLOSING_REMARK

The print program

  • Writing INTRODUCTION

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'INTRODUCTION'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

EXCEPTIONS

OTHERS = 8

.

  • Writing ITEM_HEADER

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ITEM_HEADER'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

EXCEPTIONS

OTHERS = 8

.

  • Set ITEM_HEADER into TOP area of main window for subsequent pages

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ITEM_HEADER'

FUNCTION = 'SET'

TYPE = 'TOP'

WINDOW = 'MAIN'

EXCEPTIONS

OTHERS = 8

  • Write ITEM_LINE

LOOP AT .....

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ITEM_LINE'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

EXCEPTIONS

OTHERS = 8.

ENDLOOP.

  • Delete ITEM_HEADER from TOP area of main window

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ITEM_HEADER'

FUNCTION = 'DELETE'

TYPE = 'TOP'

WINDOW = 'MAIN'

EXCEPTIONS

OTHERS = 8

  • Print CLOSING_REMARK

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'CLOSING_REMARK'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

EXCEPTIONS

OTHERS = 8

START_FORM function

CALL FUNCTION 'START_FORM'

  • EXPORTING

  • ARCHIVE_INDEX =

  • FORM = ' '

  • LANGUAGE = ' '

  • STARTPAGE = ' '

  • PROGRAM = ' '

  • MAIL_APPL_OBJECT =

  • IMPORTING

  • LANGUAGE =

  • EXCEPTIONS

  • FORM = 1

  • FORMAT = 2

  • UNENDED = 3

  • UNOPENED = 4

  • UNUSED = 5

  • SPOOL_ERROR = 6

  • OTHERS = 7

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

END_FORM function

CALL FUNCTION 'END_FORM'

  • IMPORTING

  • RESULT =

  • EXCEPTIONS

  • UNOPENED = 1

  • BAD_PAGEFORMAT_FOR_PRINT = 2

  • SPOOL_ERROR = 3

  • OTHERS = 4

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CONTROL_FORM function

The CONTROL_FORM function module alows you to create SapScript control statements from within an APAB program.

Syntax:

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command =

  • EXCEPTIONS

  • UNOPENED = 1

  • UNSTARTED = 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.

Example:

Protecting the text element ITEM_LINE

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

COMMAND = 'PROTECT'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

TEXELEMENT = 'ITEM_LINE'.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

COMMAND = 'ENDPROTECT'.

<b>Reward points for useful Answers</b>

Regards

Preeti

3 REPLIES 3

Former Member
0 Kudos

HI

SAPScripts

Link for SAP Scripts (step by step procedure)

http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Create_A_SAPSCRIPT_Form/How_to_Create_SAPS...

http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf

http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf

http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf

http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf

http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf

http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-sub...

SAP SCRIPT FIELDS

http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/8033ea454211d189710000e8322d00/content.htm

scripts easy material

http://www.allsaplinks.com/sap_script_made_easy.html

DIFFERENCE BETWEEN SMARTFORMS AND SAPSCRIPTS ARE:

1. script is client dependent one while smartform is client independent.

2. In scripts we have to write print program while in smart forms it is not necessary.

3. In scripts we can print background logo while in smartforms we cant print background logo

4. In scripts we have 99 main windows while in smartforms we have only 1 main window.

5. In scripts we should write paragraph format otherwise we cant execute program while in smartforms no need to create paragraph formats .

6. In scripts we can print the text in only two character formats.

while in smartforms we can do with more.

7. In scripts we dont have line types while in smartforms we have linetypes.

8.Multiple page formats are possible in smartforms which is not the case in SAPScripts

9.It is possible to have a smartform without a main window .

10.Labels cannot be created in smartforms.

11.Routines can be written in smartforms tool.

12.Smartforms generates a function module when activated.

SAPscript technology is based on a mainframe product from the 1980s, while Smart Forms have only been around since (roughly) 2001. With that sort of time gap, there are bound to be significant differences between the two tools. Client dependence is a fundamental one. Although SAPscript has had some incremental improvements over time, its forms have always been -- under the hood -- relatively ...

also refer

Whenever a smartform is created, a funciton module gets generated. So, we can access the smartform in different clients. But in case of scripts, it is not so.. So, scripts are client dependent.

Smart Forms are implemented using the Function Module SSF*, and all the logic lies in the FM. Function Modules are client independent objects, so Smart forms are also client independent

SAP Scripts are the Layout Forms that you design and there are aviable in the client in which you have created them, for making them available you have to copy across the clients.

Because, Sapscripts are saved in ITF format as text in client dependant tables STXH and STXL. smartforms are not saved in client dependant tables and visible across clients.

SAPscript technology is based on a mainframe product from the 1980s, while Smart Forms have only been around since (roughly) 2001. With that sort of time gap, there are bound to be significant differences between the two tools. As you have noted correctly, client dependence is a fundamental one.

Although SAPscript has had some incremental improvements over time, its forms have always been -- under the hood -- relatively passive objects, with minimal embedded logic. These forms were designed to be driven and controlled by ABAP programs, much in the way ABAP programs read in database tables to produce reports; if you ever download a SAPscript form (e.g., via utility program RSTXSCRP), and look at the portable text file it produces you'll see what I mean. Many text objects (e.g., invoice header texts) are bound directly to documents which are client-dependent, so it makes sense for these text objects to also be client-dependent. From a complexity standpoint, SAPscript forms are close enough to these text objects where I can see how it made sense at the time to make them client-dependent too.

Conversely, a Smart Form is significantly more robust and complex. For instance, it can contain program nodes and nested tables with patterns. When a Smart Form is compiled, it generates an ABAP function module – and these are always client-independent. This is appropriate, given that this form has more in common with an ABAP program than its predecessor. For instance, when a print program calls a Smart Form, the form itself takes over to produce output, without any further direction from the print program. In fact, the join is so seamless that I often find myself using a Smart Form's Initialization section for logic to handle any data gathering not handled by the print program. I would never even think to attempt this with SAPscript.

I suspect several factors figured into SAP's decision to make Smart Forms client-independent, including customer feedback. There are significant advantages to client-independence. For instance, a change made in one development client happens immediately across all development clients. Among other things, this means we don't have to waste time figuring which client contains the most recent version -- they all do! In addition, transporting Smart Forms is easier, since we can safely bundle them together in the same transport as their client-independent print programs (no worry about mixing client-dependent and independent objects).

Structure of a print program

OPEN_FORM function

CLOSE_FORM function

WRITE_FORM

START_FORM function

END_FORM function

CONTROL_FORM function

The print program is used to print forms. The program retieves the necesary data from datbase tables, defines the order of in which text elements are printed, chooses a form for printing and selects an output device and print options.

Function modules in a printprogram:

• When you print a form you must used the staments OPEN_FORM and CLOSE_FORM. To combine forms into a single spool request use START_FORM and END_FORM.

• To print textelements in a form use WRITE_FORM. The order in which the textelements are printed, is determined by the order of the WRITE_FORM statements. Note: for printing lines in the body, you can also use the WRITE_FORM_LINES function module.

• To transfer control command to a form use CONTROL_FORM.

Structure of a print program

  • Read data

Tables: xxx.

SELECT *

FROM xxx.

  • Open form printing - Must be called before working with any of the other form function modules.

  • Must be ended with function module CLOSE FORM

call function 'OPEN_FORM'.....

  • To begin several indentical forms containing different data within a single spool request, begin each form using START_FORM, and end it using END_FORM

call funtion 'START_FORM'.....

  • Write text elements to a window of the form

call function 'WRITE_FORM'.....

  • Ends spool request started with START_FORM

call funtion 'END_FORM'.....

  • Closes form printing

call function 'CLOSE_FORM'...

OPEN_FORM function

Syntax:

CALL FUNCTION 'OPEN_FORM'

  • EXPORTING

  • APPLICATION = 'TX'

  • ARCHIVE_INDEX =

  • ARCHIVE_PARAMS =

  • DEVICE = 'PRINTER'

  • DIALOG = 'X'

  • FORM = ' '

  • LANGUAGE = SY-LANGU

  • OPTIONS =

  • MAIL_SENDER =

  • MAIL_RECIPIENT =

  • MAIL_APPL_OBJECT =

  • RAW_DATA_INTERFACE = '*'

  • IMPORTING

  • LANGUAGE =

  • NEW_ARCHIVE_PARAMS =

  • RESULT =

  • EXCEPTIONS

  • CANCELED = 1

  • DEVICE = 2

  • FORM = 3

  • OPTIONS = 4

  • UNCLOSED = 5

  • MAIL_OPTIONS = 6

  • ARCHIVE_ERROR = 7

  • INVALID_FAX_NUMBER = 8

  • MORE_PARAMS_NEEDED_IN_BATCH = 9

  • SPOOL_ERROR = 10

  • OTHERS = 11

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Some important parameters:

FORM Name of the form

DEVICE • PRINTER : Print output using spool

• TELEFAX: Fax output

• SCREEN: Output to screen

OPTIONS Used to control attrubutes for printing or faxing (Number of copies, immediate output....

The input for the parameter is structure ITCPO.

CLOSE_FORM function

CALL FUNCTION 'CLOSE_FORM'

  • IMPORTING

  • RESULT =

  • RDI_RESULT =

  • TABLES

  • OTFDATA =

  • EXCEPTIONS

  • UNOPENED = 1

  • BAD_PAGEFORMAT_FOR_PRINT = 2

  • SEND_ERROR = 3

  • SPOOL_ERROR = 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.

Paramerters:

RESULT Returns status information and print/fax parameters after the form has been printed. RESULT is of structure ITCPP.

WRITE_FORM function

CALL FUNCTION 'WRITE_FORM'

  • EXPORTING

  • ELEMENT = ' '

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

  • WINDOW = 'MAIN'

  • IMPORTING

  • PENDING_LINES =

  • EXCEPTIONS

  • ELEMENT = 1

  • FUNCTION = 2

  • TYPE = 3

  • UNOPENED = 4

  • UNSTARTED = 5

  • WINDOW = 6

  • BAD_PAGEFORMAT_FOR_PRINT = 7

  • SPOOL_ERROR = 8

  • OTHERS = 9

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Some important parameters:

ELEMENT Specifies which textelement is printed

WINDOW Specifies which window is printed

TYPE Specifies the output area of the main window. This can be:

• TOP - Used for headers

• BODY

• BOTTOM - Used for footers

FUNCTION Specifies whether text is to be appended, replaced or added

Example of how to use the WRITE_FORM function module together with a script.

Form layout of the MAIN window

/E INTRODUCTION

  • Dear Customer

...........................

/E ITEM_HEADER

IH Carrier, Departure

/E ITEM_LINE

IL &SBOOK-CARRID&, &SPFLI-DEPTIME&

/E CLOSING_REMARK

The print program

  • Writing INTRODUCTION

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'INTRODUCTION'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

EXCEPTIONS

OTHERS = 8

.

  • Writing ITEM_HEADER

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ITEM_HEADER'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

EXCEPTIONS

OTHERS = 8

.

  • Set ITEM_HEADER into TOP area of main window for subsequent pages

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ITEM_HEADER'

FUNCTION = 'SET'

TYPE = 'TOP'

WINDOW = 'MAIN'

EXCEPTIONS

OTHERS = 8

  • Write ITEM_LINE

LOOP AT .....

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ITEM_LINE'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

EXCEPTIONS

OTHERS = 8.

ENDLOOP.

  • Delete ITEM_HEADER from TOP area of main window

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ITEM_HEADER'

FUNCTION = 'DELETE'

TYPE = 'TOP'

WINDOW = 'MAIN'

EXCEPTIONS

OTHERS = 8

  • Print CLOSING_REMARK

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'CLOSING_REMARK'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

EXCEPTIONS

OTHERS = 8

START_FORM function

CALL FUNCTION 'START_FORM'

  • EXPORTING

  • ARCHIVE_INDEX =

  • FORM = ' '

  • LANGUAGE = ' '

  • STARTPAGE = ' '

  • PROGRAM = ' '

  • MAIL_APPL_OBJECT =

  • IMPORTING

  • LANGUAGE =

  • EXCEPTIONS

  • FORM = 1

  • FORMAT = 2

  • UNENDED = 3

  • UNOPENED = 4

  • UNUSED = 5

  • SPOOL_ERROR = 6

  • OTHERS = 7

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

END_FORM function

CALL FUNCTION 'END_FORM'

  • IMPORTING

  • RESULT =

  • EXCEPTIONS

  • UNOPENED = 1

  • BAD_PAGEFORMAT_FOR_PRINT = 2

  • SPOOL_ERROR = 3

  • OTHERS = 4

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CONTROL_FORM function

The CONTROL_FORM function module alows you to create SapScript control statements from within an APAB program.

Syntax:

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command =

  • EXCEPTIONS

  • UNOPENED = 1

  • UNSTARTED = 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.

Example:

Protecting the text element ITEM_LINE

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

COMMAND = 'PROTECT'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

TEXELEMENT = 'ITEM_LINE'.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

COMMAND = 'ENDPROTECT'.

<b>Reward points for useful Answers</b>

Regards

Preeti

Former Member
0 Kudos

for Smartforms material

http://www.sap-basis-abap.com/sapsf001.htm

http://www.sap-press.com/downloads/h955_preview.pdf

http://www.ossincorp.com/Black_Box/Black_Box_2.htm

http://www.sap-img.com/smartforms/sap-smart-forms.htm

http://www.sap-img.com/smartforms/smartform-tutorial.htm

http://www.sapgenie.com/abap/smartforms.htm

How to trace smartform

http://help.sap.com/saphelp_47x200/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm

http://www.help.sap.com/bp_presmartformsv1500/DOCU/OVIEW_EN.PDF

http://www.sap-img.com/smartforms/smart-006.htm

http://www.sap-img.com/smartforms/smartforms-faq-part-two.htm

check most imp link

http://www.sapbrain.com/ARTICLES/TECHNICAL/SMARTFORMS/smartforms.html

step by step good ex link is....

http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.h...

Subtotals - Check the link...

Please go to this link:-

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d937ec90-0201-0010-0ca8-b6cb3b6d...

Check these step-by-step links

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/ccab6730-0501...

https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-001...

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3c5d9ae3-0501...

SAPScripts

http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf

http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf

http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf

http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf

http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf

http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-sub...

SAP SCRIPT FIELDS

http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/8033ea454211d189710000e8322d00/content.htm

scripts easy material

<b>http://www.allsaplinks.com/sap_script_made_easy.html</b>

Debugging Document.

http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc

http://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm

http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc

http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/84/1f624f4505144199e3d570cf7a9225/frameset.htm

http://help.sap.com/saphelp_bw30b/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm

regards,

srinivas

<b>*reward for useful answers*</b>