Sending text file out of sap
Hi All
I have this requirement
I have to read vendor data in sap , create a text file of this data in the daily basis and send the text file to a third party system.
I know how to read data and create the file , but how can I send this file to other third party system , actually it is an SQL server, which uses this file to update the vendor table.
Thank you.
hi Malu,
If you want o put the File in Unix server..
us the commands FTP_COMMAND , FTP_CONNECT and place the file in the unix server.
of you want to place file in the Application server use open data set and close data set..
if you want to place file manually..
use t-code CZ3Y.
regards,
Prabhudas
Similar Messages
-
How to copy/send text file from FTPS to SAP ECC File Port
Hi Frdns,
I am working on one design, actually my requirement as follows
I am receiving financial information document from Banks, which is in the form of BIA2 message format, it looks like text file. This information needs to be sending to SAP ECC system.
I identified some approaches to full fill the requirement
1)Using Conversion agent/or third party tools to convert BIA2 message in to XML, then using PI I will pick up the XML message, convert it in to IDoc.
2)Without any conversion I will copy the same file (original BIA2 message) in to SAP ECC file port, in this case no conversion required, calling some program I will schedule it.
I am looking forward t implement the second approach because it saves lot of money to my client.
Now I am wondering using File adapter can i copy to SAP ECC File Port or I required ABAP proxy?
What is the best approach to copy the BIA message text file from FTPS to SAP ECC File Port.??
Regards,
RajHi Raja,
>>Now I am wondering using File adapter can i copy to SAP ECC File Port or I required ABAP proxy?
Yes you can do this copy, the only restriction that can happen is the file size.. If you are sure that the fiel will be of few MB at the max then you can use the Configuration part alone and copy it to ECC folder. For doing this you need the following:
1. Sender agreement (mention the sender interface as anything XYZ)
2. Sender communication channel. Pick the file in binary mode
3. Receiver determination (keep both the sender and receiver service as same)
4. Interface Detemiantion (dont specify any mapping and keep the receiver interface name as XYZ)
5. Create receiver agreement (with same service and interface)
6. Use file adapter here
Regards
Suraj -
SENDING TEXT FILE AS AN ATTACHMENT
Hi,
I want to send an email as a TEXT file attachment.
Thanks
Vikranth Khimavathhi,
Use the FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail with an attachment. Here is the sample code.
FUNCTION Z_SEND_MAIL.
""Local interface:
*" IMPORTING
*" VALUE(MESSAGE) TYPE STRING OPTIONAL
*" VALUE(RECEIVER_MAIL) TYPE STRING OPTIONAL
*" VALUE(TO) TYPE STRING OPTIONAL
data for send function
DATA doc_data TYPE sodocchgi1.
DATA object_id TYPE soodk.
DATA objcont TYPE TABLE OF soli INITIAL SIZE 10.
DATA wa_objcont LIKE LINE OF objcont.
DATA receiver TYPE TABLE OF somlreci1 INITIAL SIZE 1.
DATA wa_receiver LIKE LINE OF receiver.
move message
TO doc_data-obj_descr .
This is the subject for your mail.
WRITE 'Sub:test Mail' TO doc_data-obj_descr.
This is the body of your mail.
concatenate ' Hi ' to into wa_objcont-line separated by space.
append wa_objcont to objcont.
wa_objcont-line = message.
append wa_objcont to objcont.
Specify receipent id.
MOVE: RECEIVER_MAIL TO wa_receiver-receiver,
'X' TO wa_receiver-express,
'U' TO wa_receiver-rec_type.
APPEND wa_receiver TO receiver.
Finally call the function module.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = doc_data
put_in_outbox = 'X' "Save Document in Outbox
COMMIT_WORK = 'X'
IMPORTING
new_object_id = object_id
TABLES
object_content = objcont
receivers = receiver
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.
SUBMIT rsconn01 USING SELECTION-SET 'SAP&CONNECTINT' AND RETURN.
ENDFUNCTION.
REPORT RSCONN01 MESSAGE-ID XS NO STANDARD PAGE HEADING.
INCLUDE <SYMBOL>. " 11.11.96
TYPE-POOLS: SX.
TYPE-POOLS: KKBLO.
PARAMETERS: MODE(3) TYPE C DEFAULT '*',
OUTPUT TYPE C DEFAULT ' '. "B20K072036 new parameter
selection-screen skip.
parameters maxjobs type sx_maxjobs default 1.
parameters rfcgroup type bdfields-rfcgr.
selection-screen skip.
parameters maxpsize type sx_maxpsize default 1000.
parameters minpsize type sx_minpsize default 20.
parameters maxsel type sx_maxqrows default 20000.
parameters timepo type sx_timepo default 2.
parameters timeout type sx_arfctimeout default 100.
parameters commit type sx_commit default 1.
data address_types type sx_addrtab.
data job_params type sxjobs.
data jobdata type sxjobdata.
--- initialization -
initialization.
get default parameters
call function 'SX_JOBDATA_GET'
changing
jobdata = jobdata.
give defaults to parameters
maxjobs = jobdata-maxjobs.
maxpsize = jobdata-maxpsize.
minpsize = jobdata-minpsize.
maxsel = jobdata-maxsel.
timepo = jobdata-timepo.
timeout = jobdata-arfc_timeout.
commit = jobdata-commit_after.
--- start-of-selection -
start-of-selection.
perform addr_type_to_table using mode
changing address_types.
job_params-maxjobs = maxjobs.
job_params-rfcgroup = rfcgroup.
job_params-maxpsize = maxpsize.
job_params-minpsize = minpsize.
job_params-maxsel = maxsel.
job_params-timepo = timepo.
job_params-arfc_timeout = timeout.
job_params-commit_after = commit.
call function 'SX_OBJECTS_SEND'
exporting
address_types = address_types
output = output
job_params = job_params
exceptions
others = 1.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
exit.
TABLES: SXADDRTYPE.
DATA: selection type SX_ADDRTAB,
NR_SO_OBJECTS TYPE I,
OBJ_CAT TYPE SX_OBJ_CAT OCCURS 20 WITH HEADER LINE.
if sy-batch = 'X'.
message I078 with 'RSCONN01' SY-HOST SY-MANDT.
endif.
*fill selection table
refresh selection.
if mode = '*'.
clear mode.
endif.
IF NOT ( MODE IS INITIAL ).
SELECT SINGLE * FROM SXADDRTYPE WHERE ADDR_TYPE EQ MODE.
IF SY-SUBRC NE 0.
IF OUTPUT EQ 'X'.
WRITE: MODE, TEXT-001, TEXT-002.
ENDIF.
EXIT.
ENDIF.
IF SXADDRTYPE-METHOD NE 'SAPCONNECT'.
IF OUTPUT EQ 'X'.
WRITE: MODE, TEXT-003, TEXT-004, TEXT-005.
ENDIF.
EXIT.
ENDIF.
append sxaddrtype-addr_type to selection.
ELSE.
select * from sxaddrtype
where method = 'SAPCONNECT'
and extern = sx_true.
case sxaddrtype-addr_type.
when 'INT' or 'FAX' or 'PAG' or
'PRT' or 'RML' or 'X40'.
append sxaddrtype-addr_type to selection.
endcase.
endselect.
ENDIF.
CALL FUNCTION 'SX_OBJECTS_SEND'
EXPORTING
ADDRESS_TYPES = SELECTION
IMPORTING
NR_SO_OBJECTS = NR_SO_OBJECTS
TABLES
OBJ_CAT = OBJ_CAT
EXCEPTIONS
INTERNAL_ERROR = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
IF OUTPUT EQ 'X'.
Always write out this error message:
WRITE: TEXT-006, SY-SUBRC.
ENDIF.
EXIT.
ENDIF.
IF NR_SO_OBJECTS = 0.
IF OUTPUT EQ 'X'.
WRITE: TEXT-007.
ENDIF.
EXIT.
ENDIF.
IF OUTPUT EQ 'X'.
PERFORM DISPLAY_OBJECT_CATALOGUE.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR MODE.
PERFORM F_SHOW_ADDR_TYPES CHANGING MODE.
AT SELECTION-SCREEN ON HELP-REQUEST FOR OUTPUT.
PERFORM F_HELP_OUTPUT.
*& Form addr_type_to_table
text
form addr_type_to_table using address_type type sx_addrtyp
changing address_types type sx_addrtab.
data adrtp_wa type sxaddrtype.
data adrtp type sx_addrtyp.
if address_type <> '*'.
adrtp = address_type.
endif.
if not adrtp is initial.
select single * from sxaddrtype into adrtp_wa
where addr_type = adrtp.
if sy-subrc <> 0.
message i009 with adrtp.
exit.
endif.
if adrtp_wa-method ne 'SAPCONNECT'.
message i027 with adrtp.
exit.
endif.
append adrtp_wa-addr_type to address_types.
else.
select * from sxaddrtype into adrtp_wa
where method = 'SAPCONNECT'
and extern = sx_true.
case adrtp_wa-addr_type.
when 'INT' or 'FAX' or 'PAG' or
'PRT' or 'RML' or 'X40'.
append adrtp_wa-addr_type to address_types.
endcase.
endselect.
endif.
endform. " addr_type_to_table
*& Form DISPLAY_OBJECT_CATALOGUE
Anzeige der Liste der zum Versenden selektierten Objekte
--> p1 text
<-- p2 text
FORM DISPLAY_OBJECT_CATALOGUE.
DATA: FIELD_LST TYPE KKBLO_T_FIELDCAT.
DATA: FIELD_CAT TYPE KKBLO_FIELDCAT.
DATA: IS_LAYOUT TYPE KKBLO_LAYOUT.
IS_LAYOUT-NO_ZEBRA = 'X'.
FIELD_CAT-REF_TABNAME = 'SXOBJCAT'.
FIELD_CAT-NO_SUM = 'X'.
FIELD_CAT-JUST = 'L'.
FIELD_CAT-OUTPUTLEN = 3.
FIELD_CAT-REPTEXT = 'Trc'.
FIELD_CAT-FIELDNAME = 'DISPL_TRC'.
FIELD_CAT-HOTSPOT = 'X'.
FIELD_CAT-SYMBOL = 'X'.
APPEND FIELD_CAT TO FIELD_LST.
FIELD_CAT-SYMBOL = ' '.
FIELD_CAT-OUTPUTLEN = 0.
FIELD_CAT-HOTSPOT = ' '.
FIELD_CAT-REPTEXT = ' '.
CLEAR: FIELD_CAT-NO_ZERO, FIELD_CAT-KEY .
FIELD_CAT-FIELDNAME = 'ID'. APPEND FIELD_CAT TO FIELD_LST.
FIELD_CAT-FIELDNAME = 'TITLE'. APPEND FIELD_CAT TO FIELD_LST.
FIELD_CAT-FIELDNAME = 'TYPE'. APPEND FIELD_CAT TO FIELD_LST.
FIELD_CAT-FIELDNAME = 'NR_RECIP'. APPEND FIELD_CAT TO FIELD_LST.
LOOP AT FIELD_LST INTO FIELD_CAT.
FIELD_CAT-COL_POS = SY-TABIX.
MODIFY FIELD_LST FROM FIELD_CAT.
ENDLOOP.
LOOP AT OBJ_CAT.
OBJ_CAT-DISPL_TRC = SYM_PENCIL.
MODIFY OBJ_CAT.
ENDLOOP.
CALL FUNCTION 'K_KKB_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'RSCONN01'
I_CALLBACK_USER_COMMAND = 'CB_OL_UCOMM'
I_CALLBACK_TOP_OF_PAGE = 'CB_OL_TOP'
I_CALLBACK_PF_STATUS_SET = 'CB_OL_PFSTATUS'
I_TABNAME = 'OBJ_CAT'
IS_LAYOUT = IS_LAYOUT
IT_FIELDCAT = FIELD_LST
TABLES
T_OUTTAB = OBJ_CAT
EXCEPTIONS
OTHERS = 1.
ENDFORM. " DISPLAY_OBJECT_CATALOGUE
*& Form CB_OL_PFSTATUS
Callback Funktion (wird aus Listtool heraus gerufen) *
--> p1 text
<-- p2 text
FORM CB_OL_PFSTATUS
USING EXTAB TYPE KKBLO_T_EXTAB.
SET PF-STATUS 'CATALOG' EXCLUDING EXTAB.
SET TITLEBAR 'CAT'.
ENDFORM. " CB_OL_PFSTATUS
*& Form CB_OL_TOP
Callback Funktion (wird aus Listtool heraus gerufen) *
--> p1 text
<-- p2 text
FORM CB_OL_TOP.
ENDFORM. " CB_OL_TOP
*& Form CB_OL_UCOMM
text *
--> p1 text
<-- p2 text
FORM CB_OL_UCOMM
USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE KKBLO_SELFIELD.
DATA: NUMC5(5) TYPE N.
NUMC5 = SELFIELD-TABINDEX.
CASE UCOMM.
WHEN 'PIC1'.
CASE SELFIELD-SEL_TAB_FIELD.
WHEN 'OBJ_CAT-DISPL_TRC' OR 'OBJ_CAT-TITLE' OR 'OBJ_CAT-ID'.
READ TABLE OBJ_CAT INDEX SELFIELD-TABINDEX.
IF SY-SUBRC NE 0.
MESSAGE E042.
ENDIF.
SUBMIT RSWTTR01
WITH P_TYPE = 'D'
WITH P_UNAME = SPACE
WITH P_OBJ = OBJ_CAT-ID AND RETURN.
WHEN OTHERS.
MESSAGE I041 WITH NUMC5 SELFIELD-SEL_TAB_FIELD UCOMM.
ENDCASE.
WHEN OTHERS.
MESSAGE I041 WITH NUMC5 SELFIELD-SEL_TAB_FIELD UCOMM.
ENDCASE.
ENDFORM. " CB_OL_UCOMM
*& Form F_SHOW_ADDR_TYPES
text
<--P_MODE text *
FORM F_SHOW_ADDR_TYPES CHANGING A_TYPE.
DATA: HELP_INFO LIKE HELP_INFO
, sel_value like help_info-fldvalue
, CUCOL LIKE SY-CUCOL
, CUROW LIKE SY-CUROW
, value like help_info-fldvalue value 'SE38'
, IND LIKE SY-INDEX
, C_SY_SUBRC(3) TYPE C
DATA: BEGIN OF FIELDS OCCURS 5.
INCLUDE STRUCTURE HELP_VALUE.
DATA: END OF FIELDS.
DATA: BEGIN OF LIST_OF_FIELDS OCCURS 5,
NAME(21) TYPE C.
DATA: END OF LIST_OF_FIELDS.
DATA: BEGIN OF FULL_LIST OCCURS 5,
ADDRESS_TYPE LIKE SXADDRTYPE-ADDR_TYPE,
END OF FULL_LIST.
REFRESH FIELDS.
REFRESH LIST_OF_FIELDS.
REFRESH FULL_LIST.
HELP_INFO-TABNAME = 'SXADDRTYPE'.
HELP_INFO-FIELDNAME = 'ADDR_TYPE'.
SELECT * FROM SXADDRTYPE.
IF SXADDRTYPE-METHOD NE 'SAPCONNECT'
OR SXADDRTYPE-EXTERN NE SX_TRUE.
CONTINUE.
ENDIF.
MOVE SXADDRTYPE-ADDR_TYPE TO FULL_LIST-ADDRESS_TYPE.
APPEND FULL_LIST.
ENDSELECT.
MOVE '*' TO FULL_LIST-ADDRESS_TYPE.
APPEND FULL_LIST.
LIST_OF_FIELDS-NAME = 'SXADDRTYPE-ADDR_TYPE'.
APPEND LIST_OF_FIELDS.
CALL FUNCTION 'TRANSFER_NAMES_TO_FIELDS'
EXPORTING
SELECTFIELD = HELP_INFO-FIELDNAME
TABLES
FIELDS = FIELDS
NAMELIST = LIST_OF_FIELDS
EXCEPTIONS
WRONG_FORMAT_GIVEN = 1
OTHERS = 2.
CALL FUNCTION 'HELP_VALUES_GET_WITH_VALUE'
EXPORTING
DISPLAY = ' '
FIELDNAME = HELP_INFO-FIELDNAME
TABNAME = HELP_INFO-TABNAME
GIVEN_VALUE = HELP_INFO-FLDVALUE
TITEL = TEXT-002
IMPORTING
SELECT_VALUE = HELP_INFO-FLDVALUE
SELECT_INDEX = IND
TABLES
FIELDS = FIELDS
VALUETAB = FULL_LIST
EXCEPTIONS
FIELD_NOT_IN_DDIC = 1
MORE_THEN_ONE_SELECTFIELD = 2
NO_SELECTFIELD = 3
OTHERS = 4.
C_SY_SUBRC = SY-SUBRC.
CASE SY-SUBRC.
WHEN '0'.
READ TABLE FULL_LIST INTO A_TYPE INDEX IND.
WHEN OTHERS.
MESSAGE E022 WITH C_SY_SUBRC.
ENDCASE.
ENDFORM. " F_SHOW_ADDR_TYPES
*& Form F_HELP_OUTPUT
text
--> p1 text
<-- p2 text
FORM F_HELP_OUTPUT.
DATA: CANCELLED TYPE C,
C_SY_SUBRC(8) TYPE C.
CALL FUNCTION 'POPUP_DISPLAY_TEXT'
EXPORTING
LANGUAGE = SY-LANGU
POPUP_TITLE = 'SAPconnect'
TEXT_OBJECT = 'RSCONN01_F1_OUTPUT_40B'
IMPORTING
CANCELLED = CANCELLED
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2.
C_SY_SUBRC = SY-SUBRC.
IF SY-SUBRC NE 0.
MESSAGE E035 WITH C_SY_SUBRC. leads to dump !
ENDIF.
ENDFORM. " F_HELP_OUTPUT
Regards,
Richa -
Use FTP Transport Protocol (XI) to send text file created from R3
I've configured a Port in IDoc Processing (WE21) to create an output file from a Bank Partner Profile (WE20) where my Message Type is PAYEXT and IDoc Type PEXR2002.
I need to take this Text File and send it to the Bank;s FTP site using the Integration Server (XI).
How can I take this text file and simply send it to the Bank without going through File Content Conversion in order to convert it to XML as the Sender and then uncovert it during the Receiver to FTP the file to the Bank?
If that is not possible, would anyone know how to configure the RecordSet Structure and parameters for both the Sender and Receiver?Hi,
Let me re-phrase your scenario:
ECC is required to send PAYEXT IDOC to XI which needs to be send to the bank in IDOC text file format to the bank. If this is the case we can achieve this by doing the following:
1.Rather than using TRFC port used by the IDOC as the method of communication, you can leverage using file port. The configurations to the file port are simple. You need to select a place where you can drop the IDOC file created by the ECC system and XI would pick up the file.
2. Poll for the file using NFS from that particular location where ECC drops the file. (If it is being staged on the ECC system, then XI service user SAPservice<SID> must have access permission on that folder like \usr\sap\put\interfaces.
3. Configure receiver FTP adapter to send the file to the bank.
Hope this helps.
Indranil
Award points if helpful -
Sending text files as attachments in mails
Hi Experts,
I want to send some content in a text file as an attachment in the mail. Can anybody provide me the sample code for this.
points guaranteed.
thanks
sanakrHI
Check this one
first create a Include report with the following coding
*& Include ZPA1_INCLFOR_MAIL *
* Data
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
* FORM
FORM ml_customize USING objname objdesc.
*----------- Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
*--------- Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
* FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
* FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
* FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
*--------- Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
* IMPORTING
* COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
* Header Data
* Already Done Thru FM
* Main Text
* Already Done Thru FM
* Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
* Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
* Receiver List
* Already done thru fm
ENDFORM. "ml_prepare
* FORM
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
* CONTENTS_HEX = objhex
* OBJECT_PARA =
* object_parb =
receivers = 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 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
* FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
*-------------- Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
*------------- Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
* FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
*-------- Data
DATA : pos TYPE i.
DATA : len TYPE i.
*------------ Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
Then include that report in the following report and copy the same code and paste it there
*& Report ZPA_TEMP147 *
REPORT ZPA_TEMP147 .
INCLUDE zpa1_inclfor_mail.
* DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
* SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY.
* AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
* START-OF-SELECTION
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
* FORM
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
* CHECK_DOS_FORMAT =
IMPORTING
* DRIVE =
EXTENSION = extension
NAME = name
* NAME_WITH_EXT =
* PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
Regards
Pavan -
Text File Attachment in SAP Mail ECC 6.0
Hi,
Is it possible to use a text format 'TXT' on the Function Module "O_NEW_DOCUMENT_ATT_SEND_API1" in ECC 6.0? Because I've seen alot of examples in the forum that are using 'XLS' Format attachments.
I made a program that have been attaching text fomat file in the SAP mail. It is working fine in other SAP boxes but in our current box, as I tested it, opening the text attachment, the result is a file text now contained a long string (max1022 char) instead of a file that is tab-delimited. What would you suggest on this?yes u can attach txt file.refer to the code below!
data: itcpo like itcpo,
tab_lines like sy-tabix.
Variables for EMAIL functionality
data: maildata like sodocchgi1.
data: mailpack like sopcklsti1 occurs 2 with header line.
data: mailhead like solisti1 occurs 1 with header line.
data: mailbin like solisti1 occurs 10 with header line.
data: mailtxt like solisti1 occurs 10 with header line.
data: mailrec like somlrec90 occurs 0 with header line.
data: solisti1 like solisti1 occurs 0 with header line.
perform send_form_via_email.
FORM SEND_FORM_VIA_EMAIL *
form send_form_via_email.
clear: maildata, mailtxt, mailbin, mailpack, mailhead, mailrec.
refresh: mailtxt, mailbin, mailpack, mailhead, mailrec.
Creation of the document to be sent File Name
maildata-obj_name = 'TEST'.
Mail Subject
maildata-obj_descr = 'Subject'.
Mail Contents
mailtxt-line = 'Here is your file'.
append mailtxt.
Prepare Packing List
perform prepare_packing_list.
Set recipient - email address here!!!
mailrec-receiver = [email protected]'.
mailrec-rec_type = 'U'.
append mailrec.
Sending the document
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = maildata
put_in_outbox = ' '
tables
packing_list = mailpack
object_header = mailhead
contents_bin = mailbin
contents_txt = mailtxt
receivers = mailrec
exceptions
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
others = 99.
endform.
Form PREPARE_PACKING_LIST
form prepare_packing_list.
clear: mailpack, mailbin, mailhead.
refresh: mailpack, mailbin, mailhead.
describe table mailtxt lines tab_lines.
read table mailtxt index tab_lines.
maildata-doc_size = ( tab_lines - 1 ) * 255 + strlen( mailtxt ).
Creation of the entry for the compressed document
clear mailpack-transf_bin.
mailpack-head_start = 1.
mailpack-head_num = 0.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'RAW'.
append mailpack.
mailhead = 'TEST.TXT'.
append mailhead.
File 1
mailbin = 'This is file 1'.
append mailbin.
describe table mailbin lines tab_lines.
mailpack-transf_bin = 'X'.
mailpack-head_start = 1.
mailpack-head_num = 1.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'TXT'.
mailpack-obj_name = 'TEST1'.
mailpack-obj_descr = 'Subject'.
mailpack-doc_size = tab_lines * 255.
append mailpack.
*File 2
mailbin = 'This is file 2'.
append mailbin.
data: start type i.
data: end type i.
start = tab_lines + 1.
describe table mailbin lines end.
mailpack-transf_bin = 'X'.
mailpack-head_start = 1.
mailpack-head_num = 1.
mailpack-body_start = start.
mailpack-body_num = end.
mailpack-doc_type = 'TXT'.
mailpack-obj_name = 'TEST2'.
mailpack-obj_descr = 'Subject'.
mailpack-doc_size = tab_lines * 255.
append mailpack.
endform.
regards,
madhu -
Sending Text File through Mail Adapter
Hi Group,
I need to send my Target as Mail attachment in the Text File?Can any body SuggestHi swabap,
You need to use PayloadSwapBean module in the Mail receiver adapter. This module will send the payload as an attchment to the mail server.
Check the following link
<a href="/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure:///people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
Regards,
Akshay -
Problem to send text file to mail from ALV report
Hi Friends,
I have a problem in my ALV report with text file. As per the requirment, when we execute the program then text attachment should go to the particual email.
When i am using file type as XLS i am getting attachment with all 4 recoreds( input for 4 records) in mail. But all 4 records are coming in SAME ROW. It should come 4 records in 4 rows. when I use file type as TXT and separated by pipe symble in code, it is showing only one recored for same above input.
When i use file type as XLS and click the attachment in email, it will triggire one popul with three options like SAVE, OPEN, CANCEL.
But when i click on text file attachment, it is directly showing ony one recored.
Please correct me on this.
my code is
PERFORM send_file_as_email_attachment
tables i_message
i_attach
using v_email
'User last log on details'
'XLS'
'User log on list'
changing v_error
v_reciever.
FORM send_file_as_email_attachment tables pi_message
pi_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: l_error TYPE sy-subrc,
l_reciever TYPE sy-subrc,
l_mtitle LIKE sodocchgi1-obj_descr,
l_email LIKE somlreci1-receiver,
l_format TYPE so_obj_tp ,
l_attdescription TYPE so_obj_nam ,
l_attfilename TYPE so_obj_des ,
l_sender_address LIKE soextreci1-receiver,
l_sender_address_type LIKE soextreci1-adr_typ,
l_receiver LIKE sy-subrc.
l_email = p_email.
l_mtitle = p_mtitle.
l_format = p_format.
l_attdescription = p_attdescription.
l_attfilename = p_filename.
l_sender_address = p_sender_address.
l_sender_address_type = p_sender_addres_type.
Fill the document data.
v_doc_data-doc_size = 1.
Populate the subject/generic message attributes
v_doc_data-obj_langu = sy-langu.
v_doc_data-obj_name = 'SAPRPT'.
v_doc_data-obj_descr = l_mtitle .
v_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR v_doc_data.
READ TABLE i_attach INDEX v_cnt.
v_doc_data-doc_size =
( v_cnt - 1 ) * 255 + STRLEN( i_attach ).
v_doc_data-obj_langu = sy-langu.
v_doc_data-obj_name = 'SAPRPT'.
v_doc_data-obj_descr = l_mtitle.
v_doc_data-sensitivty = 'F'.
CLEAR i_attachment.
REFRESH i_attachment.
i_attachment[] = pi_attach[].
Describe the body of the message
CLEAR i_packing_list.
REFRESH i_packing_list.
i_packing_list-transf_bin = space.
i_packing_list-head_start = 1.
i_packing_list-head_num = 0.
i_packing_list-body_start = 1.
DESCRIBE TABLE i_message LINES i_packing_list-body_num.
i_packing_list-doc_type = 'RAW'.
APPEND i_packing_list.
Create attachment notification
i_packing_list-transf_bin = 'X'.
i_packing_list-head_start = 1.
i_packing_list-head_num = 1.
i_packing_list-body_start = 1.
DESCRIBE TABLE i_attachment LINES i_packing_list-body_num.
i_packing_list-doc_type = l_format.
i_packing_list-obj_descr = l_attdescription.
i_packing_list-obj_name = l_attfilename.
i_packing_list-doc_size = i_packing_list-body_num * 255.
APPEND i_packing_list.
Add the recipients email address
CLEAR i_receivers.
REFRESH i_receivers.
i_receivers-receiver = l_email.
i_receivers-rec_type = 'U'.
i_receivers-com_type = 'INT'.
i_receivers-notif_del = 'X'.
i_receivers-notif_ndel = 'X'.
APPEND i_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = v_doc_data
put_in_outbox = 'X'
sender_address = l_sender_address
sender_address_type = l_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = v_sent_all
TABLES
packing_list = i_packing_list
contents_bin = i_attachment[]
contents_txt = i_message
receivers = i_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
l_error = sy-subrc.Hi,
declare the following constant in u r program and concatenate at the end of each and every record in your internal table.
CONSTANTS : LV_CRLF TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
for eg.
if u internal table has values like
row1
row2
row3
concatenate the 1st record lv_crlf into first record.
conactenate second record lv_crlf into second record.
concatenate third record lv_crlf into third record.
now attach the internal table to the FM which u use for sending email. Each and every row will come in new line. The LV_CRLF will hold nothing but a line feed character (#).
Hope it will solve u r problem
Regards,
Rose. -
Hello Gurus,
I like to send a text file from the aplication server to spool or send this file to a specific printer.
What instructions do you know?
Thanks.
Joseph.Hi,
I think the best way to send a text file from application server to the spool printer.
1. Download the file into a internal table
2. Use standard function modules to send the table to the spool printer
Regards -
How to send text file as an email attachment havin more than 255 characters
My requirement is to generate a text file and to send this text file as E-mail attachment. I am using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' to send the E-mail. but here the limitation is the number of characters per line must not be more than 255 characters whereas in my case it is exceeding 1000 characters per line. could anyone please suggest me what should i do now ? Each field in the text file has to be tab delimited.
Simplest might well be to use javamail API instead of the two tags that Sites provides, e.g. see email - Sending mail attachment using Java - Stack Overflow for a full example.
Phil -
hi
i've trying to send a text file via rs-232 but no success
The file contains a code for a device im dealing with, when i send the text file with labview to the device, it went ok with no errors, but when i connect the device on hyperterminal and check if the code was loaded it was not.
can you please give some clues to deal with this?
thanks a lot
attached example text file and LV code
Attachments:
Serial.JPG 45 KB
DefineHome.txt 1 KBSome devices are very picky with the End Of Line. You might want to right-click on your FIle Read and deselect the "Convert EOL".
Or if you need to write 1 line at a time, right click on the Read Text File and select "Read Lines". Set the number of line to read to -1 (read all) and then wire the resulting array into a FOR loop where you do the VISA Write.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
How to make a text file out of a bunch of strings
Hey Guys,
Can anyone please tell me how I can make a text file that stores a bunch of strings. I have some strings that store some values. I want to know is there a way so that I can just keep on appending the string values to the text files. Please reply. Any help would be appreciated.
Thank you,
Vivekboolean appendToFile = true;
// will create the file if it does not exist...
// will append to the file (at the end of the file) if it exist
PrintWriter out = new PrintWriter( new BufferedWriter(
new FileWriter("term.txt", appendToFile)) );
out.println(str); // print the string and append a newline character
out.print(str); // print the string
out.close() // close the file when done (release the resource)
-
Hi experts,
I developed a custom program to send a text file using BCS. When I open text file using text pad, some special characters are displaying at the beginning of the sentence.
ÿþ are displayed at the beginning of the sentence. How can I remove this?
Thanks,
MarcHi,
Related BCS class, Check these example programs how attachments are being generated.
BCS_EXAMPLE_1
BCS_EXAMPLE_2
BCS_EXAMPLE_3
BCS_EXAMPLE_4
BCS_EXAMPLE_5 - BCS Use, Example 5 (Winword Attachment)
BCS_EXAMPLE_6 - Send PDF Form by E-Mail
BCS_EXAMPLE_7 - BCS: Send E-Mail with Self-Created Excel Attachment (Example)
Thanks
Venkat.O -
Is it possible to send text file with class cl_bcs
Hi,
i want to send a text file with class
cl_bcs but i dont know it is possible or not?
Thanks.no, it isn´
-
CSV , text file out put from flash exe
Hi,
I want to save data from flash exe to CSV file and text file
. OS is XP and there will be no server connections. Is this
possible. Please help.
Thanks,
ManuIf th ecomputer you're working with has some server software
running (Apache or IIS) you could save your data with php or asp.
If you don't then you could use the Shared Objects (which works as
a cookie, so you'll be e bit limited here). There was a function
called MMSAVE back in FlashMX, don't know it that still works, that
writes to a text file (but only in the development enviroment).
Let me know a few more details and we'll find a way.
Cheers
Gorka
Maybe you are looking for
-
Error while saving: Dynprooutput without connection to user
Hello experts, I have following problem: While creating an sales order, I've implemented a badi which gives me a popup (POPUP_FOR_INTERACTION) if the customer has some longtext. The popup is working fine, but when I save this order, I get error in sm
-
I have a dell all in one desktop and everytime I try to click the download button for creative cloud or photoshop, it says "Creative cloud/photoshop is a desktop app, download it from a computer." This doesn't make any sense.
-
Patch 10.1.5 won't run on Acrobat X Standard
I'm trying to apply the latest Acrobat patch, 10.1.5. It installs fine for my Acrobat Pro PCs but will not run on my Acrobat Standard PCs. When I launch the AcrobatUpd1015.msp, it runs for a few seconds then disappears. This is what I get in the log:
-
I have an applet with four JLists. I need to move items between the lists, but items from some lists are not allowed on other lists. Essentially, I need to know when an item is dragged/dropped on a list, what type of object it is so I can determine i
-
Text To Speech feature request
I'm listening music through original iphone4 headset. When I recieve a call I used to get iPhone from my pocket to see who's calling me. So it would be nice if iPhone could say me who is calling. Something like "Incoming call from Jonh Smith" and the