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: 

need some examples for smartforms and scripts

Former Member
0 Kudos

hi

now i am working in scripts and smartforms. so i need some examples and some information for scripts and smartforms. where i can find that information.

1 ACCEPTED SOLUTION

former_member208856
Active Contributor
0 Kudos

Hi,

You can take help from these programs for smartforms in R/3 system :

Tcode SE38 (For ABAP Program) and Smartforms (For Design Smartform)

SF_EXAMPLE_01

SF_EXAMPLE_02

SF_EXAMPLE_03

Regards,

Sandeep Kaushik

8 REPLIES 8

Former Member
0 Kudos

Hi

Check these links.

SMARTFORMS

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCRSF/BCSRVSCRSF.pdf

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

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

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

http://help.sap.com/saphelp_46c/helpdata/en/a5/de6838abce021ae10000009b38f842/frameset.htm

http://help.sap.com/printdocu/core/Print46c/en/Data/htm/english.htm

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

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

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

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

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

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.sapgenie.com/abap/smartforms_detail.htm

also,

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

Hope this resolves your query.

Reward all the helpful answers.

Regards

Message was edited by:

Pritha Agrawal

Former Member
0 Kudos

Hi

How to create a New smartfrom, it is having step by step procedure

http://sap.niraj.tripod.com/id67.html

Here is the procedure

1. Create a new smartforms

Transaction code SMARTFORMS

Create new smartforms call ZSMART

2. Define looping process for internal table

Pages and windows

First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)

Here, you can specify your title and page numbering

&SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)

Main windows -> TABLE -> DATA

In the Loop section, tick Internal table and fill in

ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2

3. Define table in smartforms

Global settings :

Form interface

Variable name Type assignment Reference type

ITAB1 TYPE Table Structure

Global definitions

Variable name Type assignment Reference type

ITAB2 TYPE Table Structure

4. To display the data in the form

Make used of the Table Painter and declare the Line Type in Tabstrips Table

e.g. HD_GEN for printing header details,

IT_GEN for printing data details.

You have to specify the Line Type in your Text elements in the Tabstrips Output options.

Tick the New Line and specify the Line Type for outputting the data.

Declare your output fields in Text elements

Tabstrips - Output Options

For different fonts use this Style : IDWTCERTSTYLE

For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&

5. Calling SMARTFORMS from your ABAP program

REPORT ZSMARTFORM.

  • Calling SMARTFORMS from your ABAP program.

  • Collecting all the table data in your program, and pass once to SMARTFORMS

  • SMARTFORMS

  • Declare your table type in :-

  • Global Settings -> Form Interface

  • Global Definintions -> Global Data

  • Main Window -> Table -> DATA

  • Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming

  • http://sapr3.tripod.com

TABLES: MKPF.

DATA: FM_NAME TYPE RS38L_FNAM.

DATA: BEGIN OF INT_MKPF OCCURS 0.

INCLUDE STRUCTURE MKPF.

DATA: END OF INT_MKPF.

SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.

SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.

MOVE-CORRESPONDING MKPF TO INT_MKPF.

APPEND INT_MKPF.

ENDSELECT.

  • At the end of your program.

  • Passing data to SMARTFORMS

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZSMARTFORM'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FM_NAME

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3.

if sy-subrc <> 0.

WRITE: / 'ERROR 1'.

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

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

endif.

call function FM_NAME

  • EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS =

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

TABLES

GS_MKPF = INT_MKPF

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.

check this:

http://help.sap.com/saphelp_nw04s/helpdata/en/a5/de6838abce021ae10000009b38f842/content.htm

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

http://www.sapbrain.com/TUTORIALS/TECHNICAL/SMARTFORMS_tutorial.html

check this linkls------>

https://www.sdn.sap.com/irj/sdn/collaboration

http://help.sap.com/saphelp_erp2004/helpdata/en/a9/de6838abce021ae10000009b38f842/frameset.htm

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

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

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

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

Reward points if useful

Regards

Anji

Former Member
0 Kudos

hi jyothsna,

Refer this link for Smartforms

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

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b590fd97-0301-0010-db90-d09ff93c...

Subroutine in smartform

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

Style and mailing the Smartform output

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

Table,Template,Loop and Command in Smartform

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

SAP Smartforms can be used for creating and maintaining forms for mass printing in SAP Systems. The output medium for Smartforms support printer, fax, e-mail, or the Internet (by using the generated XML output).

