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

Smartform Print program

Former Member
0 Likes
858

Hi All!

I coded one custom print program and in it i called the FM SSF_FUNCTION_MODULE_NAME and in it I gave the import and export parameters.In export parameters i gave the smartform name under formname.In the importing parameters i gave g_fmname(which i declared as of type (G_FMNAME TYPE RS38L_FNAM).Now how to dynamically call the FM of my form.Please advise.

Any sample programs please..

regards

Praneeth

Message was edited by: Praneeth kumar

1 ACCEPTED SOLUTION
Read only

vinod_gunaware2
Active Contributor
0 Likes
828

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

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.

regards

vinod

7 REPLIES 7
Read only

vinod_gunaware2
Active Contributor
0 Likes
829

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

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.

regards

vinod

Read only

Former Member
0 Likes
828

Hi Praneeth,

Just user: CALL FUNCTION g_fmname with the parameters you have defined in your smartform and the usual parameters (or take a look at e.g. RLB_INVOICE):

archive_index

archive_parameters

control_parameters

mail_appl_obj

mail_recipient

mail_sender

output_options

user_settings

Regards,

John.

Read only

FredericGirod
Active Contributor
0 Likes
828

Hi,

please have a look to the program SF_EXAMPLE_01 ...

Rgd

Frédéric

Read only

Former Member
0 Likes
828

Hi praneeth,

1. call like this.

(all smart form function names should be called

like this,

(only the TABLES parameter will get changed)

2. (also see in se37 the function name)

ATA : funcname type rs38l_fnam.

funcname = '/1BCDWB/SF00000100'.

CALL FUNCTION funcname

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS =

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT = 'mamit'

  • MAIL_SENDER =

output_options = output_options

  • USER_SETTINGS = space

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

job_output_info = output_data

  • JOB_OUTPUT_OPTIONS =

TABLES

p9002 = p9002

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5

.

regards,

amit m.

Read only

Former Member
0 Likes
828

data:fname type RS38L_FNAM.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'Z_SMARTFORM'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = fname

  • 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 FNAME

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

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

Read only

Former Member
0 Likes
828

Hi

I think the best way is to use the fm generated by smartform.

So go to trx SMARTFORMS and insert your smartform, push the button for the test: now you'll be in trx SE37.

Here copy the name of fm.

Go to SE38 and open your print program, here press button PATTERN and download the fm you'have copied.

Now in your abap code:

CALL FUNCTION '/1BCDWB/SF00000001'

...........

After replace the name of fm with your variable:

CALL FUNCTION G_FMNAME

...........

Max

Read only

reedtzj
Active Participant
0 Likes
828

Hi,

A good way is to search for "Smartforms" under area "SDN code Samples" (see search fields in SDN upper left corner). You will get many, many hits here.

One introductory description might be this one (see page 7 for dynamic calling om Smartform FM):

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d937ec90-0201-0010-0ca8-b6cb3b6dd1ef">Tutorial with Code Sample on Smart Forms.pdf</a>

Regards, Johan