cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform through fax

Former Member
0 Kudos

HI All.

I have an urgent requirement in smartform sending through fax for each customer ie sales order confirmation. Can any one help me by giving the proper piece of code where i can get exactly to pass the parameters to the fax options . Please provide the code and get rewards.Expecting the solution from all.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

amit_khare
Active Contributor
0 Kudos

Hi,

Get OTF output of the form .

When calling Smartform, pass to parameters

Exporting

control_params-getotf = 'X'.

IMPORTING

job_output_info = structoutput

OTF data is in structoutput-otfdata

Use this FM to the rest

CONVERT_OTF_AND_FAX

Check this link too -

<a href="http://www.sap-img.com/abap/sending-fax-from-abap.htm">http://www.sap-img.com/abap/sending-fax-from-abap.htm</a>

Regards,

Amit

Reward all helpful replies.

Former Member
0 Kudos

Thanks for the piece of code but mainly concern what parameters i need to pass to the particular function module convert_otf_fax . Please help me by providing the exact code.

Thanks

former_member181962
Active Contributor
0 Kudos

See this sample usage:

user = sy-uname.

param-tdteleland = '<Country Code>'.

param-tdtelenum = <Fax number with hyphens>.

param-tdcover = ' '.

CALL FUNCTION 'CONVERT_OTF_AND_FAX'

EXPORTING

faxoptions = param

user = user

IMPORTING

fax_ok = ok

office_objid = off_obj

msgid = msgid

msgno = msgno

msgv1 = msgv1

msgv2 = msgv2

msgv3 = msgv3

msgv4 = msgv4

TABLES

otf = otf_data. "otf data should be the table that you get from the smartform function module

Former Member
0 Kudos

Hi,

Can you provide your contact number or personal id so that i can get back you on this asap.

Thanks

Former Member
0 Kudos

Hi Satheesh,

Have you been able to FAX a smartform? I need to do the same, if you could please let me know on anmolpuri12@gmail.com

Anmol

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,,

add trhis code in the print program

for ur understanding im sending the routine where u can include ur code

----


  • INCLUDE ZMPUIF010_FM06PE02

----


FORM entry_neu USING ent_retco TYPE any

ent_screen TYPE any.

DATA: cf_retcode TYPE sy-subrc.

  • local table declaration

DATA: l_druvo LIKE t166k-druvo,

l_nast LIKE nast,

l_from_memory,

l_doc TYPE meein_purchase_doc_print.

  • Local structures

DATA:ls_control_param TYPE ssfctrlop, "Control paramters

ls_output_options TYPE ssfcompop, "Output options

ls_recipient_id TYPE swotobjid, "Structure for recvr obj ID

ls_sender_id TYPE swotobjid. "Structure for sender obj id

  • Local varialbles

DATA: lv_lifnr TYPE lfa1-lifnr.

DATA : lv_fax_tp TYPE so_escape VALUE 'F'.

  • Constants:

CONSTANTS:lc_fax TYPE tddevice VALUE 'TELEFAX'. "FAX device

  • Status of message flag.

CLEAR ent_retco.

IF nast-aende EQ space.

l_druvo = '1'.

ELSE.

l_druvo = '2'.

ENDIF.

CLEAR lv_lifnr.

  • Select the po number

SELECT lifnr

FROM ekko

INTO lv_lifnr

UP TO 1 ROWS

WHERE ebeln = nast-objky(10).

ENDSELECT.

  • Select the country key and fax number.

SELECT SINGLE land1

telfx

FROM lfa1

INTO (gv_land1 ,

gv_telfx)

WHERE lifnr = lv_lifnr.

  • Reading the NAST and DOC structures

CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'

EXPORTING

ix_nast = nast

ix_screen = ent_screen

IMPORTING

ex_retco = ent_retco

ex_nast = l_nast

doc = l_doc

CHANGING

cx_druvo = l_druvo

cx_from_memory = l_from_memory.

CHECK ent_retco EQ 0.

  • SmartForm from customizing table TNAPR

gv_formname = tnapr-sform.

  • Calling the layout set

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = gv_formname

IMPORTING

fm_name = gv_fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

IF sy-subrc <> 0.

PERFORM protocol_update.

ENDIF.

  • For Print output:

IF nast-nacha = '1'. " Print output

ls_control_param-preview = 'X'.

ls_control_param-no_dialog = 'X'.

ENDIF.

  • For fax output.

IF nast-nacha = '2'. " Fax

  • Create the Recipient Object

CALL FUNCTION 'CREATE_RECIPIENT_OBJ_PPF'

EXPORTING

ip_country = gv_land1

ip_faxno = gv_telfx

ip_type_id = lv_fax_tp

IMPORTING

ep_recipient_id = ls_recipient_id

EXCEPTIONS

invalid_recipient = 1

OTHERS = 2.

IF sy-subrc NE 0.

  • IF write_out = 'X'.

FORMAT COLOR 6.

WRITE AT /5 text-004.

  • ENDIF.

RAISE other.

ENDIF.

  • Create The Sender Object

CALL FUNCTION 'CREATE_SENDER_OBJECT_PPF'

EXPORTING

ip_sender = sy-uname

IMPORTING

ep_sender_id = ls_sender_id

EXCEPTIONS

invalid_sender = 1

OTHERS = 2.

IF sy-subrc NE 0.

  • IF write_out = 'X'.

FORMAT COLOR 6.

WRITE AT /5 text-003.

  • ENDIF.

RAISE other.

ENDIF.

  • Output options

ls_output_options-tdteleland = gv_land1.

ls_output_options-tdtelenum = gv_telfx.

ls_output_options-tdfaxuser = sy-uname.

  • Control parameters

ls_control_param-device = lc_fax.

  • ls_control_param-no_dialog = 'X'.

  • ls_control_param-langu = nast-tdspras.

ENDIF.

IF gv_fm_name IS NOT INITIAL.

  • Below function module is used to show the Smart form

CALL FUNCTION gv_fm_name

EXPORTING

is_nast = l_nast

doc = l_doc

control_parameters = ls_control_param

output_options = ls_output_options

user_settings = ' '

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • Error handling

cf_retcode = sy-subrc.

PERFORM protocol_update.

ELSE.

ENDIF.

ENDIF.

ENDFORM. "entry_neu