According to SAP, you need neither have any programming knowledge nor use a Script language to adapt standard forms. However, basic ABAP programming skills are required only in special cases (for example, to call a function module you created or for complex and extensive conditions).

1. Create a new smartforms

Transaction code SMARTFORMS

Create new smartforms call ZSMART

2. Define looping process for internal table

Pages and windows

First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)

Here, you can specify your title and page numbering

&SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)

Main windows -> TABLE -> DATA

In the Loop section, tick Internal table and fill in

ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2

3. Define table in smartforms

Global settings :

Form interface

Variable name Type assignment Reference type

ITAB1 TYPE Table Structure

Global definitions

Variable name Type assignment Reference type

ITAB2 TYPE Table Structure

4. To display the data in the form

Make used of the Table Painter and declare the Line Type in Tabstrips Table

e.g. HD_GEN for printing header details,

IT_GEN for printing data details.

You have to specify the Line Type in your Text elements in the Tabstrips Output options.

Tick the New Line and specify the Line Type for outputting the data.

Declare your output fields in Text elements

Tabstrips - Output Options

For different fonts use this Style : IDWTCERTSTYLE

For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&

5. Calling SMARTFORMS from your ABAP program

REPORT ZSMARTFORM.

  • Calling SMARTFORMS from your ABAP program.

  • Collecting all the table data in your program, and pass once to SMARTFORMS

  • SMARTFORMS

  • Declare your table type in :-

  • Global Settings -> Form Interface

  • Global Definintions -> Global Data

  • Main Window -> Table -> DATA

*

*

TABLES: MKPF.

DATA: FM_NAME TYPE RS38L_FNAM.

DATA: BEGIN OF INT_MKPF OCCURS 0.

INCLUDE STRUCTURE MKPF.

DATA: END OF INT_MKPF.

SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.

SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.

MOVE-CORRESPONDING MKPF TO INT_MKPF.

APPEND INT_MKPF.

ENDSELECT.

  • At the end of your program.

  • Passing data to SMARTFORMS

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZSMARTFORM'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FM_NAME

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3.

if sy-subrc <> 0.

WRITE: / 'ERROR 1'.

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

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

endif.

call function FM_NAME

  • EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS =

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

TABLES

GS_MKPF = INT_MKPF

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.

-


Additional Fonts for your SMARTFORMS

You can create additional fonts and style with transaction SMARTSTYLES

This can then be define in the paragraph and character formats, which you can then be assign to texts and fields in the Smart Form.

The character formats includes effects such as superscript, subscript, barcode and font attributes.

Regards,

Jayant

Former Member
0 Kudos

Hi,

Examples in the sense....Actually in some companies they will create a sales report with some additions in the standard one...

In SAP script we can use logos and we can include windows and pages as we want and SMARTFORMS is the advanced version of the sapscript where not much coding id needed....

In my company i have to create a new gate pass form,So i have gone for SMARTFORMS...

Try to reward it please if this is useful yar...

Former Member
0 Kudos

Hi Jyothsna,

Check these links.

SCRIPTS..

Check this link which will have sample program

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

Check few more links on Scripts

http://www.henrikfrank.dk/abapuk.html

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...

http://sappoint.com/abap/

http://www.sap-img.com/sapscripts.htm

http://sappoint.com/abap/

http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm

http://help.sap.com/saphelp_crm40/helpdata/en/16/c832857cc111d686e0000086568e5f/content.htm

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

http://www.sap-img.com/sapscripts.htm

http://searchsap.techtarget.com/tip/1,289483,sid21_gci943419,00.html

http://sap.ittoolbox.com/topics/t.asp?t=303&p=452&h2=452&h1=303

http://www.sapgenie.com/phpBB2/viewtopic.php?t=14007&sid=09eec5147a0dbeee1b5edd21af8ebc6a

Other Links

http://www.virtuosollc.com/PDF/Get_Reporter.pdf

http://help.sap.com/saphelp_47x200/helpdata/en/da/6ada3889432f48e10000000a114084/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/66/bc7d2543c211d182b30000e829fbfe/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/5b/d22cee43c611d182b30000e829fbfe/frameset.htm

http://www.virtuosollc.com/PDF/Get_Reporter.pdf

