cancel
Showing results for 
Search instead for 
Did you mean: 

Need understanding of Function 'Convert OTF'

Former Member
0 Kudos

Hello,

Can any one please help me to get step by step explanation (not technical) about how smart form is converted to pdf and sent as attachment to mail? I need explanation of line by line code, so as to understand what is actually going on.

Thank You.

In hope to get a reply..

Regards,

lina.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

DATA: objcont LIKE solisti1 OCCURS 5 WITH HEADER LINE.

" Document Content

DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.

*----23.03.2007

data: ist_exempted type table of ty_exempted,

wa_exempted type ty_exempted.

*----23.03.2007

" Document recipients with send attributes

DATA: doc_chng LIKE sodocchgi1. " Attributes of new document

DATA: entries LIKE sy-tabix.

" To find number of lines in Document Content

DATA: v_ctrlparams TYPE ssfctrlop, "TO FOR CONTROLLING PARAMETERS

v_joboutput TYPE ssfcrescl, "TO GET OUTPUT DATA

v_func_mod TYPE rs38l_fnam. "TYPE FOR FM

DATA: wa_otfdata LIKE itcoo.

DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.

DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.

DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.

DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.

DATA: tab_lines LIKE sy-tabix.

v_ctrlparams-no_dialog = 'X'.

v_ctrlparams-getotf = 'X'.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'YCP_MANPOWER_MAIL_NONSIGNER'

IMPORTING

fm_name = v_func_mod.

CALL FUNCTION v_func_mod

EXPORTING

control_parameters = v_ctrlparams

IMPORTING

job_output_info = v_joboutput

TABLES

t_nonsigner = t_nonsigner.

  • fill the document

doc_chng-obj_name = 'MPS Pending'.

  • Fill the subject line

*-----23.03.2007 replaced

  • doc_chng-obj_descr = 'Manpower Sign-off pending'.

*-----23.03.2007

doc_chng-obj_descr = 'Reminder – MP Signoff'.

doc_chng-sensitivty = 'P'.

  • Fill the content of the mail

objcont = 'Dear all,'.

APPEND objcont.

CLEAR objcont.

APPEND objcont.

CLEAR objcont.

objcont =

'The manpower sign-off is pending for the list of employees as per th' &

'e attached sheet.'

.

APPEND objcont.

CLEAR objcont.

APPEND objcont.

CLEAR objcont.

objcont =

'Please click on the following link for the manpower sign-off:'.

APPEND objcont.

CLEAR objcont.

APPEND objcont.

CLEAR objcont.

DESCRIBE TABLE objcont LINES entries.

READ TABLE objcont INDEX entries.

doc_chng-doc_size = ( entries - 1 ) * 255 + STRLEN( objcont ).

  • Creating the entry for the compressed document

CLEAR objpack-transf_bin.

objpack-head_start = 1.

objpack-head_num = 0.

objpack-body_start = 1.

objpack-body_num = entries.

objpack-doc_type = 'RAW'.

APPEND objpack.

  • Creating the document attachment

  • (Assume the data in OBJBIN are given in BMP format)

LOOP AT v_joboutput-otfdata INTO wa_otfdata.

APPEND wa_otfdata TO objbin.

CLEAR wa_otfdata.

ENDLOOP.

DESCRIBE TABLE objbin LINES tab_lines.

objhead = 'NonSignerDetails.otf'. APPEND objhead.

  • Creating the entry for the compressed attachment

objpack-transf_bin = 'X'.

objpack-head_start = 1.

objpack-head_num = 1.

objpack-body_start = 1.

objpack-body_num = tab_lines.

objpack-doc_type = 'OTF'.

objpack-obj_name = 'ATTACHMENT'.

objpack-obj_descr = 'NonSignerDetails'.

objpack-doc_size = tab_lines * 255.

APPEND objpack.

  • Sending the document

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = doc_chng

put_in_outbox = 'X'

commit_work = 'X'

TABLES

packing_list = objpack

object_header = objhead

contents_bin = objbin

contents_txt = objcont

receivers = reclist

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

operation_no_authorization = 4

OTHERS = 99.

CASE sy-subrc.

WHEN 0.

WRITE: / 'Manpower Sign-off pending Mail: succesfully sent.'.

WHEN 1.

WRITE: / 'no authorization to send to the specified number of'.

"'recipients!'.

WHEN 2.

WRITE: / 'document could not be sent to any of the recipients!'.

WHEN 4.

WRITE: / 'no authorization to send !'.

WHEN OTHERS.

WRITE: / 'error occurred during sending !'.

ENDCASE.

regards,

Santosh Thorat

Former Member
0 Kudos

Thank you santosh.

Answers (2)

Answers (2)

Former Member
0 Kudos

QUESTION NOT RESOLVED BUT CLOSED.

former_member196280
Active Contributor
0 Kudos

Follow this link, it will guide you stepwise.

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/49e15474-0e01-0010-9cba-e62df8244556">Sample</a>

Close the thread once your question is answered.

Regards,

SaiRam

Former Member
0 Kudos

Hello Sai Ram, thank you for your reply, but i am looking for english explanation like "why''.

Thanks,

Regards,

Lina