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

smartforms

Former Member
0 Likes
456

i need information about how to pass internal table to smartfroms from main program?

regards,

tony

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
429

Transaction code SMARTFORMS

Create new smartforms call ZSMART

The followings screen format will appear :-

- Form ZSMART Form ZSMART

- Global settings Description New form

- Form attributes

- Form interface

- Global definitions General attributes Output Options

- Pages and windows

+ %PAGE1 New page

-


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

-


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

-


To display the data in Smartform

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)&

-


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.

-


To branch to a new page in Smart forms

The page to which you want to branch must exist. You can branch to a new page only as long as you are still displaying the contents of a main window.

Choose Create -> Command in the context menu to create a command node in the main window of the page.

On the General Attributes tab strips Tick Go to new page. Determine the new page using the list box next to the checkbox (it can be the same page if you want).

The output of the main window will continues on the new page.

-


Line in SMARTFORM

HOW TO GET "THICK-LINE"(HORIZANTAL) IN SMARTFORM.

Answers : Subject : Line in SMARTFORM

Hi.

Either you can use a window that takes up the width of your page and only has a hight if 1 mm.

then you put a frame around it (in window output options).

Thus you have drawn a box but it looks like a line.

Or you can just draw "__" accross the page and play with the fonts so that it joins each

UNDER_SCORE. -


Difference between form interface and global definitions

The Difference is as follows.

to put it very simply:

Form Interface is where you declare what must be passed in and out of the smartform (in from the

print program to the smartform and out from the smartform to the print program).

Global defs. is where you declare data to be used within the smartform on a global scope.

ie: anything you declare here can be used in any other node in the form. -


Here is code i use to determine the internal name of the function module:

Code:

if sf_label(1) <> '/'. " need to resolve by name

move sf_label to externalname.

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = externalname

importing

fm_name = internalname

exceptions

no_form = 1

no_function_module = 2

others = 3.

if sy-subrc <> 0.

message 'e427'.

endif.

move internalname to sf_label.

endif.

it checks to see if the sf_label starts with a '/', which is how the internal names start. if it does, the

name has already been converted. If not, it calls the FM and converts the name.

you would then CALL FUNCTION sf_label. -


Inserting Logo in SmartForm

Follow the given steps in order to add a logo,

1) In Smart Forms Editor, In left pane, right Click any Page (say Page1) and select Create -> Window, Give it a name and Description (Say Window1)

2) Right Click on Window (Window 1) and select Create -> Graphics, Give it a name and description

3) In general Attributes, Select Name, get search help (F4) , you will find a list of pictures

4) Select any picture and set its Resolution in DPI

5) Press F9 to open Smart Forms Builder, Select window (Window1) and In Output options window set, size and position of the Logo

6) Set any other parameters if required, save and activate.

7) If there is only 1 Window in the forms, set it as Main Window in general attributes.

😎 User TCode SE78 to upload new pictures and logos.

-


Flow chart---- Menuexit---from chart

it will only be ended with oval circular.

square

3 REPLIES 3
Read only

Former Member
0 Likes
430

Transaction code SMARTFORMS

Create new smartforms call ZSMART

The followings screen format will appear :-

- Form ZSMART Form ZSMART

- Global settings Description New form

- Form attributes

- Form interface

- Global definitions General attributes Output Options

- Pages and windows

+ %PAGE1 New page

-


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

-


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

-


To display the data in Smartform

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)&

-


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.

-


To branch to a new page in Smart forms

The page to which you want to branch must exist. You can branch to a new page only as long as you are still displaying the contents of a main window.

Choose Create -> Command in the context menu to create a command node in the main window of the page.

On the General Attributes tab strips Tick Go to new page. Determine the new page using the list box next to the checkbox (it can be the same page if you want).

The output of the main window will continues on the new page.

-


Line in SMARTFORM

HOW TO GET "THICK-LINE"(HORIZANTAL) IN SMARTFORM.

Answers : Subject : Line in SMARTFORM

Hi.

Either you can use a window that takes up the width of your page and only has a hight if 1 mm.

then you put a frame around it (in window output options).

Thus you have drawn a box but it looks like a line.

Or you can just draw "__" accross the page and play with the fonts so that it joins each

UNDER_SCORE. -


Difference between form interface and global definitions

The Difference is as follows.

to put it very simply:

Form Interface is where you declare what must be passed in and out of the smartform (in from the

print program to the smartform and out from the smartform to the print program).

Global defs. is where you declare data to be used within the smartform on a global scope.

ie: anything you declare here can be used in any other node in the form. -


Here is code i use to determine the internal name of the function module:

Code:

if sf_label(1) <> '/'. " need to resolve by name

move sf_label to externalname.

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = externalname

importing

fm_name = internalname

exceptions

no_form = 1

no_function_module = 2

others = 3.

if sy-subrc <> 0.

message 'e427'.

endif.

move internalname to sf_label.

endif.

it checks to see if the sf_label starts with a '/', which is how the internal names start. if it does, the

name has already been converted. If not, it calls the FM and converts the name.

you would then CALL FUNCTION sf_label. -


Inserting Logo in SmartForm

Follow the given steps in order to add a logo,

1) In Smart Forms Editor, In left pane, right Click any Page (say Page1) and select Create -> Window, Give it a name and Description (Say Window1)

2) Right Click on Window (Window 1) and select Create -> Graphics, Give it a name and description

3) In general Attributes, Select Name, get search help (F4) , you will find a list of pictures

4) Select any picture and set its Resolution in DPI

5) Press F9 to open Smart Forms Builder, Select window (Window1) and In Output options window set, size and position of the Logo

6) Set any other parameters if required, save and activate.

7) If there is only 1 Window in the forms, set it as Main Window in general attributes.

😎 User TCode SE78 to upload new pictures and logos.

-


Flow chart---- Menuexit---from chart

it will only be ended with oval circular.

square

Read only

varma_narayana
Active Contributor
0 Likes
429

Hi...

In the Smart form:

Global definition->data types Tab (Create the Data type)

TYPES: BEGIN OF ST_EKPO,

EBELN TYPE EKPO-EBELN,

EBELP TYPE EKPO-EBELP,

MATNR TYPE EKPO-MATNR,

END OF ST_EKPO.

Form interface -> Tables Tab (declare the Internal table parameter)

IT_EKPO TYPE ST_EKPO.

In the Main window :

Create a TABLE node to Display internal table....

In the Print Program also declare the Itab the same way...

<b>Reward if Helpful</b>

Read only

Former Member
0 Likes
429

Hi,

You use "SSF_FUNCTION_MODULE_NAME" function module.

DATA: FM_NAME TYPE RS38L_FNAM.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZTRAIN_E0232' " SMART FORM NAME.

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

EXPORTING

RESERVATION_NO = RESERVATION_NO

TABLES

ITAB = ITAB_ITEM.

ITAB_ITEM -Internal table you used in smartforms.

ITAB- Internal table you used in program.

FM_NAME:

************

This is one kind of function module.

IF USEFULL REWARD