http://help.sap.com/saphelp_47x200/helpdata/en/da/6ada3889432f48e10000000a114084/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/66/bc7d2543c211d182b30000e829fbfe/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/5b/d22cee43c611d182b30000e829fbfe/frameset.htm

SMARTFORMS

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCRSF/BCSRVSCRSF.pdf

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

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

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

http://help.sap.com/saphelp_46c/helpdata/en/a5/de6838abce021ae10000009b38f842/frameset.htm

http://help.sap.com/printdocu/core/Print46c/en/Data/htm/english.htm

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

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

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

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

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

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.sapgenie.com/abap/smartforms_detail.htm

/message/635740#635740 [original link is broken]

http://www.saptechnical.com/Tips/ABAP/SmartFormAdvantages.htm

All Links

SF Books :

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

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

Hope this resolves your query.

<b>Reward all the helpful answers.</b>

Regards

Former Member
0 Kudos

hi jyothsna,

i have given below a simple example

this is the report program,

&----


*& Report ZSCRIPT1 *

*& *

&----


*& *

*& *

&----


REPORT ZSCRIPT1 .

TABLES : EKKO,

EKPO,

KNA1,

USR01,

MARA,

MAKT.

DATA : BEGIN OF ZOPTION.

INCLUDE STRUCTURE ITCPO.

DATA : END OF ZOPTION.

PARAMETERS: P_EBELN LIKE EKKO-EBELN,

P_EBELP LIKE EKPO-EBELP.

CLEAR EKPO.

SELECT SINGLE * FROM EKPO

WHERE EBELN = P_EBELN AND

EBELP = P_EBELP.

CLEAR KNA1.

SELECT SINGLE NAME1 FROM KNA1

INTO KNA1-NAME1

WHERE KUNNR = EKPO-KUNNR.

CLEAR MAKT.

SELECT SINGLE MAKTX FROM MAKT

INTO MAKT-MAKTX

WHERE MATNR = EKPO-MATNR AND

SPRAS = SY-LANGU.

CLEAR USR01.

SELECT SINGLE * FROM USR01 WHERE BNAME = SY-UNAME.

ZOPTION-TDDEST = USR01-SPLD. "Output device (printer)

ZOPTION-TDIMMED = 'X'. "Print immediately

ZOPTION-TDDELETE = 'X'. "Delete after printing

ZOPTION-TDPROGRAM = 'ZPQRPRNT'. "Program Name

CALL FUNCTION 'OPEN_FORM'

EXPORTING

APPLICATION = 'TX'

  • ARCHIVE_INDEX = ' '

  • ARCHIVE_PARAMS = ' '

DEVICE = 'PRINTER'

DIALOG = ' '

FORM = 'ZFORM1'

LANGUAGE = SY-LANGU

OPTIONS = ZOPTION

IMPORTING

LANGUAGE = SY-LANGU

EXCEPTIONS

OTHERS = 1.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'HEADER'

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

WINDOW = 'HEADER'

EXCEPTIONS

ELEMENT = 1.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'MAIN'

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

WINDOW = 'MAIN'

EXCEPTIONS

ELEMENT = 1.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'FOOTER'

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

WINDOW = 'FOOTER'

EXCEPTIONS

ELEMENT = 1.

CALL FUNCTION 'CLOSE_FORM'

EXCEPTIONS

UNOPENED = 1

OTHERS = 2.

This is the layout Set

Layout set Z_TESTSCRIPT

Description Test SAP script

Standard attributes

First page FIRST

Default paragraph P1

Tab-stop 1.00 CH

Page format DINA4

Orientation Landscape

Lines/inch 6.00

Characters/inch 10.00

Font attributes

Font family COURIER

Font size 12.0 Point

Bold No

Italic No

Underlined No

Characters Attributes

B Character String Bold

Standard attributes

Marker No

Font attributes

Bold Yes

Paragraphs Attributes

P1 Default Paragraph

Standard attributes

Line spacing 1.00 LN

Left margin 1.00 CM

Alignment Left-aligned

Font attributes

Font family TIMES

Font size 12.0 Point

P2 Header Paragraph

Standard attributes

Line spacing 1.00 LN

Left margin 4.50 CM

Alignment Left-aligned

Font attributes

Font family TIMES

Font size 18.0 Point

Bold Yes

P3 Undelined paragraph

Standard attributes

Line spacing 1.00 LN

Alignment Left-aligned

Font attributes

Font family TIMES

