Option sends Purchase Order through mail
Dear All,
My client wants Option sends Purchase Order through mail.
Please tell me what the process for above scenario is.
Thanks in advance,
Nagi Reddy
Hi,
For sending PO via mail, first check if output determintation in properly set in customization settings. Also If you are using customized program for printing, check if code is maintained in program for sending ouput via mails.
If all is maintained in customizing, in PO select output medium as "Mail" and take print. This can also done by using condition records in MN04. Then try sending the output via mail.
Thanks
Alex
Similar Messages
-
How can I send purchase order through SAP mail ?
How can I send purchase order through SAP mail ? Can any one explain whts the NACE settings?
just do it as <b>Anji reddy</b> said to you ...or else ... in the purchase order trascation ...print it ... so that it will generate the spool request for that purchase order ....
so the the belwo program is for sending <b>the Spool Request data as Email to any Email id ...</b>
The code below demonstrates how to retrieve a spool request and email it as a PDF document. Please note for the below program to process a spool request the program must be executed in background otherwise no spool request will be created. Once you have had a look at this there is an modified version of the program which works in both background and foreground. Also see transaction SCOT for SAPConnect administration.
*& Report ZSPOOLTOPDF *
*& Converts spool request into PDF document and emails it to *
*& recipicant. *
*& Execution *
*& This program must be run as a background job in-order for the write *
*& commands to create a Spool request rather than be displayed on *
*& screen *
REPORT zspooltopdf.
PARAMETER: p_email1 LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_sender LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_delspl AS CHECKBOX.
*DATA DECLARATION
DATA: gd_recsize TYPE i.
* Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
* Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: w_recsize TYPE i.
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
* Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
* Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.
CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV',
c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL'.
*START-OF-SELECTION.
START-OF-SELECTION.
* Write statement to represent report output. Spool request is created
* if write statement is executed in background. This could also be an
* ALV grid which would be converted to PDF without any extra effort
WRITE 'Hello World'.
new-page.
commit work.
new-page print off.
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
*** Alternative way could be to submit another program and store spool
*** id into memory, will be stored in sy-spono.
*submit ZSPOOLTOPDF2
* to sap-spool
* spool parameters %_print
* archive parameters %_print
* without spool dynpro
* and return.
* Get spool id from program called above
* IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
if p_delspl EQ 'X'.
PERFORM delete_spool.
endif.
IF sy-sysid = c_dev.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool',
'request to be created.'.
ENDIF.
* FORM obtain_spool_id *
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM.
* FORM get_job_details *
FORM get_job_details.
* Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM.
* FORM convert_spool_to_pdf *
FORM convert_spool_to_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
* Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
* FORM process_email *
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
* perform send_email using p_email2.
ENDFORM.
* FORM send_email *
* --> p_email *
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
* Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachname'.
* CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
* If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
* Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
'Example .xls documnet attachment'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM.
* FORM delete_spool *
FORM delete_spool.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
ld_spool_nr = gd_spool_nr.
CHECK p_delspl <> c_no.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = ld_spool_nr.
ENDFORM.
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
* Send email
FORM send_file_as_email_attachment tables it_message
it_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
* Fill the document data.
w_doc_data-doc_size = 1.
* Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
* Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
* Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
* Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
* Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
* Populate zerror return code
ld_error = sy-subrc.
* Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
Girish -
Return receipt for the purchase order through mail
Hello Friends,
Can anybody tell me How to receive the return receipt for the purchase order through mail.What is the type of Inbound document? Is a Return receipt mail can post in to SAP. I have done for my company thro' Idoc after carefully considering many ways. PO only can be triggered to supplier thro' mail.I am not sure.
Cheers! -
Sending purchase order through e-mail
Hi,
I need to send purchase order in PDF through e-mail. I know it is possible to automatically have it sent to the vendor, but my requirement is different. PO is created as conversion of PREQ, so I need to send it not to vendor directly, but to the PREQ creator first (for possible corrections etc.) Is this somehow possible? I'm using exit EXIT_SAPMM06E_020 where I'd like to paste call to the function module (in update task), which would send the e-mail.
Thanks in advance.
TomasHi,
Use this program
*& Report YMSL_ORDER_ACCEPTANCE
REPORT YMSL_ORDER_ACCEPTANCE.
*********Variable Declarations *****************************
DATA: GV_FORM_NAME TYPE RS38L_FNAM, " Used to store the function module generated by Smartform
GV_BIN_FILESIZE TYPE I, " Store the file size
GV_POS TYPE I,
GV_LEN TYPE I,
GV_TAB_LINES TYPE I,
gv_desc_lines type i.
********Constants *******************************************
DATA : GC_TEXT(11) TYPE C VALUE 'Form Output',
GC_TST(3) TYPE C VALUE 'TST',
GC_TESTING(20) TYPE C VALUE 'Order Acceptance'.
*********Work Area Declarations *****************************
DATA: GS_DOCDATA TYPE SODOCCHGI1, " Data of an object which can be changed
GS_CTRLOP TYPE SSFCTRLOP, " Smart Forms: Control structure
GS_OUTOPT TYPE SSFCOMPOP, " SAP Smart Forms: Smart Composer (transfer) options
GS_OTFDATA TYPE SSFCRESCL, " Smart Forms: Return value at end of form printing
GS_RECLIST TYPE SOMLRECI1, " SAPoffice: Structure of the API Recipient List
GS_PDF_TAB TYPE TLINE, " Workarea for SAP Script Text Lines
GS_OBJBIN TYPE SOLISTI1, " SAPoffice: Single List with Column Length 255
GS_OBJPACK TYPE SOPCKLSTI1. " SAPoffice: Description of Imported Object Components
DATA : w_doc_chng typE sodocchgi1.
*********Internal tables Declarations *****************************
DATA : I_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
DATA: GT_RECLIST TYPE TABLE OF SOMLRECI1, " SAPoffice: Structure of the API Recipient List
GT_PDF_TAB TYPE TABLE OF TLINE, " SAPscript: Text Lines
GT_OTF TYPE TABLE OF ITCOO, " OTF Structure
GT_OBJBIN TYPE TABLE OF SOLISTI1, " SAPoffice: Single List with Column Length 255
GT_OBJPACK TYPE TABLE OF SOPCKLSTI1. " SAPoffice: Description of Imported Object Components
DATA : BEGIN OF IT_ADR6 OCCURS 0,
SMTP_ADDR TYPE ADR6-SMTP_ADDR,
END OF IT_ADR6.
DATA : W_FILE_NAME TYPE STRING,
W_FILE_PATH TYPE STRING,
W_FULL_PATH TYPE STRING.
CLEAR : GV_FORM_NAME,
GS_CTRLOP,
GS_OUTOPT,
GS_OTFDATA,
GV_BIN_FILESIZE,
GV_POS,
GV_LEN,
GV_TAB_LINES.
SELECTION-SCREEN: BEGIN OF SCREEN 1001 AS WINDOW TITLE scr_ttl .
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TXT_B1 NO INTERVALS.
SELECTION-SCREEN BEGIN OF LINE .
SELECTION-SCREEN COMMENT 1(15) TX_VBELN.
PARAMETER : P_VBELN TYPE VBAK-VBELN .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B1.
*SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TXT_B2 .
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: R_OUT RADIOBUTTON GROUP R1 DEFAULT 'X' USER-COMMAND RAD11 .
SELECTION-SCREEN COMMENT 5(20) TXT_OUT. " roles by t-code
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETER R_PDF RADIOBUTTON GROUP R1 .
SELECTION-SCREEN COMMENT 5(20) TXT_PDF.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETER R_MAIL RADIOBUTTON GROUP R1 .
SELECTION-SCREEN COMMENT 5(15) TXT_MAIL.
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 20(7) TXT_MAL1.
PARAMETER : P_MAIL TYPE ADR6-SMTP_ADDR MODIF ID M1 .
SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN END OF BLOCK B2.
SELECTION-SCREEN: END OF SCREEN 1001 .
CALL SELECTION-SCREEN 1001 STARTING AT 20 5 ENDING AT 105 10.
*SET PF-STATUS 'STATUS'.
INITIALIZATION.
TX_VBELN = 'Order'.
TXT_B1 = 'Selection Criteria '.
TXT_B2 = 'Output Criteria '.
scr_ttl = 'Order Acceptance'.
TXT_OUT = 'Print Output'.
TXT_PDF = 'Save To PDF'.
TXT_MAIL = 'Mail the Output'.
TXT_MAL1 = 'E-mail'.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF R_MAIL <> 'X'.
IF SCREEN-GROUP1 = 'M1'.
SCREEN-INVISIBLE = 1.
SCREEN-INPUT = 0. " Disable for input.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MAIL.
PERFORM TABLE_HELP.
START-OF-SELECTION..
IF P_VBELN IS NOT INITIAL.
PERFORM GET_SF.
IF R_PDF = 'X' .
PERFORM CONVERT_OTF.
PERFORM SAVE_DIALOG.
PERFORM DOWNLOAD.
ELSEIF R_MAIL = 'X'.
IF P_MAIL IS NOT INITIAL.
PERFORM CONVERT_OTF.
PERFORM SEND_MAIL.
ELSE.
MESSAGE 'Please Enter Email Address' TYPE 'S'.
CALL TRANSACTION 'YMSL20'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ELSE.
MESSAGE 'Please Enter Order No' TYPE 'S'.
CALL TRANSACTION 'YMSL20'.
LEAVE LIST-PROCESSING.
*ENDIF.
END-OF-SELECTION.
*& Form TABLE_HELP
FORM TABLE_HELP .
IF R_MAIL = 'X'.
SELECT SMTP_ADDR FROM ADR6 INTO TABLE IT_ADR6.
SORT IT_ADR6.
DELETE ADJACENT DUPLICATES FROM IT_ADR6 COMPARING ALL FIELDS.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'IT_ADR6-SMTP_ADDR'
PVALKEY = ' '
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'EMAIL'
STEPL = 0
WINDOW_TITLE = 'SELECT MAIL ADDRESS'
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = IT_ADR6
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 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.
ENDIF.
ENDFORM. " TABLE_HELP
*& Form GET_SF
FORM GET_SF .
*u2022 Generate Function Module name
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'Z_CHK'
IMPORTING
FM_NAME = GV_FORM_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.
*u2022 Assigning values to Form Control Structure and Form Composer
IF R_OUT <> 'X'.
GS_CTRLOP-GETOTF = 'X'.
GS_CTRLOP-NO_DIALOG = 'X'.
GS_OUTOPT-TDNOPREV = 'X'.
ENDIF.
*/1BCDWB/SF00000368
CALL FUNCTION GV_FORM_NAME "'/1BCDWB/SF00000368'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = GS_CTRLOP
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = GS_OUTOPT
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = GS_OTFDATA
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.
ENDIF.
CALL FUNCTION GV_FORM_NAME
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = GS_CTRLOP
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = GS_OUTOPT
USER_SETTINGS = 'X'
TEMP_VBELN = P_VBELN
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = GS_OTFDATA
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.
ENDIF.
ENDFORM. " GET_SF
*& Form CONVERT_OTF
FORM CONVERT_OTF .
*u2022 Assigning the OTFDATA to OTF Structure table
CLEAR GT_OTF.
GT_OTF[] = GS_OTFDATA-OTFDATA[].
*u2022 Convert the OTF DATA to SAP Script Text lines
CLEAR GT_PDF_TAB.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
PDF_DELETE_OTFTAB = ' '
IMPORTING
BIN_FILESIZE = GV_BIN_FILESIZE
BIN_FILE =
TABLES
OTF = GT_OTF
LINES = GT_PDF_TAB
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 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.
*t_otf[] = t_otf_from_fm-otfdata[].
Function Module CONVERT_OTF is used to convert the OTF format to PDF
*CALL FUNCTION 'CONVERT_OTF'
*EXPORTING
*FORMAT = 'PDF'
*MAX_LINEWIDTH = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
PDF_DELETE_OTFTAB = ' '
*IMPORTING
*BIN_FILESIZE = W_bin_filesize
BIN_FILE =
*TABLES
*otf = T_OTF
*lines = T_pdf_tab
*EXCEPTIONS
*ERR_MAX_LINEWIDTH = 1
*ERR_FORMAT = 2
*ERR_CONV_NOT_POSSIBLE = 3
*ERR_BAD_OTF = 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.
ENDFORM. " CONVERT_OTF
*& Form SAVE_DIALOG
FORM SAVE_DIALOG .
To display File SAVE dialog window
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE = 'Download to PDF '
DEFAULT_EXTENSION = '(*.PDF)'
DEFAULT_FILE_NAME = 'file.pdf'
FILE_FILTER = 'PDF Format(*.PDF)'
INITIAL_DIRECTORY = 'C:\Documents and Settings\Administrator\Desktop'
WITH_ENCODING =
PROMPT_ON_OVERWRITE = 'X'
CHANGING
FILENAME = W_FILE_NAME
PATH = W_FILE_PATH
FULLPATH = W_FULL_PATH
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " SAVE_DIALOG
*& Form DOWNLOAD
FORM DOWNLOAD .
Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = GV_BIN_FILESIZE
FILENAME = W_FULL_PATH
FILETYPE = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = GT_PDF_TAB
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DOWNLOAD
*& Form SEND_MAIL
FORM SEND_MAIL .
***changes by rajan
*DATA : v_first TYPE USER_ADDR-NAME_FIRST,
V_LAST TYPE USER_ADDR-NAME_LAST.
DATA : detail TYPE STRING.
*SELECT SINGLE NAME_FIRST NAME_LAST FROM
USER_ADDR INTO (V_FIRST,V_LAST)
WHERE BNAME = syst-UNAME.
CONCATENATE v_first V_LAST INTO detail SEPARATED BY space.
data : v_po_no TYPE vbkd-bstkd,
v_po_date TYPE vbkd-bstdk.
data : day TYPE STRING,
month type STRING,
year TYPE STRING.
data : date TYPE STRING.
SELECT SINGLE BSTKD BSTDK
FROM VBKD
INTO (v_po_no,v_po_date)
WHERE VBELN = P_VBELN.
day = v_po_date+6(2).
month = v_po_date+4(2).
year = v_po_date+0(4).
CONCATENATE day '/' month '/' year INTO date.
CONCATENATE 'Please Find attached Order Acceptance against your P.O.No.' v_po_no 'dated' date '.' INTO detail SEPARATED BY
space.
**u2022 Assigning the Description of the object sent in the mail
CLEAR GS_DOCDATA.
GS_DOCDATA-OBJ_NAME = GC_TST.
GS_DOCDATA-OBJ_DESCR = GC_TESTING.
*u2022 Assigning the email id to Structure of the API Recipient List table
CLEAR : GT_RECLIST, GS_RECLIST.
GS_RECLIST-RECEIVER = P_MAIL. "
GS_RECLIST-REC_TYPE = 'U'."'G' ."'O'. "'B'. "'U'.
APPEND GS_RECLIST TO GT_RECLIST.
mail body rajan
I_OBJTXT = 'Dear Sir/Madam.'.
APPEND I_OBJTXT.
I_OBJTXT = detail.
APPEND I_OBJTXT.
I_OBJTXT = ''.
APPEND I_OBJTXT.
I_OBJTXT = 'Thanks.'.
APPEND I_OBJTXT.
I_OBJTXT = 'Best Regards,'.
APPEND I_OBJTXT.
I_OBJTXT = 'For Bilcare Ltd.'.
APPEND I_OBJTXT.
DESCRIBE TABLE i_objtxt LINES gv_desc_lines.
*DESCRIBE TABLE i_objtxt LINES v_lines_txt.
CLEAR I_OBJTXT.
READ TABLE I_OBJTXT INDEX gv_desc_lines.
if sy-subrc = 0.
Document information.
GS_DOCDATA-obj_name = 'ord_accept'.
GS_DOCDATA-expiry_dat = sy-datum + 10.
GS_DOCDATA-obj_descr = 'Order Acceptance'.
GS_DOCDATA-sensitivty = 'F'. "Functional object
GS_DOCDATA-doc_size = gv_desc_lines * 255.
CLEAR Gs_OBJPACK-transf_bin.
Start line of object header in transport packet
GS_OBJPACK-TRANSF_BIN = 'X'.
GS_OBJPACK-doc_size = gv_desc_lines * 255.
GS_OBJPACK-HEAD_START = 1.
GS_OBJPACK-HEAD_NUM = 0.
GS_OBJPACK-BODY_START = 1.
GS_OBJPACK-BODY_NUM = gv_desc_lines.
GS_OBJPACK-DOC_TYPE = 'RAW'.
GS_OBJPACK-OBJ_NAME = 'ORDER_ACCEPTANCE'.
GS_OBJPACK-OBJ_DESCR = 'ORDER_ACCEPTANCE.PDF'.
APPEND GS_OBJPACK TO GT_OBJPACK.
GS_OBJPACK-HEAD_START = 1.
GS_OBJPACK-HEAD_NUM = 0.
GS_OBJPACK-BODY_START = 1.
GS_OBJPACK-doc_type = 'RAW'.
*APPEND GS_OBJPACK TO GT_OBJPACK.
ENDIF.
*u2022 Passing the SAP Script text lines to SAPoffice: Single List with Column Length 255 table
CLEAR : GS_OBJBIN, GS_PDF_TAB.
LOOP AT GT_PDF_TAB INTO GS_PDF_TAB.
GV_POS = 255 - GV_LEN.
IF GV_POS > 134. "length of pdf_table
GV_POS = 134.
ENDIF.
GS_OBJBIN+GV_LEN = GS_PDF_TAB(GV_POS).
GV_LEN = GV_LEN + GV_POS.
IF GV_LEN = 255. "length of out (contents_bin)
APPEND GS_OBJBIN TO GT_OBJBIN.
CLEAR: GS_OBJBIN, GV_LEN.
IF GV_POS < 134.
GS_OBJBIN = GS_PDF_TAB+GV_POS.
GV_LEN = 134 - GV_POS.
ENDIF.
ENDIF.
ENDLOOP.
IF GV_LEN > 0.
APPEND GS_OBJBIN TO GT_OBJBIN.
ENDIF.
*u2022 Filling the details in SAPoffice: Description of Imported Object Components table
DESCRIBE TABLE GT_OBJBIN LINES GV_TAB_LINES.
CLEAR GS_OBJBIN.
READ TABLE GT_OBJBIN INTO GS_OBJBIN INDEX GV_TAB_LINES.
IF SY-SUBRC = 0.
GS_OBJPACK-DOC_SIZE = ( GV_TAB_LINES - 1 ) * 255 + STRLEN( GS_OBJBIN ).
GS_OBJPACK-TRANSF_BIN = 'X'.
GS_OBJPACK-HEAD_START = 1.
GS_OBJPACK-HEAD_NUM = 0.
GS_OBJPACK-BODY_START = 1.
GS_OBJPACK-BODY_NUM = GV_TAB_LINES.
GS_OBJPACK-DOC_TYPE = 'PDF'.
GS_OBJPACK-OBJ_NAME = 'ORDER_ACCEPTANCE'.
GS_OBJPACK-OBJ_DESCR = 'Order Acceptance'.
APPEND GS_OBJPACK TO GT_OBJPACK.
ENDIF.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = GS_DOCDATA
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
PACKING_LIST = GT_OBJPACK
OBJECT_HEADER = I_OBJTXT
CONTENTS_BIN = GT_OBJBIN
CONTENTS_TXT = I_OBJTXT
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
RECEIVERS = GT_RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
WRITE 'Sent Successfully'.
MESSAGE 'Sent Successfully' TYPE 'I'.
CALL TRANSACTION 'YMSL20'.
LEAVE LIST-PROCESSING.
ENDIF.
SUBMIT RSCONN01
WITH MODE EQ 'INT'
AND RETURN.
ENDFORM. " SEND_MAIL
Thanks
Ankur Sharma -
Sending purchase order through internet.
hi, all of u,
please tell me how to send purchase order to supplier through mail.
thanks
rgds
sudhir pawar.Hello,
I suggest you to use addon outlook integration if you are curently using SAP Business One. Post your message in SAP R/3 forum if you use it. Other tools is SBO mailer.
This question should be posted to functional forum:
https://www.sdn.sap.com/irj/sdn/businessone-forums
Rgds, -
How to Send Purchase Order in mail( PDF) to vendor while creating it(ME21N)
Dear Experts,
In our current system when ever we create purchase order using the tcode ME21N, based on the output type configured in our system for the vendor a FAX is send to them..
Now we wanted to send vendors a mail with PO as a PDF attachement. Can you please suggest how to achieve this..
When we have used the mail setting in the output type and used the standard form and driver program, mail is going but not as PDF attachement..
Please suggest how to achieve this..
Regards,
Vidya..please read the documentation. that is part configuration, part basis and very well described at help.sap.com.
-
Sending Purchase Order in mail without the spool generation
Dear All,
When i create a Purchase Order using Tcode ME21N, the PO should go by mail to an external email id as a pdf attachment.
A Z sapscript is used . The spool request is not generated.
Could anyone please let me know the method/code to use the script data for creating Purchase Order and send it via email without spool generation.
Waiting for solution.
Thanks & Regards,
BhavikaHi,
as i said:
create an printer with devices type PDF1, set host spool access method to M (E-Mail to Receiver/Owner).
Use this printer as output-device.
To create and use a printer with PDF1 try searching in SCN or use SAP OSS.
Regards Dieter -
How to Send Purchase Order through EDI/IDOC.
Hi Experts,
We are using SAP ECC.5. And intending to send the Purchase Order to Supplier through EDI/IDOC and Receive the Inbound Acknowledgement.
Appreciate, if you could help me, the required Configuration details for outbound and inbound (PO & Acknowledgement).
Reg
KumarHi Kiran
Many thanks for the response. It is true that by changing the message type to EDI can generate idoc. What is not clear is any other config we need to do interms of Message generation, Resubmitting failed IDOC etc..
Out requirement is that we would generate the IDOC for New and changed docs and send to external EDI converter.
Inbound, receive the IDoc and post the acknowledgement.
Appreciate, if you could forward any document link which can explain the details.
Reg
Kumar -
Sending purchase order through fax
What points to be considered in configuring the option of sending fax to supplier ?
Follow the steps below
1.Use tcode SCOT to config your SAP server for Fax
2.Use tcode NACE to config your Fax output type for PO
3. and MAintain you MN04 for your faxt putput type
MG -MM - Purchasing - Messages - Output control - Message types - Define Message Types for Purchase Order
Define new message type for Fax
4.5.10 Output type Configuration (MM)
Use
In this activity you will create the output type configuration (MM).
Procedure
1. Start the following activity:
Transaction Code SPRO
IMG Menu Materials Management  Purchasing Messages  Output Control  Message Types  Define Message Types for Purchase Order
2. On the Change View Procedures Overview screen, make the following entries, followed by Save:
Output Type Trans
mission
Medium Appln Program FORM routine Form Name
NEU 1 EV /SMB40/FM06P ENTRY_NEU /SMB11/BL_MMCON_L
3. In output table V_166U make the following entries, followed by Save:
LA Operation Cat Type Title Doc.Typ Heading No
EN 1 A AN Request for Quotation RFQ number/date
EN 2 A AN Change to Purchase RFQ RFQ number/date
EN 3 A AN Reminder relating to Purchase RFQ RFQ number/date
EN 4 A AN Rejection letter relating to Purchase RFQ RFQ number/date
4. In Output table VN_TNAPR make the following entries, followed by Save:
Out Med App Program FORM routine
NEU 8 EF ENTRY_BLANK
5. In Output table VN_T685B make the following entries, followed by Save:
Usage Ap Out AcSq P1 Prnt
Paremtr criteria Time Med Cond
Acc LA Name
B ME WA01 0003 X 7 4 1 X EN GI Note Vers.1.
0003 X 7 4 1 X
6. In Output table V_T685 make the following entries, followed by Save:
Usage App CTyp AcSq LA Name
H ME ME01 ME01 EN MovType/Plnt/MatlNo.
H ME ME02 ME02 EN Plant
7. In Output table V_159N make the following entries, followed by Save:
Program P Act Form
RM07IDRU 4 X /SMB11/BL_INVENT
8. In Output table V_TNAD7 make the following entries, followed by Save:
App CTyp Plnt SLoc ODev I
ME WA01 BP01 0002 LOCL X
ME WA01 BP01 0003 LOCL X
ME WA01 BP01 0005 LOCL X
ME WA01 BP01 0002 LOCL X
ME WA01 BP01 0003 LOCL X
ME WA01 BP01 0005 LOCL X
9. In Output table VN_TNAPN make the following entries, followed by Save:
App Out Med Function
EF NEU 5 LF -
Send purchase order e-mail with release strategy
Hi!!
I have a problem with sending e-mails in purchase order that are blocked with release strategy.
I create a purchase order that is block for the release strategy, then I release it. This is working OK, but I can't send an e-mail with this released puchase order, to do it, I have to modify something in the purchase order.
Somebody knows what is happening?
I would like to send e-mails without previous modification of the purchase order.
Thanks for your help.Hi,
Purchase order via e-mail in SAP sys,the configurations and pre-requisites are follow:
1. You must maintain an e-mail address in the address in the vendor master.
2. The same applies to your own user master. You also have to specify an e-mail address there in order to identify the sender.
Note that it is not possible to change the e-mail address of the vendor via the SAP purchase order transaction (ME21N, ME22N, and so on). The system only uses the e-mail address of the vendor that is maintained in the vendor master!
3. For the output type for default values, a communication strategy needs to be maintained in the Customizing that supports the e-mail. You can find the definition of the communication strategy in the Customizing via the following path: (SPRO -> IMG -> SAP Web Application Server -> Basic Services -> Message Control -> Define Communication Strategy). As a default, communication strategy CS01 is delivered. This already contains the necessary entry for the external communication. Bear in mind that without a suitable communication strategy it is not possible to communicate with a partner via Medium 5 (external sending).
4. Use the standard SAP environment (program 'SAPFM06P', FORM routine 'ENTRY_NEU' and form 'MEDRUCK') as the processing routines.
5. In the condition records for the output type (for example, Transaction MN04), use medium '5' (External send).
6. You can use Transaction SCOT to trigger the output manually. The prerequisite for a correct sending is that the node is set correctly. This is not described here, but it must have already been carried out.
7. To be able to display, for example, the e-mail in Outlook, enter PDF as the format in the node.
For more details, check SAP note:191470
Regards,
Biju K -
Sending Purchase Orders via mail
Dear All
I have configured the necessary settings for sending the Purchase Order via email from SAP.
However at present the message is not sent directly.Even after executing ME9F and processing the output the message lies in SOST.
I have to access SOST transaction and then execute start send process for selection and the email message then goes to the Vendor.
Is there any way this can be avoided and we can send the Purchse Order via email withour using SOST?
RegardsGo to SM36 transaction and crate new job with program name RSCONN01 and variant SAP&CONNECTINT and save this job. choose start condition immediately with periodic Job and enter period values as per your need ( example 5 mins). This job should automatuically trigger email in SOST.
Hope this is helpful -
Dear all,
I have created one message condition type ZMAI copying from NEU for purchase order output and assigned output mode as 5-External send.Communication strategy i have given as CS01.Condition records i have maintained in MN04.My purchase orders are not picking this output type.What needs to be done for sending purchase orders thorugh mail mode(external send)
Regards,
Milton.IAre you already assign it to your PO message schema?
Please check to below link:
Re: Need send PO to the vender by e-mail using not default e-mail (ex. 2-nd ID)
PO By email
Out put Message for PO's
Re: PO Output Message
Regards,
w1n -
Email Purchase Order with mail body
Hi, ALL,
I would like to email purchase order to vendors with customized email subject and body. I did configuration in IMG according to note 191470. I also set up title and text in IMG. Now I can email PO with subject (title). But there is no mail body ( the text? ) . Is there anybody know how to do it? Thanks a lot!
JackHi,
In standard you can send purchase order by mail with subject line (title) only and you can not send mail body text.
Check the link:
Send PO External email with attachement and Body text
Regards,
Biju K -
How to send purchase order via e-mail.
Please could someone let me know how to send purchase order via e-mail.
I am an BC.
e-mailing is functionning however I am not very familiar in settings for MMNo, you do not need to touch ME_PRINT_PO. You need to put code before and after ME_PRINT_PO in the print program.
Step 1 - Copy the standard print program SAPFM06P to make a Z version, lets call it ZSAPFM06P
Step 2 - Copy include FM06PE02 to make a Z version, lets call that ZFM06PE02.
Step 3 - ZSAPFM06P change the statement "Include FM06PE02" to read "Include ZFM06PE02".
Step 4 - In include ZFM06PE02 you will find a subroutine called "ENTRY_NEU". In this subroutine you will see it first calls ME_READ_PO_FOR_PRINTING then calls ME_PRINT_PO. Before it calls ME_PRINT_PO just put:
l_nast-nacha = 1.
CLEAR l_nast-dimme.
This means that ME_PRINT_PO will not e-mail, it will create a spool request.
Step 5 - Still in ZFM06PE02, after ME_PRINT_PO has been called, add new code. First check that ent_retco EQ 0. If it does not then exit.
Step 6 - Get the spool ID created by ME_PRINT_PO by either moving sy-msgv1 to a variable or select from NAST.
Step 7 - Call function CONVERT_OTFSPOOLJOB_2_PDF using the spool ID from step 6, and put the result from table PDF into an internal table you can use later. ALso store the export variable pdf_bytecount, you will need it later.
Step 8 - Call function SX_TABLE_LINE_WIDTH_CHANGE using the table from step 7 as content_in and put the results from content_out into a new internal table.
Step 9 - Add some text into a internal table of type solisti1, this will be the body text of the e-mail.
Step 10 - Add whatever receivers you want into an internal table of type somlreci1. If you just want it to go to the address that the PO would have gone to anyway, select the e-mail address from ADR6 where the address number = l_doc-xekko-adrnr, that is the data from the PO.
Step 11 - Populate an internal table of type sopcklsti1 with data relevant to your PDF table from step 8 and the text table from step 9. You will have to put the size of the PDF from step 7 (pdf_bytecount) on the PDF line and the size of the text will be the number of lines of text * 255.
Step 12 - Add info to a structure of type sodocchgi1. You can add the e-mail title in here, field obj_descr. Also add the size of the PDF and the size of the text from step 12 into doc_size, and give the doc a name in field obj_name. This can be anything, ZPDFPO for example.
Step 13 - Call SO_DOCUMENT_SEND_API1 using the tables from steps 8, 9, 10 and 11 and the structure from step 12. You can amend the sending e-mail also. Set commit_work to space.
Step 14 - That is all you need, but I actually call function RSPO_R_RDELETE_SPOOLREQ to delete the spool request created in step 4, then call NAST_PROTOCOL_UPDATE to add some more messages to the processing log of the PO.
That is all. -
Error while sending PO output through mail in PDF format - Urgent
Dear friends,
Developed program to send sapscript output through mail in pdf format, the program running properly, even function module SO_NEW_DOCUMENT_ATT_SEND_API1 returning sy-subrc 0. But the external mail is not going to user lying in SAP outbox with message <b>"Wait for communications service"</b> . SCOT is properly configured, tested mails sending through SAP office.
Find below the source code:
REPORT zmm_porder_gm
NO STANDARD PAGE HEADING.
TABLES: ekko, ekpa, t161t, t052, komv, j_1imocomp, t001, esll.
Internal Tables
DATA : txt LIKE tline-tdline, "HEADER LINE
your_ref LIKE ekko-ihrez, "your ref
our_ref LIKE ekko-unsez, "our ref
mcompname LIKE t001-butxt,
itemname LIKE ekpo-txz01,
del_text LIKE tline-tdline, "delivery text
mat_po_text LIKE tline-tdline. "material po text
DATA: g_ind TYPE i.
DATA: it_esll LIKE esll OCCURS 0 WITH HEADER LINE.
DATA: sub_packno LIKE esll-sub_packno.
DATA : po_flag(1) TYPE c.
DATA : it_erev LIKE erev OCCURS 0 WITH HEADER LINE.
DATA : nmebeln LIKE thead-tdname,
obj LIKE thead-tdname.
DATA : tline LIKE tline OCCURS 0 WITH HEADER LINE. "HEADER TEXT
DATA : it_ekko LIKE ekko OCCURS 0 WITH HEADER LINE.
DATA : it_ekpo LIKE ekpo OCCURS 0 WITH HEADER LINE.
DATA : it_zmm_porder LIKE zmm_porder OCCURS 0 WITH HEADER LINE.
DATA : it_konv LIKE konv OCCURS 0 WITH HEADER LINE.
DATA : it_konv_ftr LIKE konv OCCURS 0 WITH HEADER LINE.
DATA : it_konv_rate LIKE konv OCCURS 0 WITH HEADER LINE.
DATA : it_komv_tax LIKE komv OCCURS 0 WITH HEADER LINE. " For Tax Calculation
DATA : it_zmm_house_bank LIKE zmm_house_bank OCCURS 0 WITH HEADER LINE.
*DATA : mrate TYPE konv-kbetr VALUE 0, mrate1(15). rmoved by ganes and added following logic
DATA : mrate TYPE p VALUE 0 DECIMALS 2, mrate1(15).
DATA : mrate_gm TYPE p DECIMALS 2.
DATA : BEGIN OF it_konv1 OCCURS 0,
knumv LIKE konv-knumv,
kschl LIKE konv-kschl,
END OF it_konv1.
DATA : BEGIN OF it_t052u OCCURS 0.
INCLUDE STRUCTURE t052u.
DATA : END OF it_t052u.
DATA : mpay_terms LIKE t052u-text1.
DATA : mwaers LIKE konv-waers.
DATA : BEGIN OF xt052 OCCURS 0.
INCLUDE STRUCTURE t052.
DATA : END OF xt052.
DATA : it_t16ct LIKE t16ct OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF ztext OCCURS 0.
INCLUDE STRUCTURE ttext.
DATA : END OF ztext.
DATA : it_t001 LIKE t001 OCCURS 0 WITH HEADER LINE.
DATA : mtext(15) TYPE c.
DATA : it_adrc LIKE adrc OCCURS 0 WITH HEADER LINE.
DATA : it_adrc_ven LIKE adrc OCCURS 0 WITH HEADER LINE.
DATA : it_adrc_plt LIKE adrc OCCURS 0 WITH HEADER LINE.
DATA : it_makt LIKE makt OCCURS 0 WITH HEADER LINE.
DATA : it_eket LIKE eket OCCURS 0 WITH HEADER LINE. " Schedulling
DATA : it_eikp LIKE eikp OCCURS 0 WITH HEADER LINE. " Export
DATA : it_t001w LIKE t001w OCCURS 0 WITH HEADER LINE.
DATA : it_t685t LIKE t685t OCCURS 0 WITH HEADER LINE.
DATA : it_t618t LIKE t618t OCCURS 0 WITH HEADER LINE.
DATA : it_t685t_ftr LIKE t685t OCCURS 0 WITH HEADER LINE.
DATA : it_lfa1 LIKE lfa1 OCCURS 0 WITH HEADER LINE.
DATA : it_bapi_mltx_ga LIKE bapi_mltx_ga OCCURS 0 WITH HEADER LINE. "Material long text
DATA : mfirst TYPE i VALUE 0,
mpay_flag(1) TYPE c VALUE 'X',
mwerks LIKE t001w-werks,
msr TYPE i VALUE 0,
l_rate TYPE p DECIMALS 2 VALUE 0,
l_amt TYPE p DECIMALS 2 VALUE 0,
mflag(1) TYPE c,
mlctr TYPE i VALUE 0,
mfamt TYPE p DECIMALS 2 VALUE 0,
mcfamt(15) TYPE c,
mfword(100) TYPE c,
mkschl LIKE konv-kschl,
mchgamt TYPE p DECIMALS 2 VALUE 0,
mkbetr TYPE p DECIMALS 2 VALUE 0,
mkwert TYPE p DECIMALS 2 VALUE 0.
DATA : j_1iexcd TYPE j_1imocomp-j_1iexcd,
j_1icstno TYPE j_1imocomp-j_1icstno,
j_1ilstno TYPE j_1imocomp-j_1ilstno.
DATA : mjmop_r TYPE p DECIMALS 2 VALUE 0,
mjmoq_r TYPE p DECIMALS 2 VALUE 0,
mjecs_r TYPE p DECIMALS 2 VALUE 0,
mjvcs_r TYPE p DECIMALS 2 VALUE 0,
mjvrd_r TYPE p DECIMALS 2 VALUE 0,
mjsep_r TYPE p DECIMALS 2 VALUE 0.
DATA : mjmop_a TYPE p DECIMALS 2 VALUE 0,
mjmoq_a TYPE p DECIMALS 2 VALUE 0,
mjecs_a TYPE p DECIMALS 2 VALUE 0,
mjvcs_a TYPE p DECIMALS 2 VALUE 0,
mjvrd_a TYPE p DECIMALS 2 VALUE 0,
mjsep_a TYPE p DECIMALS 2 VALUE 0.
DATA : mtitle LIKE t161t-batxt.
DATA : no_ammend(10),request_by(50),ver_txt(100),ver_reason(100),stext(200).
begin of Email data declarations**************
DATA: BEGIN OF otf OCCURS 0.
INCLUDE STRUCTURE itcoo .
DATA: END OF otf.
DATA: itcpo LIKE itcpo.
DATA: itcpp LIKE itcpp.
DATA: it_docs TYPE STANDARD TABLE OF docs,
v_bin_filesize TYPE i,
it_lines TYPE STANDARD TABLE OF tline,
wa_lines TYPE tline.
DATA : i_pdf LIKE tline OCCURS 1000 WITH HEADER LINE,
v_pdf_bytecount TYPE i,
v_pdf_spoolid TYPE tsp01-rqident,
v_otf_pagecount TYPE i,
v_btc_jobname TYPE tbtcjob-jobname,
v_btc_jobcount TYPE tbtcjob-jobcount.
DATA: objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
DATA: doc_chng LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
DATA: vafilename(100) VALUE 'po_output.pdf'.
DATA: jobdata TYPE sxjobdata.
DATA arc_params TYPE arc_params.
DATA print_params TYPE pri_params.
DATA g_send_prog TYPE syrepid VALUE 'ZVF03_TEST_PROG'.
DATA immediate TYPE btcchar1.
DATA: i_jobname TYPE tbtcp-jobname,
i_jobcount TYPE tbtcp-jobcount,
i_jobstepcount TYPE tbtcp-stepcount.
DATA recipient_obj LIKE swotobjid.
CONSTANTS: sx_true TYPE sx_boolean VALUE 'X'.
TABLES: tbtcp.
end of Email data declarations**************
SELECTION-SCREEN : BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : mebeln FOR ekko-ebeln OBLIGATORY . " 75
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 12.
SELECTION-SCREEN COMMENT (20) text-b01.
PARAMETERS: b1 AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN : END OF BLOCK block1.
SELECTION-SCREEN: BEGIN OF SCREEN 200 TITLE text-001 AS WINDOW.
PARAMETERS : p_email TYPE ad_smtpadr. "E-Mail Address
SELECTION-SCREEN: END OF SCREEN 200.
INITIALIZATION.
SET PF-STATUS 'ZMMPORD_STAT'.
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN 'EMAIL'.
PERFORM zemail.
WHEN '&IC1'.
PERFORM load_data.
PERFORM process.
IF NOT p_email IS INITIAL.
PERFORM send_mail.
ENDIF.
ENDCASE.
*START-OF-SELECTION.
PERFORM load_data.
PERFORM process.
FORM load_data .
DATA : gindex LIKE sy-tabix.
SELECT * FROM t16ct INTO TABLE it_t16ct WHERE spras = 'EN'.
SELECT * FROM ekko INTO TABLE it_ekko WHERE ebeln IN mebeln.
IF sy-subrc EQ 0.
SELECT * FROM erev INTO CORRESPONDING FIELDS OF TABLE it_erev FOR ALL ENTRIES IN it_ekko
WHERE edokn = it_ekko-ebeln AND rscod <> '' .
SORT it_erev BY edokn revno DESCENDING.
LOOP AT it_ekko.
IF NOT ( it_ekko-frgke EQ 'O' OR it_ekko-frgke EQ '0' ) .
MESSAGE e000(zsd) WITH 'Purchase Order is not Realeased'.
ENDIF.
ENDLOOP.
SELECT * FROM ekpo INTO TABLE it_ekpo WHERE ebeln IN mebeln.
IF sy-subrc EQ 0.
SELECT * INTO TABLE it_makt
FROM makt
FOR ALL ENTRIES IN it_ekpo
WHERE matnr EQ it_ekpo-matnr.
SELECT * INTO TABLE it_lfa1
FROM lfa1
FOR ALL ENTRIES IN it_ekko
WHERE lifnr EQ it_ekko-lifnr.
ENDIF.
SELECT *
INTO TABLE it_t052u
FROM t052u
FOR ALL ENTRIES IN it_ekko
WHERE zterm EQ it_ekko-zterm
AND spras EQ 'EN'.
IF sy-subrc EQ 0.
SORT it_t052u BY zterm.
ENDIF.
SELECT * FROM eket INTO TABLE it_eket WHERE ebeln IN mebeln.
IF sy-subrc EQ 0.
SORT it_eket BY ebeln ebelp.
ENDIF.
SELECT *
INTO TABLE it_eikp
FROM eikp
FOR ALL ENTRIES IN it_ekko
WHERE exnum EQ it_ekko-exnum.
IF sy-subrc EQ 0.
SORT it_eikp BY exnum.
SELECT *
INTO TABLE it_t618t
FROM t618t
FOR ALL ENTRIES IN it_eikp
WHERE expvz EQ it_eikp-expvz
AND spras EQ 'E'
AND land1 EQ 'IN'.
IF sy-subrc EQ 0.
SORT it_t618t BY expvz.
ENDIF.
ENDIF.
REFRESH : it_zmm_porder.
CLEAR : it_zmm_porder.
SELECT * INTO TABLE it_zmm_porder
FROM zmm_porder
WHERE flag EQ 'L'.
IF sy-subrc EQ 0.
SORT it_zmm_porder BY kschl.
ENDIF.
SELECT * FROM konv INTO TABLE it_konv
FOR ALL ENTRIES IN it_ekko
WHERE knumv = it_ekko-knumv
AND kwert NE 0.
LOOP AT it_konv.
gindex = sy-tabix.
READ TABLE it_zmm_porder WITH KEY kschl = it_konv-kschl BINARY SEARCH.
IF sy-subrc NE 0.
DELETE it_konv INDEX gindex.
ENDIF.
ENDLOOP.
IF sy-subrc EQ 0.
SORT it_konv BY knumv kherk kschl.
ENDIF.
REFRESH : it_zmm_porder.
CLEAR : it_zmm_porder.
SELECT * INTO TABLE it_zmm_porder
FROM zmm_porder
WHERE flag EQ 'F'.
IF sy-subrc EQ 0.
SORT it_zmm_porder BY kschl.
ENDIF.
SELECT * INTO TABLE IT_KONV_FTR FROM KONV
FOR ALL ENTRIES IN IT_EKKO
WHERE KNUMV = IT_EKKO-KNUMV
AND ( KSCHL = 'ZIN1'
OR KSCHL = 'ZIN2'
OR KSCHL = 'ZINS'
OR KSCHL = 'ZPF1'
OR KSCHL = 'ZPF2'
OR KSCHL = 'ZPF3'
OR KSCHL = 'ZPKG'
OR KSCHL = 'ZPKF'
OR KSCHL = 'FRA1'
OR KSCHL = 'FRB1'
OR KSCHL = 'FRC1'
OR KSCHL = 'FRD1'
OR KSCHL = 'FRD2'
OR KSCHL = 'FRD3'
OR KSCHL = 'FRD4'
OR KSCHL = 'FRD5'
*****Added one condition type below ZFBC as on 05.06.2007 :Rajiv as per mail of Sadiq via mathew sir(RTDK906646)
OR KSCHL = 'ZFBC' )
AND KWERT NE 0
AND KPOSN GT '000000'.
AND ( KRECH = 'B' " RTDK906167
OR KRECH = 'A' ).
SELECT * INTO TABLE it_konv_ftr FROM konv
FOR ALL ENTRIES IN it_ekko
WHERE knumv = it_ekko-knumv
AND kwert NE 0
AND kposn GT '000000'.
LOOP AT it_konv_ftr.
gindex = sy-tabix.
READ TABLE it_zmm_porder WITH KEY kschl = it_konv_ftr-kschl BINARY SEARCH.
IF sy-subrc NE 0.
DELETE it_konv_ftr INDEX gindex.
ENDIF.
ENDLOOP.
IF it_konv_ftr[] IS NOT INITIAL.
SORT it_konv_ftr BY knumv kschl.
ENDIF.
SELECT KNUMV KSCHL INTO CORRESPONDING FIELDS OF TABLE IT_KONV1 FROM KONV
FOR ALL ENTRIES IN IT_EKKO
WHERE KNUMV = IT_EKKO-KNUMV
and kherk = 'D'
AND ( KSCHL = 'ZIN1'
OR KSCHL = 'ZIN2'
OR KSCHL = 'ZINS'
OR KSCHL = 'ZPF1'
OR KSCHL = 'ZPF2'
OR KSCHL = 'ZPF3'
OR KSCHL = 'ZPKG'
OR KSCHL = 'ZPKF'
OR KSCHL = 'FRA1'
OR KSCHL = 'FRB1'
OR KSCHL = 'FRC1'
OR KSCHL = 'FRD1'
OR KSCHL = 'FRD2'
OR KSCHL = 'FRD3'
OR KSCHL = 'FRD4'
OR KSCHL = 'FRD5'
*****Added one condition type below ZFBC as on 05.06.2007 :Rajiv as per mail of Sadiq via mathew sir(RTDK906646)
OR KSCHL = 'ZFBC' )
AND KWERT NE 0.
AND ( KRECH = 'B' RTDK906167
OR KRECH = 'A' ).
SELECT knumv kschl INTO CORRESPONDING FIELDS OF TABLE it_konv1 FROM konv
FOR ALL ENTRIES IN it_ekko
WHERE knumv = it_ekko-knumv
AND kwert NE 0.
DELETE ADJACENT DUPLICATES FROM it_konv1 COMPARING knumv kschl.
LOOP AT it_konv1.
gindex = sy-tabix.
READ TABLE it_zmm_porder WITH KEY kschl = it_konv1-kschl BINARY SEARCH.
IF sy-subrc NE 0.
DELETE it_konv1 INDEX gindex.
ENDIF.
ENDLOOP.
IF sy-subrc EQ 0.
SORT it_konv1 BY knumv kschl.
ENDIF.
SELECT * INTO TABLE it_t685t
FROM t685t
FOR ALL ENTRIES IN it_konv
WHERE kschl EQ it_konv-kschl
AND kappl EQ it_konv-kappl
AND spras EQ 'E'.
SELECT * INTO TABLE it_t685t_ftr
FROM t685t
FOR ALL ENTRIES IN it_konv_ftr
WHERE kschl EQ it_konv_ftr-kschl
AND kappl EQ it_konv_ftr-kappl
AND spras EQ 'E'.
it_t685t_ftr-kschl = 'JVCS'.
it_t685t_ftr-vtext = 'IN CST in vat'.
APPEND it_t685t_ftr.
SELECT * INTO TABLE it_zmm_house_bank
FROM zmm_house_bank
WHERE ebeln IN mebeln.
ELSE.
MESSAGE e899(mm) WITH 'Data not found for selection criteria...'.
ENDIF.
ENDFORM. " Load_data
FORM process .
DATA : mctr TYPE i VALUE 1.
DATA : gindex LIKE sy-tabix.
DATA : mline(75) TYPE c.
DATA : mlifn2 LIKE ekpa-lifn2.
DATA : mv_name LIKE lfa1-name1,
madrnr LIKE lfa1-adrnr.
CLEAR itcpo.
itcpo-tdgetotf = 'X'.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'ZMM_PORDER'
language = sy-langu
OPTIONS = itcpo
dialog = ' '
EXCEPTIONS
OTHERS = 1.
LOOP AT it_ekko.
CALL FUNCTION 'START_FORM'
EXPORTING
form = 'ZMM_PORDER'.
SELECT SINGLE *
FROM t001
INTO it_t001
WHERE bukrs EQ it_ekko-bukrs.
mcompname = it_t001-butxt.
TRANSLATE mcompname TO UPPER CASE.
Document Type
SELECT SINGLE batxt
INTO mtitle
FROM t161t
WHERE bstyp EQ 'F'
AND spras EQ 'E'
AND bsart EQ it_ekko-bsart.
REFRESH it_adrc.
SELECT SINGLE werks
INTO mwerks
FROM ekpo
WHERE ebeln EQ it_ekko-ebeln.
SELECT SINGLE *
INTO it_t001w
FROM t001w
WHERE werks EQ mwerks.
REFRESH it_adrc.
SELECT SINGLE *
INTO it_adrc_plt
FROM adrc
WHERE addrnumber EQ it_t001w-adrnr.
REFRESH : xt052.
mfamt = 0.
msr = 0.
in 500c this statement failed.
SELECT SINGLE * FROM T052 INTO XT052 WHERE ZTERM = IT_EKKO-ZTERM.
CALL FUNCTION 'FI_TEXT_ZTERM'
EXPORTING
I_T052 = XT052
TABLES
T_ZTEXT = ZTEXT.
As per Preeti... Shipment address should be shown on top as purchase order company address. 27.04.
PERFORM writeform USING 'PLANT' 'PLANT'.
SELECT SINGLE name1 adrnr
INTO (mv_name,madrnr)
FROM lfa1
WHERE lifnr EQ it_ekko-lifnr.
REFRESH it_adrc[].
CLEAR it_adrc[].
FREE it_adrc[].
SELECT SINGLE *
INTO it_adrc_ven
FROM adrc
WHERE addrnumber EQ madrnr.
READ TABLE it_lfa1 WITH KEY lifnr = it_ekko-lifnr.
PERFORM writeform USING 'VENDOR' 'VENDOR'.
Shipment
SELECT SINGLE werks
INTO mwerks
FROM ekpo
WHERE ebeln EQ it_ekko-ebeln.
up to 1 rows.
SELECT SINGLE *
INTO it_t001w
FROM t001w
WHERE werks EQ mwerks.
SELECT SINGLE j_1iexcd j_1icstno j_1ilstno
INTO (j_1iexcd,j_1icstno,j_1ilstno)
FROM j_1imocomp
WHERE werks = mwerks.
REFRESH it_adrc.
SELECT SINGLE *
INTO it_adrc
FROM adrc
WHERE addrnumber EQ it_t001w-adrnr.
PERFORM writeform USING 'SHIPMNT' 'SHIPMNT'.
READ TABLE it_eikp WITH KEY exnum = it_ekko-exnum.
IF sy-subrc EQ 0.
READ TABLE it_t618t WITH KEY expvz = it_eikp-expvz.
ENDIF.
your_ref = it_ekko-ihrez.
our_ref = it_ekko-unsez.
READ TABLE it_erev WITH KEY edokn = it_ekko-ebeln.
IF sy-subrc = 0.
no_ammend = it_erev-revno.
request_by = it_erev-crnam.
ver_txt = it_erev-txz01.
READ TABLE it_t16ct WITH KEY rscod = it_erev-rscod.
IF sy-subrc = 0.
ver_reason = it_t16ct-rstxt.
ELSE.
ver_reason = ''.
ENDIF.
ELSE.
no_ammend = ''.
request_by = ''.
ver_txt = ''.
ver_reason = ''.
ENDIF.
PERFORM writeform USING 'PO_INFO' 'PO_INFO'.
IF it_zmm_house_bank[] IS NOT INITIAL.
READ TABLE it_zmm_house_bank INDEX 1.
PERFORM writeform USING 'BANKDTL' 'BANKDTL'.
ENDIF.
PERFORM writeform USING 'HDR_INFO' 'HDR_INFO'.
PERFORM writeform USING 'BRK_TTL' 'MAIN'.
msr = 1.
mlctr = 1.
*added by ganesh to prevent deleted items to appear in print out
LOOP AT IT_EKPO WHERE EBELN EQ IT_EKKO-EBELN.
LOOP AT it_ekpo WHERE ebeln EQ it_ekko-ebeln AND loekz NE 'L'.
*end of change
CLEAR: mrate, mrate1.
SELECT * FROM konv INTO TABLE it_konv_rate
WHERE knumv EQ it_ekko-knumv
AND kposn EQ it_ekpo-ebelp
AND ( kschl EQ 'PBXX' OR kschl EQ 'PB00' OR kschl EQ 'P001' ).
LOOP AT it_konv_rate.
IF it_konv_rate-kpein > 0. " added by ganesh as per sudhir 12.10.2007
mrate_gm = it_konv_rate-kbetr / it_konv_rate-kpein.
mrate = mrate + mrate_gm. " added by ganesh as per sudhir 12.10.2007
ELSE.
mrate = mrate + it_konv_rate-kbetr.
ENDIF.
IF it_konv_rate-waers IS NOT INITIAL.
mwaers = it_konv_rate-waers.
ENDIF.
ENDLOOP.
For Japanies Yen "RTDK906759
IF it_ekko-waers = 'JPY'.
mrate = mrate * 100.
ENDIF.
End for japanies Yen
mrate1 = mrate.
End rate
mfirst = 0.
MFAMT = MFAMT + ( IT_EKPO-NETPR * IT_EKPO-MENGE ).
mfamt = mfamt + ( mrate * it_ekpo-menge ).
PERFORM get_mat_long_text.
DATA: lt_ctr TYPE i VALUE 0,lt_ctr1 TYPE i, lt_count TYPE i VALUE 0. " Long text counter
DESCRIBE TABLE it_bapi_mltx_ga LINES lt_count.
CLEAR it_bapi_mltx_ga.
*Added by Rajiv 10.05.2007 Read and if condition RTDK906165
READ TABLE it_konv WITH KEY knumv = it_ekko-knumv
kposn = it_ekpo-ebelp.
mkbetr = 0.
mkwert = 0.
IF sy-subrc EQ 0.
LOOP AT it_konv WHERE knumv EQ it_ekko-knumv
AND kposn EQ it_ekpo-ebelp.
IF it_konv-krech EQ 'A'.
mkbetr = it_konv-kbetr / 10.
ELSE.
mkbetr = it_konv-kbetr.
ENDIF.
For Japanies Yen "RTDK906759
IF it_ekko-waers = 'JPY'.
mkbetr = mkbetr * 100.
ENDIF.
End for japaies Yen
IF mkbetr LT '0'.
mkbetr = mkbetr * ( -1 ).
ENDIF.
mkwert = it_konv-kwert.
For Japanies Yen "RTDK906759
IF it_ekko-waers = 'JPY'.
mkwert = mkwert * 100.
ENDIF.
End for japaies Yen
mfamt = mfamt + mkwert.
IF mkwert LT '0'.
mkwert = mkwert * ( -1 ).
ENDIF.
IF it_ekpo-matnr IS INITIAL.
itemname = it_ekpo-txz01.
ELSE.
READ TABLE it_makt WITH KEY matnr = it_ekpo-matnr.
itemname = it_makt-maktx.
ENDIF.
READ TABLE it_t685t WITH KEY kschl = it_konv-kschl BINARY SEARCH.
READ TABLE it_eket WITH KEY ebeln = it_ekpo-ebeln
ebelp = it_ekpo-ebelp BINARY SEARCH.
IF mfirst EQ 0.
PERFORM writeform USING 'BRK_INFO' 'MAIN'.
mfirst = 1.
ELSE.
ADD 1 TO lt_ctr.
CLEAR it_bapi_mltx_ga.
READ TABLE it_bapi_mltx_ga INDEX lt_ctr. "For long text
IF sy-subrc NE 0.
CLEAR it_bapi_mltx_ga.
ENDIF.
PERFORM writeform USING 'BRK_INFO1' 'MAIN'.
ENDIF.
mlctr = mlctr + 1.
ENDLOOP. " it_konv.
ELSE.
IF it_ekpo-matnr IS INITIAL.
itemname = it_ekpo-txz01.
ELSE.
READ TABLE it_makt WITH KEY matnr = it_ekpo-matnr.
itemname = it_makt-maktx.
ENDIF.
READ TABLE IT_T685T WITH KEY KSCHL = IT_KONV-KSCHL BINARY SEARCH.
READ TABLE it_eket WITH KEY ebeln = it_ekpo-ebeln
ebelp = it_ekpo-ebelp BINARY SEARCH.
mfirst = 0.
IF mfirst EQ 0.
PERFORM writeform USING 'BRK_INFO' 'MAIN'.
mfirst = 1.
ELSE.
ADD 1 TO lt_ctr.
CLEAR it_bapi_mltx_ga.
READ TABLE it_bapi_mltx_ga INDEX lt_ctr. "For long text
IF sy-subrc NE 0.CLEAR it_bapi_mltx_ga.ENDIF.
PERFORM writeform USING 'BRK_INFO1' 'MAIN'.
ENDIF.
ENDIF.
*Commented by rajiv 10.05.2007 used this code in above condition.
added by ganesh on 260407 to print record
if it_konv is initial.
READ TABLE IT_MAKT WITH KEY MATNR = IT_EKPO-MATNR.
READ TABLE IT_T685T WITH KEY KSCHL = IT_KONV-KSCHL BINARY SEARCH.
READ TABLE IT_EKET WITH KEY EBELN = IT_EKPO-EBELN
EBELP = IT_EKPO-EBELP BINARY SEARCH.
mFirst = 0.
if mFirst eq 0.
PERFORM WRITEFORM USING 'BRK_INFO' 'MAIN'.
mFirst = 1.
else.
add 1 to lt_ctr.
clear it_bapi_mltx_ga.
read table IT_BAPI_MLTX_GA index lt_ctr. "For long text
if sy-subrc ne 0.clear it_bapi_mltx_ga.endif.
PERFORM WRITEFORM USING 'BRK_INFO1' 'MAIN'.
Endif.
endif.
end of change
REFRESH it_komv_tax.
PERFORM get_tax_cal USING it_ekpo-ebeln
it_ekpo-ebelp.
Changing it_komv_tax.
REFRESH : it_zmm_porder.
CLEAR : it_zmm_porder.
SELECT * INTO TABLE it_zmm_porder
FROM zmm_porder
WHERE flag EQ 'T'.
IF sy-subrc EQ 0.
SORT it_zmm_porder BY kschl.
ENDIF.
LOOP AT it_komv_tax.
gindex = sy-tabix.
READ TABLE it_zmm_porder WITH KEY kschl = it_komv_tax-kschl BINARY SEARCH.
IF sy-subrc NE 0.
DELETE it_komv_tax INDEX gindex.
ENDIF.
ENDLOOP.
LOOP AT it_komv_tax WHERE kwert IS NOT INITIAL.
IF ( IT_KOMV_TAX-KSCHL EQ 'JMOP' OR
IT_KOMV_TAX-KSCHL EQ 'JECS' OR
IT_KOMV_TAX-KSCHL EQ 'JSEP' OR
IT_KOMV_TAX-KSCHL EQ 'JMOQ' OR
IT_KOMV_TAX-KSCHL EQ 'JVCS' OR
IT_KOMV_TAX-KSCHL EQ 'JVRD' OR
IT_KOMV_TAX-KSCHL EQ 'JMIP' OR
* IT_KOMV_TAX-KSCHL EQ 'JEIP' OR
IT_KOMV_TAX-KSCHL EQ 'JSEI' OR
IT_KOMV_TAX-KSCHL EQ 'JSRT' OR
IT_KOMV_TAX-KSCHL EQ 'JEC3' OR
IT_KOMV_TAX-KSCHL EQ 'JVRN' )
AND IT_KOMV_TAX-KWERT IS NOT INITIAL.
SELECT SINGLE vtext
INTO mtext
FROM t685t
WHERE kschl EQ it_komv_tax-kschl
AND spras EQ 'E'.
l_rate = it_komv_tax-kbetr / 10.
l_amt = it_komv_tax-kwert.
For Japanies Yen "RTDK906759
IF it_ekko-waers = 'JPY'.
l_amt = l_amt * 100.
ENDIF.
End for japaies Yen
ADD l_amt TO mfamt.
IF lt_ctr LT lt_count. "Long text
ADD 1 TO lt_ctr.
READ TABLE it_bapi_mltx_ga INDEX lt_ctr.
ELSE.
CLEAR it_bapi_mltx_ga.
ENDIF.
IF l_rate EQ 0 OR l_amt EQ 0.
l_rate = ''.
l_amt = ''.
ENDIF.
PERFORM writeform USING 'TAX_LINE_ITEM' 'MAIN'.
ENDIF.
ENDLOOP.
IF lt_ctr LT lt_count.
DATA mbal_line TYPE i.
mbal_line = ( lt_count - lt_ctr ).
DO mbal_line TIMES.
ADD 1 TO lt_ctr.
READ TABLE it_bapi_mltx_ga INDEX lt_ctr.
IF sy-subrc = 0.
PERFORM writeform USING 'LTEXT' 'MAIN'.
ENDIF.
ENDDO.
ENDIF.
CONCATENATE it_ekko-ebeln it_ekpo-ebelp INTO nmebeln.
REFRESH tline.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F04'
language = sy-langu
name = nmebeln
object = 'EKPO'
TABLES
lines = tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
LOOP AT tline.
IF tline-tdline IS NOT INITIAL.
del_text = tline-tdline.
ENDIF.
CONDENSE del_text.
ENDLOOP.
CONCATENATE it_ekko-ebeln it_ekpo-ebelp INTO nmebeln.
REFRESH tline.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F03'
language = sy-langu
name = nmebeln
object = 'EKPO'
TABLES
lines = tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
refresh.
CLEAR : po_flag, mat_po_text.
LOOP AT tline.
IF tline-tdline IS NOT INITIAL.
MOVE tline-tdline TO mat_po_text.
CONDENSE mat_po_text.
PERFORM writeform USING 'MTRL_PO_TEXT' 'MAIN'.
po_flag = 'X'.
CLEAR : mat_po_text.
ENDIF.
ENDLOOP.
*Added lines below for Schedule delivery for line item on 09.05.2007:Rajiv
CLEAR g_ind.
READ TABLE it_eket WITH KEY ebeln = it_ekpo-ebeln
ebelp = it_ekpo-ebelp BINARY SEARCH.
g_ind = sy-tabix.
LOOP AT it_eket FROM g_ind.
IF it_eket-ebeln EQ it_ekpo-ebeln AND it_eket-ebelp = it_ekpo-ebelp.
PERFORM writeform USING 'SCHEDULE' 'MAIN'.
ELSE.
EXIT.
ENDIF.
ENDLOOP.
*End Addition:Rajiv
PERFORM writeform USING 'REQSLP' 'MAIN'.
mlctr = mlctr + 1.
msr = msr + 1.
CLEAR: lt_ctr, lt_ctr1.
following lines added by ganesh to add service po details as per Mr. sadiq 21.08.2007
IF it_ekpo-packno IS NOT INITIAL.
CLEAR sub_packno.
SELECT SINGLE sub_packno INTO sub_packno FROM esll WHERE packno = it_ekpo-packno.
IF sub_packno IS NOT INITIAL.
CLEAR it_esll.
REFRESH it_esll.
SELECT * FROM esll INTO CORRESPONDING FIELDS OF TABLE it_esll
WHERE packno = sub_packno.
IF sy-subrc = 0.
PERFORM writeform USING 'SERVICE_PO_TEXT' 'MAIN'.
ENDIF.
LOOP AT it_esll.
CONCATENATE sub_packno it_esll-introw INTO obj.
CALL FUNCTION 'READ_TEXT' "4500002446 C300
EXPORTING
id = 'LTXT'
language = sy-langu
name = obj
object = 'ESLL'
TABLES
lines = tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
CLEAR stext.
LOOP AT tline.
CONCATENATE stext tline-tdline INTO stext SEPARATED BY space.
ENDLOOP.
FREE tline.
CLEAR tline.
REFRESH tline.
PERFORM writeform USING 'SERVICE_PO' 'MAIN'.
PERFORM writeform USING 'SERVICE_TEXT' 'MAIN'.
ENDLOOP.
ENDIF.
ENDIF.
end of change
ENDLOOP. " it_ekpo.
IF mlctr < 15.
DO 5 TIMES.
PERFORM writeform USING 'LINEFEED' 'MAIN'.
ENDDO.
ENDIF.
added by ganesh for allding line before ECC No.
IF it_ekko-bsart NE 'ZIM'. " IF EXPORT NO NEED TO PRINT ECC.
PERFORM writeform USING 'LIN' 'MAIN'.
PERFORM writeform USING 'WERKS_TAX_DETAIL' 'MAIN'.
ENDIF.
end of change
MFLAG = 'Y'.
PERFORM writeform USING 'TERMS_VAL' 'MAIN'.
LOOP AT it_konv1 WHERE knumv EQ it_ekko-knumv.
mkschl = it_konv1-kschl.
mchgamt = 0.
LOOP AT it_konv_ftr WHERE knumv EQ it_konv1-knumv
AND kschl EQ mkschl.
mchgamt = mchgamt + it_konv_ftr-kwert.
ENDLOOP.
For Japanies Yen "RTDK906759
IF it_ekko-waers = 'JPY'.
mchgamt = mchgamt * 100.
ENDIF.
End for japaies Yen
mfamt = mfamt + mchgamt.
IF mchgamt LT '0'.
mchgamt = mchgamt * ( -1 ).
ENDIF.
READ TABLE it_t685t_ftr WITH KEY kschl = mkschl.
PERFORM writeform USING 'TERMS_FTR_VAL' 'MAIN'.
mlctr = mlctr + 1.
ENDLOOP.
mflag = 'T'.
CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
EXPORTING
amt_in_num = mfamt
IMPORTING
amt_in_words = mfword
EXCEPTIONS
data_type_mismatch = 1
OTHERS = 2.
CONDENSE mebeln.
nmebeln = it_ekko-ebeln.
REFRESH tline.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F01'
language = sy-langu
name = nmebeln
object = 'EKKO'
TABLES
lines = tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
*---- CHANGED BY MATHEW BECAUSE THIS STATMENT WORKING FINE IN 300 BUT NOT IN 500C.
LOOP AT ZTEXT.
IF ZTEXT-TEXT1 IS NOT INITIAL.
PERFORM WRITEFORM USING 'TERMS_COND_VAL_PAY' 'MAIN'.
ENDIF.
MPAY_FLAG = 'Y'.
ENDLOOP.
READ TABLE it_t052u WITH KEY zterm = it_ekko-zterm.
LOOP AT it_t052u WHERE zterm EQ it_ekko-zterm.
IF it_t052u-text1 IS NOT INITIAL.
PERFORM writeform USING 'TERMS_COND_VAL_PAY' 'MAIN'.
ENDIF.
mpay_flag = 'Y'.
ENDLOOP.
PERFORM writeform USING 'TERMS_COND_VAL' 'MAIN'.
LOOP AT tline.
IF tline-tdline IS NOT INITIAL.
PERFORM writeform USING 'TERMS_COND_VAL_HDR' 'MAIN'.
ENDIF.
CONDENSE txt.
ENDLOOP.
PERFORM writeform USING 'FTR' 'FTR_LIN3'.
PERFORM writeform USING 'FTR_LIN1' 'FTR_LIN1'.
CALL FUNCTION 'END_FORM'.
ENDLOOP. " It_ekko.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = itcpp
RDI_RESULT =
TABLES
otfdata = otf
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
codepage = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " Process
*& Form WRITEFORM
text
-->P_0150 text
-->P_0151 text
FORM writeform USING value(p_0150)
value(p_0151).
CALL FUNCTION 'WRITE_FORM'Hi
I think some basis related configuartions to be done
Try like this and inform me
A cyclic job runs, which processes the messages seen in the SOST queue.
Are you sure it's not the frequency of the cyclic job, rather than the
number of messages in the queue, that you are observing? In messages
that are queued and before the cyclic job runs, "wait for comm. service"
is the normal status.
If you mean that there are always 4 items queued in SOST regardless of
the cyclic send job, then I have no ideas. I would have thought there
was no way to do that.
when the send job runs it just never
picks them up & sends them, while it picks up many others. The send job
is somehow blind to these; no error message occurs. In this case, I
'delete' them from the queue (in SOST) and then 'undelete' (drop down
menu -> /Go to /Deleted Items) them and then re-queue them. THEN they
actually get picked up & sent when the next cyclic send job executes.
Regards
Pavan
Maybe you are looking for
-
How do I make a "Title Menu Button" that is an Arrow?
I am using DVD 08 with iMovie 06. I set my chapters using iMovie 06. When I shared with iDVD 08 everything looked OK. I normally do six scenes however this time I wanted eight. In the past when using iDVD 08 (or iDVD 06) there is always a blue arrow
-
Camera sd card imported into iphoto
I imported photos from my cameras SD card into Iphoto. My sister needs one of the photos to create a calender and wants me to send her jpeg for this but all I can do is email photo to her. There is no jpeg or identifying features of photos imported
-
Photos not as clear as in preview.
I'm making a photo movie. When I watch the photos with Ken Burns effect added, the photos are very clear while previewing, but after I hit update, the photo is blurry in the actual movie. Anybody else experience this? Intel iMac Mac OS X (10.4.7)
-
How to make the new iTunes Radio play more than 2 songs without stopping?
I just upgraded to the latest version of iTunes (11.1.3 (8)) on my Macbook Pro and now the radio stations aren't working! It worked flawlessly before the upgrade! I've searched everywhere for troubleshooting tips and found many, many users with the s
-
Pleas help! A question that needs answering.
Hi all, I'm going on holiday so I am going to buy a power adaptor. The one I am planing to buy also comes with a fire wire cable, however whenever I charge my ipod through the computer I use USB, will I still be able to charge my ipod using the inclu