Font size 12.0 Point

Underlined Yes

Windows Attributes

MAIN Main window

Window type MAIN

HEADER Main window

Window type CONSTANT

FOOTER Main window

Window type CONSTANT

Pages Attributes

FIRST First Page

Standard attributes

Next page FIRST

Page counter

Mode START

Numbering type Arabic numerals

Page window

HEADER Left margin 00.00 CM

Upper margin 00.00 CM

Window width 20.00 CM

Window height 04.00 CM

MAIN Left margin 00.00 CM

Upper margin 05.00 CM

Window width 20.00 CM

Window height 20.00 CM

FOOTER Left margin 00.00 CM

Upper margin 25.00 CM

Window width 20.00 CM

Window height 04.00 CM

Text elements for following windows:

HEADER

Element HEADER

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

/: BOX XPOS 1 CM YPOS 1 CM WIDTH 18 CM HEIGHT 1 CM FRAME 10 TW INTENSITY 10

/

/

/

P2 ,,<B>TEST PURCHASE ORDER</>

/

/

MAIN

Element MAIN

P1 <B>Customer/Supplier:</>,,&KNA1-NAME1&

/

P1 <B>PO No:</>,,&EKPO-EBELN&

/

P1 <B>Part No:</>,,&MAKT-MATNR&

/

P1 <B>Description:</>,,&MAKT-MAKTX&

/

P1 <B>Quantity:,,</>&EKPO-MENGE&

/

P1 <B>Sign:</>&uline(81)&

/

P1 <B>Date:</>&EKKO-AEDAT&

FOOTER

Element FOOTER

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

/: BOX XPOS 1 CM YPOS 1 CM WIDTH 18 CM HEIGHT 1 CM FRAME 10 TW INTENSITY 10

/

/

/

P2 ,,<B>PLEASE SIGN THE PO BEFORE DISPATCH</>

/

/

<b>reward if useful :)</b>

former_member208856
Active Contributor
0 Kudos

Hi,

You can take help from these programs for smartforms in R/3 system :

Tcode SE38 (For ABAP Program) and Smartforms (For Design Smartform)

SF_EXAMPLE_01

SF_EXAMPLE_02

SF_EXAMPLE_03

Regards,

Sandeep Kaushik

Former Member
0 Kudos
*&---------------------------------------------------------------------*
*& Report  ZSCRIPT1                                                    *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  ZSCRIPT1                                .
TABLES : EKKO,
         EKPO,
         KNA1,
         USR01,
         MARA,
         MAKT.

DATA : BEGIN OF ZOPTION.
        INCLUDE STRUCTURE ITCPO.
DATA : END OF ZOPTION.

PARAMETERS: P_EBELN LIKE EKKO-EBELN,
            P_EBELP LIKE EKPO-EBELP.

CLEAR EKPO.
SELECT SINGLE * FROM EKPO
       WHERE EBELN = P_EBELN AND
             EBELP = P_EBELP.

CLEAR KNA1.
SELECT SINGLE NAME1 FROM KNA1
              INTO KNA1-NAME1
              WHERE KUNNR = EKPO-KUNNR.

CLEAR MAKT.
SELECT SINGLE MAKTX FROM MAKT
              INTO MAKT-MAKTX
              WHERE MATNR = EKPO-MATNR AND
                    SPRAS = SY-LANGU.

CLEAR USR01.
SELECT SINGLE * FROM USR01 WHERE BNAME = SY-UNAME.

ZOPTION-TDDEST    = USR01-SPLD.        "Output device (printer)
ZOPTION-TDIMMED   = 'X'.               "Print immediately
ZOPTION-TDDELETE  = 'X'.               "Delete after printing
ZOPTION-TDPROGRAM = 'ZPQRPRNT'.        "Program Name

CALL FUNCTION 'OPEN_FORM'
     EXPORTING
         APPLICATION        = 'TX'
*         ARCHIVE_INDEX      = ' '
*         ARCHIVE_PARAMS     = ' '
         DEVICE             = 'PRINTER'
         DIALOG             = ' '
         FORM               = 'ZFORM1'
         LANGUAGE           = SY-LANGU
         OPTIONS            = ZOPTION
     IMPORTING
          LANGUAGE           = SY-LANGU
       EXCEPTIONS
         OTHERS     = 1.

CALL FUNCTION 'WRITE_FORM'
     EXPORTING
         ELEMENT       = 'HEADER'
*         FUNCTION      = 'SET'
*         TYPE          = 'BODY'
         WINDOW        = 'HEADER'
     EXCEPTIONS
          ELEMENT       = 1.

CALL FUNCTION 'WRITE_FORM'
     EXPORTING
         ELEMENT       = 'MAIN'
*         FUNCTION      = 'SET'
*         TYPE          = 'BODY'
         WINDOW        = 'MAIN'
     EXCEPTIONS
          ELEMENT       = 1.

CALL FUNCTION 'WRITE_FORM'
     EXPORTING
         ELEMENT       = 'FOOTER'
*         FUNCTION      = 'SET'
*         TYPE          = 'BODY'
         WINDOW        = 'FOOTER'
     EXCEPTIONS
          ELEMENT       = 1.

CALL FUNCTION 'CLOSE_FORM'
     EXCEPTIONS
          UNOPENED = 1
          OTHERS   = 2.

Layout set           Z_TESTSCRIPT
Description          Test SAP script

Standard attributes
  First page          FIRST
  Default paragraph   P1
  Tab-stop            1.00 CH
  Page format         DINA4
  Orientation         Landscape
  Lines/inch            6.00
  Characters/inch      10.00

Font attributes
  Font family         COURIER
  Font size           12.0 Point
  Bold                No
  Italic              No
  Underlined          No

Characters    Attributes
  B           Character String Bold
              Standard attributes
              Marker            No
              Font attributes
              Bold              Yes

Paragraphs    Attributes
  P1          Default Paragraph
              Standard attributes
              Line spacing      1.00 LN
              Left margin       1.00 CM
              Alignment         Left-aligned
              Font attributes
              Font family       TIMES
              Font size         12.0 Point

  P2          Header Paragraph
              Standard attributes
              Line spacing      1.00 LN
              Left margin       4.50 CM
              Alignment         Left-aligned
              Font attributes
              Font family       TIMES
              Font size         18.0 Point
              Bold              Yes

  P3          Undelined paragraph
              Standard attributes
              Line spacing      1.00 LN
              Alignment         Left-aligned
              Font attributes
              Font family       TIMES
              Font size         12.0 Point
              Underlined        Yes

Windows       Attributes
  MAIN        Main window
              Window type       MAIN
  HEADER      Main window
              Window type       CONSTANT
  FOOTER      Main window
              Window type       CONSTANT

Pages         Attributes
  FIRST       First Page
              Standard attributes
              Next page         FIRST
              Page counter
              Mode              START
              Numbering type    Arabic numerals
              Page window
              HEADER               Left margin          00.00 CM
                                   Upper margin         00.00 CM
                                   Window width         20.00 CM
                                   Window height        04.00 CM
              MAIN                 Left margin          00.00 CM
                                   Upper margin         05.00 CM
                                   Window width         20.00 CM
                                   Window height        20.00 CM
              FOOTER               Left margin          00.00 CM
                                   Upper margin         25.00 CM
                                   Window width         20.00 CM
                                   Window height        04.00 CM

Text elements for following windows:
HEADER

Element HEADER
/: POSITION XORIGIN 2 CM YORIGIN '-0.5 CM'
/: BOX XPOS 1 CM YPOS 1 CM WIDTH 18 CM HEIGHT 1 CM FRAME 10 TW INTENSITY 10
/
/
/
P2     ,,<B>TEST PURCHASE ORDER</>
/
/

MAIN

Element MAIN
P1  <B>Customer/Supplier:</>,,&KNA1-NAME1&
/
P1  <B>PO No:</>,,&EKPO-EBELN&
/
P1  <B>Part No:</>,,&MAKT-MATNR&
/
P1  <B>Description:</>,,&MAKT-MAKTX&
/
P1  <B>Quantity:,,</>&EKPO-MENGE&
/
P1  <B>Sign:</>&uline(81)&
/
P1  <B>Date:</>&EKKO-AEDAT&

FOOTER

Element FOOTER
/: POSITION XORIGIN 2 CM YORIGIN '-0.5 CM'
/: BOX XPOS 1 CM YPOS 1 CM WIDTH 18 CM HEIGHT 1 CM FRAME 10 TW INTENSITY 10
/
/
/
P2     ,,<B>PLEASE SIGN THE PO BEFORE DISPATCH</>
/
/