Sending the enhanced Infotype 0002 outside SAP via an IDOC
Hello Friends,
We have added couple of Z fields to the standard 0002 Iinfotype table PA0002.
I can see the custom fields in the trans : PA30 screen for infotype 002.
Now, we want to send these custom fields value outside SAP via an IDOC.
Here are the steps I followed :
I created a Z Segment in an extended idoc with the structure PA0002.
I went in transaction PM01 for Infotype 0002 and added the above created Z segment as a 2nd IDOC segment.
In transaction PA30 for 002, I made changes to the custom field value for a person 12039.
Created an idoc via BD21.
IDOC generated with the Z Segment but it doesn't contain any Z custom fields.
Which step am I missing here? Do I have to have a user-exit or BADI to achieve this OR can it be done without writing any code?
Basically I
I will really appreciate your help.
Regards,
Pooja Pandey
Pooja,
you need to fill each field manually.
check this code i am filling ZHCMS_PI_SEMENT
data: sgmnt_e1pityp type e1pityp.
field-symbols: <wplog> type any.
field-symbols: <wplog1> type any.
data: ixxxx type e1pityp, iyyyy type e1plogi,sgmnt_hcms_pi type zhcms_pi_segment,wa_idoc_data_x type edidd, ls_idoc_data type edidd.
data: lv_p0001 type standard table of p0001 ,lv_p0002 type standard table of p0002 ,lv_p0007 type standard table of p0007 .
data: lv_p0521 type standard table of p0521 ,lv_p0710 type standard table of p0710 ,lv_p2001 type standard table of p2001 .
data: ls_p0001 type p0001,ls_p0002 type p0002,ls_p0007 type p0007 ,ls_p0521 type p0521 ,ls_p0710 type p0710 ,ls_p2001 type p2001 .
data: row_index type sy-tabix,del_index type sy-tabix.
data: lcx_root type ref to cx_root.
fILL THE E1PITYP
try.
Keep the segments which have changed date greater than last run date in update mode
read table idoc_data into wa_idoc_data_x with key segnam = 'E1PITYP'.
assign wa_idoc_data_x-sdata to <wplog> casting type e1pityp.
ixxxx = <wplog>.
loop at idoc_data into wa_idoc_data_x where segnam = 'E1PLOGI'.
row_index = sy-tabix + 1.
assign wa_idoc_data_x-sdata to <wplog1> casting type e1plogi.
iyyyy = <wplog1>.
sgmnt_e1pityp-plvar = ixxxx-plvar.
sgmnt_e1pityp-otype = ixxxx-otype.
sgmnt_e1pityp-objid = iyyyy-objid.
sgmnt_e1pityp-infty = '0001'.
sgmnt_e1pityp-begda = ixxxx-begda.
sgmnt_e1pityp-endda = ixxxx-endda.
clear ls_idoc_data.
ls_idoc_data-segnam = 'E1PITYP'.
ls_idoc_data-sdata = sgmnt_e1pityp.
insert ls_idoc_data into idoc_data index row_index.
APPEND t_idoc_data .
Get the ZZSWISSREID
sort lv_p0001 by begda descending.
read table lv_p0001 into ls_p0001 index 1.
sgmnt_hcms_pi-zzswissreid = ls_p0001-zzswissreid.
Get the custom data from IT0002
sort lv_p0002 by begda descending.
read table lv_p0002 into ls_p0002 index 1.
sgmnt_hcms_pi-zzglobalid = ls_p0002-zzglobalid.
sgmnt_hcms_pi-zzsource_id = ls_p0002-zzsource_id.
sgmnt_hcms_pi-zzlegacy_emp_id = ls_p0002-zzlegacy_emp_id.
ls_idoc_data-segnam = 'ZHCMS_PI_SEGMENT' .
ls_idoc_data-sdata = sgmnt_hcms_pi.
row_index = row_index + 1.
insert ls_idoc_data into idoc_data[] index row_index.
clear : lv_p2001[] , lv_p0001[] , lv_p0002[] , lv_p0710[] ,lv_p0007[], lv_p0521[], ls_p2001 , ls_p0001 , ls_p0002 , ls_p0710 ,ls_p0007, ls_p0521 .
APPEND t_idoc_data.
endloop.
Thanks
Bala Duvvuri
Similar Messages
-
Sending a script in mail (outside SAP)
Hi,
Currently i am sending my mail to ids in SAP. so that i am able to do straightaway by giving device as 'mail'. please check code below.
CALL function 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'MAIL'
DIALOG = SPACE
FORM = 'ZRRS_VENDOR_REM' "HEADER-TDFORM
LANGUAGE = 'E'
OPTIONS = OPTIONS
MAIL_RECIPIENT = RECIPIENT_ID
MAIL_APPL_OBJECT = APPL_OBJECT_ID
But now i have to send the same script outside SAP. What changes do i have to make. I think i have to use SO_NEW_DOCUMENT_SEND_API1 but how. And i dont want to send any internal table. I just want to send whatever is there in SAP script..
Can some one advice.
Thanks in Advance.check RSTXPDF4/5.
process will like this.
1.capture the OTF code of the Script.
like this
<b>options-tdgetotf = 'X'.</b>.
2.
* Data for ESS scenario
call function 'CLOSE_FORM'
IMPORTING
RESULT = result
RDI_RESULT = rdi
TABLES
OTFDATA = OTF_TABLE
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
others = 3.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
* MAX_LINEWIDTH = 132
* ARCHIVE_INDEX = ' '
* COPYNUMBER = 0
* ASCII_BIDI_VIS2LOG = ' '
IMPORTING
BIN_FILESIZE = LEN_OUT
* BIN_FILE =
TABLES
OTF = otf_table
LINES = pdf
* EXCEPTIONS
* ERR_MAX_LINEWIDTH = 1
* ERR_FORMAT = 2
* ERR_CONV_NOT_POSSIBLE = 3
* ERR_BAD_OTF = 4
* OTHERS = 5
here u will get data in PDF foramt.
after that u can send the data .
Regards
prabhu -
Logo Problem While sending the smart form as an attachment via Email
Hi ,
I am using the FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send the smartforma as an attachement into the mailbox . it is sent correctly but the COLOR LOGO are not coming correctlly .
I checked the OTF to PDF file is getting converted correctly .i.e. if i am downloading the foem then it is displaying correctly , but in case of sending it to mailbox as an attached PDF file ,the logo are not comming correctly ,
If anybody faced such type of problem can u please clarify .
I am thinking the problem is in FM SO_NEW_DOCUMENT_ATT_SEND_API1 . this FM is not sending the Attached PDF file correctly .
All the TExt/variables are displaying correctly in the PDF file except the LOGO.while opening the PDF file one Warnng message is getting displayed : "An error occured while opening the Image" .
PLease help ..
Thanks,
sachiHi,
Edit your logo as 256 color bit map image and save it and upload into SE78,
And also better to use this FM :SO_DOCUMENT_SEND_API1 it is good for new versions.
thanks,
venkat.
Edited by: Satya venkat Rao.R on Dec 13, 2011 6:02 AM -
Any standard process to update Sales Order in SAP via XI / Idoc ?
Hello,
Currently one of our end customer is creating Sales Order in Oracle system. Once the Order is created there, they send the Order information to our XI system via flat file. XI system processes the flat file and then it calls order creation function using rfc / BAPI - BAPI_SALESORDER_CREATEFROMDAT2. This works just fine.
But now the customer wants an ability to update sales order, cancel certain line or even cancel the whole order in their Orcale system. And once that happens, they want the same thing to happen in SAP via some kind of interface automatically in the background.
So my question is :
what is the best way to do it ?
Is it possible to do via idoc ? The reason I am asking it via idoc is because it sounds that's the most standard way of doing it in SAP.
What idocs can I use ?
Has any one implemented such interface ? And if so, can you share some info ?
Any response is highly appreciate.
thanks,
DipankarI woudl suggest you check ORDERS05 IDOC type (ORDCHG message type).
FM - idoc_input_ordchg -
502 error in sending the request from F5 to SAP PORTAL
Hi All,
I face a problem in NW04S SP13 Level:
I have my Production and Development landscape where I get an HTTP Request from a Oblix Server and pass it to SAP ENTERPRISE PORTAL through F5.
In my Development Landsacpe this request is process by SAP PORTAL
but in my Production landscape it Intermittently fails.
The Only difference between my Production and Development landscape is I have multiple portal instances in my Production where as I have a single instance in my Dev.
When in my Dev landscape I login to portal and Open a ESS - Benefits application it works fine but in the Production Landscape it throws 502 ERROR.
I tried Routing the HTTP Request from my Dev Environment's F5 to Production Environments Portal, and even then it throws error Intermittently.
But If I Pass the request from my Production Environment's F5 to Development Environments Portal it works perfectly fine.
What might be the issue?
Any Idea? Your help is really appreciated.
Thanks & Regards,
sirisha.RSHi Rk,
I am not sure about it. Will talk to the Admin and get back to you.
Thanks & Regards,
Sirisha.RS -
Can I make it so they send the entire form back to me via email?
Am I understanding this right that the email back to me function will only email the information of the cells they've entered, not the entire document?
Well I need to have the entire document with info in the cells, not just the info itself.
Is there any way to set it so that when the other person emails me this document back I receive the whole thing?
I am doing things like Independent Contractors Agreement, model release etc. So I'll need an individual file & forms on every person, not just the info.
Thanks.Still Learning02 wrote:
Print the form using file/print. Then instead of selecting your printer, select adobe pdf. This will print the form to a pdf you can open in Acrobat. Then there is a forms menu that will allow you to add the fields. Once you have completed setting up the fields, you go to the advanced menu and enable the rights in reader. This will allow the user to save the form and send it back to you. Or you could create a submit button to email the response back to you.
We've been talking about this in the Acrobat forum. This is a duplicate thread.
http://forums.adobe.com/thread/528275?tstart=0 -
How can I send the Location data to my computer via USB?
I would like to use my iPhone 4 as if it were an incar GPS hooked up to my laptop and receive the current coordinates and perhaps the raw data from the compass accelerometer and orientation-feature. I don't want anything fancy in terms of the user interface. I just want a logfile with something similar to the following:
Header 1
Header 2
Header 3
Header 4
Header 5
Header 6
Header 7
Header 8
Date & Time Stamp
x coordinates
y coordinates
z coordinates
orientation/inclination
accelerometer
compass heading
misc
with as many rows as is needed or limited by the maximum file size of the OS or HDD format.
I want to customize the sampling rate say from 0.5 hertz to 10 hertz in other words one entry every two seconds up to 10 entries per second. I would like to post-process this information in mathematica or matlab.I found the app that I'm looking for it's called sensor kinetics pro and the link is
https://itunes.apple.com/us/app/sensor-kinetics-pro/id623633248
Message was edited by: lightninginajar -
Hi i'm enhanced infotype 0002, but i had to change the length of a field, and i'm having problems with activation.
I tried to delete ci_p0002, but after that, i can`'t activate pa0002.
the table still have that include. How can i delete it??
Should i do anything else?You should not delete ci_p0002.. instead in SE11 double click on ci_p0002 & then delete the custom fields.. you can then activate the table.. be sure to run the database utility via Tcode SE14..
Whenever you have to add/delete/change fields on an infotype go via PM01.
~Suresh -
Installation of Enhancement Package 1 in SAP NetWeaver 7.0
Hello,
We have install the Enhancement Package 4 in the server ECC 6.0 with EHP3.
But, before we need install the Enhancement Package 1 in SAP NetWeaver 7.0
The actual Kernel is releae 700 level 185.
We download the kernel 701 for Windows 64 unicode with SQL, and we install in the system, when we start sap the part java don't started the process sapcpe.exe "could not be started" .
We have tried with the kernel 15 and 23 of release 701, but this don't ok.
We can connect to the part ABA and JAVA, but the Kernel isn't update, and in the console of sap the process sapcpe.exe is in red with the message could not be started"
The actual level of the server is:
SAP_ABA 700 0016 SAPKA70016
SAP_BASIS 700 0016 SAPKB70016
ST-PI 2005_1_700 0005 SAPKITLQI5
PI_BASIS 2005_1_700 0015 SAPKIPYJ7F
SAP_BW 700 0017 SAPKW70017
SAP_AP 700 0012 SAPKNA7012
SAP_HR 600 0024 SAPKE60024
SAP_APPL 603 0001 SAPKH60301
EA-IPPE 400 0012 SAPKGPID12
EA-APPL 603 0001 SAPK-60301INEAAPPL
EA-DFPS 603 0000 -
EA-FINSERV 603 0000 -
EA-GLTRADE 603 0000 -
EA-HR 603 0000 -
EA-PS 603 0001 SAPK-60301INEAPS
EA-RETAIL 603 0000 -
FINBASIS 603 0001 SAPK-60301INFINBASIS
ECC-DIMP 603 0000 -
ERECRUIT 603 0001 SAPK-60301INERECRUIT
FI-CA 603 0000 -
FI-CAX 603 0000 -
INSURANCE 603 0000 -
IS-CWM 603 0000 -
IS-H 603 0000 -
IS-M 603 0000 -
IS-OIL 603 0000 -
IS-PS-CA 603 0000 -
IS-UT 603 0000 -
LSOFE 603 0000 -
SEM-BW 603 0001 SAPK-60301INSEMBW
BP-INSTASS 600V6 0000 -
BP-ERP05 603V4 0000 -
Can you help us with the error?
Kind RegardsHello,
Because when we import the packages of ECC 6.0 EPH4, the system return the error:
"OCS package SAPK-701DHINSAPBASIS requires at least Kernel Release 701 with patch number
0000"
And the package SAPK-701DHINSAPBASIS is a prerequisite for import the package with the release 604 (ehp4).
The package that we need import is:
sap basis 701
sap aba 701
pi basis 701
sap bw 701
sap bs fnd 701
webcuif 700
sap appl 604
sap hr 604
ea appl 604
ea dfps 604
ea finserv 604
ea gltrade 604
ea hr 604
ea ps 604
ea retail 604
finbasis 604
erecruit 604
lsofe 604
sem bw 604
The package are the prerequisites for import the EHP4 in the system.
Kind Regards -
Render html form & send forms's input values as params via HTTP POST
Hello,
I'm using appache commons http client to send HTTP post queries to a given url and receive HTTP response then process it.
one of the requirements of my Application is the following: one of these HTTP Post requests is supposed to return an HTML form with different html types (text filed, text area etc..) that i will need to display in my swing application. one important requirement is that i can't know in advance what the html form field types will be.. it depends on a given parameters that my application send as part of HTTP Post method (using apache http client).
I Longly searched for a simple solution to this problem . There are many solutions but each one has it's limitations :
1-i can render the html form inside a JEditorPane .but how can I collect the user entered data inside JEditorPane ? i'm not sure this swing component offers the capability to detect its html contents and more it will be difficult to know what are the values entered by user inside html form rendered by JEditorPane.
2-are there any Java Embedded browsers that offer some API to enable me detect the html form fields ,capture the data entered by user inside the html form ?
3-the solution i currently opted for is : parse html & convert html form to swing dialog. currently this solution i use works well but the cost of implementing it is high : it involves difficult parsing logic. this makes me worried .I'm not sure if i'm now using the right & easiest solution.
I need some advice on What is the simplest and clean solution to render a html form & yet be able to collect user entered inputs & send the user input values as params via java HTTP POST request ?dragzul wrote:
In my opinion, your actual solution is what you need to do. You're trying to "merge" two different kinds of view. Actually, the "easiest" way may be: if you have your data to display, you decide to show it on html or swing.Yes i believe that my current solution may be the unique one for my special requirements. when doing research about this problem i found a multitude of java libraries to convert xml to swing (ex: www.swixml.org) .However i was surprised there are no java libraries to convert HTML forms to swing dialogs -as far as i know-. this is a bit strange. The Limitation is that the developers of the server API are not Java guys and are reluctant to use an xml format that i can easily convert to swing . probably they have their own reasons as they might be using the HTML Response for some other server side work. So I was obliged to deal with an HTML stream that i need to display in my client application and process its data. in my opinion the only way to do this is by developing a HTML form to swing converter package. that's what i did now. i was only worried if i'm complicating things and if there are some easier solutions to this issue.
thanks -
How to send the email to different email addresses from Workflow
Hello,
i an not getting that how to send the email from Workflow in SAP.
plz give the steps to do that.
i have done lots of time but system is not sending the email to different email address.Hi,
lot of configuration is invloved in sending
mail to external email id. check BASIS to
configure for external mails ans also check
debug FM and see which conditions exceptions
(Document not sendis raised)
also check below code
CLEAR: DOC_CHNG, OBJTXT, OBJBIN, OBJPACK, OBJHEAD, RECLIST,
RECIPIENT_INT, DOC_SIZE,TAB_LINES.
REFRESH: OBJTXT, OBJBIN, OBJPACK, OBJHEAD, RECLIST.
OBJBIN[] = CONTENT_OUT[].
Populate e-mail title
DOC_CHNG-OBJ_NAME = 'MAIL'.
CONCATENATE 'EETS for Contract #'(245)
OIA01_TAB-EXGNUM
INTO DOC_CHNG-OBJ_DESCR SEPARATED BY SPACE.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
It is a text document
CLEAR OBJPACK-TRANSF_BIN.
The document needs no header (head_num = 0)
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
but it has a body
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
of type RAW
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
Create the attachment (the list itself)
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
It is binary document
OBJPACK-TRANSF_BIN = 'X'.
we need no header
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
but a body
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
of type PDF
OBJPACK-DOC_TYPE = 'PDF'.
OBJPACK-OBJ_NAME = 'Attachment'(239).
CONCATENATE 'EETS_' OIA01_TAB-EXGNUM '_'
IT_ZMMTACCUID-ACCTUSRID
'_' SY-DATUM '_' SY-UZEIT '.PDF'
INTO OBJPACK-OBJ_DESCR.
READ TABLE OBJBIN INDEX TAB_LINES.
DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJBIN ).
OBJPACK-DOC_SIZE = DOC_SIZE.
APPEND OBJPACK.
Get e-mail address
CLEAR IT_ADDRESS.
READ TABLE IT_ADDRESS WITH KEY ACCTID = IT_ZMMTACCUID-ACCTUSRID
BINARY SEARCH.
IF SY-SUBRC = 0.
RECIPIENT_INT-ADDRESS = IT_ADDRESS-SMTP_ADR.
ENDIF.
*Send email to external mail address
RECLIST-RECEIVER = RECIPIENT_INT.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
CLEAR RECLIST.
*Send email to SAP Office mail address
RECLIST-RECEIVER = IT_ZMMTACCUID-ACCTUSRID.
RECLIST-REC_TYPE = 'B'.
APPEND RECLIST.
CLEAR RECLIST.
SEND THE DOCUMENT BY CALLING THE SAPOFFICE API1 MODULE
FOR SENDING DOCUMENTS WITH ATTACHMENTS
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = doc_chng
put_in_outbox = 'X'
importing
sent_to_all = sent_to_all
tables
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
exceptions
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
others = 99.
also check
https:/Re: mail sending problem
Regards
amole -
How to Send the material master data from sap4.6c to ECC6.0
Hi
Friends this is shalini Shah, i got one requirement that is
how to send the materail master data from SAP 4.6C to ECC6.0 using XI.
i know the file to idoc and idoc to file scenarios but i don't know this one.
please help me friends, Thanks in advance.
Regards
Shalini ShahHi Shalini,
To trigger IDoc these configurations should be done in the SAP 4.6, XI and ECC 6.0.
SAP XI
1) RFC Destination (SM59)
a) Choose create.
b) Specify the name of the RFC destination
c) Select connection type as 3 and save
d) In the technical settings tab enter the details SAP SID/URL and system number#.
e) Enter the Gateway host as same details above SID/URL.
f) Gateway service is 3300+system number#.
g) In the Logon /Security tab, enter the client user & Password details of Destination system.
h) Test the connection and remote logon.
2) Create Port (IDX1)
a) Select create new button
b) Enter the port name as SAP+SID (The starting char should be SAP)
c) Enter the destination client.
d) Enter the RFC Destination created in SAP R/3 towards other system.
e) Save
3) Load Meta Data for IDOC (IDX2)
a) Create new
b) IDOC Message Type
c) Enter port created in IDX1.
SAP R/3 (4.6 and ECC 6.0)
1) RFC Destination (SM59)
a) Choose create.
b) Specify the name of the RFC destination
c) Select connection type as 3 and save
d) In the technical settings tab enter the details SAP SID/URL and system number#.
e) Enter the Gateway host as same details above SID/URL.
f) Gateway service is 3300+system number#.
g) In the Logon /Security tab, enter the client user & Password details of Destination system.
h) Test the connection and remote logon.
2) Create Port (We21)
a) First Select Transactional RFC and then click create button
b) Enter the destination port name as SAP+SID (The starting char should be SAP)
c) Enter the destination client.
d) Enter the RFC Destination created in SAP R/3 towards other system.
e) Save
3) Create Partner Profile (WE20)
a) Create New
b) Create the Partner no. name as same the logical system name of the destination system.
c) Select Partner type LS
d) Enter details for Type: US/USER, Agent, and Lang.
e) Click on the + button to select the message type.
f) Select Partner no. and LS which ever create above.
g) Select Message type
h) Select Process code related to the Message type.
I) save.
Also go ther the Blog <a href="/people/swaroopa.vishwanath/blog/2007/01/22/ale-configuration-for-pushing-idocs-from-sap-to-xi Configuration for Pushing IDOC's from SAP to XI</a> By Swaroopa Vishwanath
U need to import the IDoc types both inbound and outbound to XI.
1. Create Inbound and Outbound Message interface.
2. Do one to one message mapping.
3. Define an Interface mapping.
ID:
1. Create 1 Sender aggrement.
2. Create 1 Receiver aggrement.
3. Define 1 RD and ID.
4. Only create an receiver IDoc CC.
Regards
San
<a href="Remember to set the thread to solved when you have received a solution to set the thread to solved when you have received a solution</a>
Where There is a <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/weblogs?blog=/weblogs/topic/16">blog</a> there is a Way. -
Sending email's outside SAP with grids
Hi guys,
I already use the function "SO_DOCUMENT_SEND_API1" to send emails outside SAP, but i need to insert text in to a table, format color's, letter sizes, etc
Can i send a email in html format using this function?
Can you tell me if this function can do that? If not can you tell me one that can format the text in every way that i want?
Any help would be apreciated.
Thank you all.the below is logic for sending the salary slip to the employees email id ....
here you can replace the logic of it .
there are some internal table declared for header of the file name for the file size and for the error message and for converting it in to pdf ...etc .....
DATA W_OPTIONS LIKE ITCPO OCCURS 0 WITH HEADER LINE.
DATA : z_itcpp LIKE itcpp OCCURS 0 WITH HEADER LINE.
DATA : otfdt like ITCOO OCCURS 0 WITH HEADER LINE.
DATA : pdfdt like TLINE OCCURS 0 with header line.
DATA: NUMBYTES TYPE I.
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: TAB_LINES LIKE SY-TABIX.
DATA: Begin of i_errors occurs 0,
type(1) type c,
descr(100) type c,
End of i_errors.
w_options-tdprinter = 'POSTSCPT'.
W_options-TDRDIDEV = 'XP45'.
W_options-TDGETOTF = 'X'.
APPEND W_options.
call function 'OPEN_FORM'
exporting
device = 'PRINTER'
dialog = ' '
form = 'ZHRPAYSLIP'
language = sy-langu
options = w_options
* IMPORTING
* LANGUAGE =
* NEW_ARCHIVE_PARAMS =
* RESULT =
exceptions
canceled = 1
device = 2
form = 3
options = 4
unclosed = 5
mail_options = 6
archive_error = 7
invalid_fax_number = 8
more_params_needed_in_batch = 9
others = 10 .
CALL FUNCTION 'CLOSE_FORM'
* IMPORTING
* RDI_RESULT =
TABLES
OTFDATA = otfdt
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
OTHERS = 4.
EXPORT otfdt TO MEMORY ID 'PDFT'.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
* MAX_LINEWIDTH = 132
* ARCHIVE_INDEX = ' '
* COPYNUMBER = 0
* ASCII_BIDI_VIS2LOG = ' '
* PDF_DELETE_OTFTAB = ' '
IMPORTING
BIN_FILESIZE = NUMBYTES
* BIN_FILE =
TABLES
otf = otfdt
lines = pdfdt
* 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 .
Refresh OBJTXT. clear OBJTXT.
Refresh OBJPACK. clear OBJPACK.
Refresh objbin. clear objbin.
Refresh OBJHEAD. clear OBJHEAD.
Refresh RECLIST. Clear RECLIST.
* Creation of the document to be sent
* File Name
DOC_CHNG-OBJ_NAME = 'PAYSLIP'.
* Mail Subject
DOC_CHNG-OBJ_DESCR = 'Payslip'.
* Mail Contents
OBJTXT = 'This e-mail was sent from an automated system...'.
APPEND OBJTXT.
OBJTXT = 'Do not reply to this message.'.
APPEND OBJTXT.
OBJTXT = 'Please open the attachment to view the Payslip'.
APPEND OBJTXT.
OBJTXT = ''.
APPEND OBJTXT.
if not msgtxt1 is initial.
OBJTXT = msgtxt1.
APPEND OBJTXT.
endif.
if not msgtxt2 is initial.
OBJTXT = msgtxt2.
APPEND OBJTXT.
endif.
if not msgtxt3 is initial.
OBJTXT = msgtxt3.
APPEND OBJTXT.
endif.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
* Creation of the entry for the compressed document
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
* Creation of the document attachment
CALL FUNCTION 'QCE1_CONVERT'
TABLES
t_source_tab = pdfdt
t_target_tab = objbin
EXCEPTIONS
convert_not_possible = 1
OTHERS = 2.
describe table objbin lines tab_lines.
OBJHEAD = 'Payslip.PDF'.
APPEND OBJHEAD.
** Creation of the entry for the compressed attachment
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 1.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'PDF'.
OBJPACK-OBJ_NAME = 'Payslip'.
OBJPACK-OBJ_DESCR = 'Payslip'.
OBJPACK-DOC_SIZE = TAB_LINES * 255.
APPEND OBJPACK.
* Completing the recipient list
* Read table i_pa0105 with key pernr = pernr-pernr binary search.
loop at i_pa0105 where pernr = pernr-pernr and USRTY = '0010'.
endloop.
if sy-subrc = 0.
RECLIST-RECEIVER = i_pa0105-USRID_LONG.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
endif.
if RECLIST[] is initial.
loop at i_pa0105 where pernr = pernr-pernr and USRTY = 'MAIL'.
endloop.
if sy-subrc = 0.
RECLIST-RECEIVER = i_pa0105-USRID.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
endif.
endif.
if not RECLIST[] is initial.
* Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = ''
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
CASE SY-SUBRC.
WHEN 0.
LOOP AT RECLIST.
* Concatenate pernr-pernr '-' RECLIST-RECEIVER(48)
into error1.
IF RECLIST-RETRN_CODE = 0.
* Concatenate error1 ': The document was sent' into
error1.
i_errors-descr = pernr-pernr.
i_errors-type = 'S'.
append i_errors.
ELSE.
Concatenate error1 ': The document could not be
sent' into error1.
i_errors-descr = error1.
i_errors-type = 'E'.
append i_errors.
ENDIF.
ENDLOOP.
WHEN 1.
Concatenate pernr-pernr '-' RECLIST-RECEIVER(48) into
error1.
Concatenate error1 ': No authorization for sending to the
recipients' into error1.
i_errors-descr = error1.
i_errors-type = 'E'.
append i_errors.
WHEN 2.
Concatenate pernr-pernr '-' RECLIST-RECEIVER(48) into
error1.
Concatenate error1 ': Document could not be sent to the
recipient' into error1.
i_errors-descr = error1.
i_errors-type = 'E'.
append i_errors.
WHEN 4.
Concatenate pernr-pernr '-' RECLIST-RECEIVER(48) into
error1.
Concatenate error1 ': No send authorization' into error1.
i_errors-descr = error1.
i_errors-type = 'E'.
append i_errors.
WHEN OTHERS.
Concatenate pernr-pernr '-' RECLIST-RECEIVER(48) into
error1.
Concatenate error1 ': Error occurred while sending' into
error1.
i_errors-descr = error1.
i_errors-type = 'E'.
append i_errors.
ENDCASE.
else.
error1 = pernr-pernr.
* Concatenate error1 ': Maintain Infotype 0105.' into error1.
i_errors-descr = error1.
i_errors-type = 'M'.
append i_errors.
endif.
reward points ....
Girish -
Error in sending email to users(outside sap)
Hello experts,
We just transported my program to QAS server and I just tested it now if my program to send messages to emails outside works. Unfortunately, it doesn't. I am using FM SO_NEW_DOCUMENT_SEND_API1 and the sy-subrc = 2 whcih means document not sent. Also, there is window that popped up that says
Database error for <ADDR_PERS_COMP_COMM_GET> <0>
Again, thank you guys for all your help and take care!Hi,
Check this
Sending mail To Standard SAP MAIL Box
http://www.sap-img.com/abap/sending-email-with-attachment.htm
SCOT settings
http://www.sap-img.com/basis/basis-faq.htm
Sending External email through SAP
http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
http://www.sapdevelopment.co.uk/reporting/email/emailhome.htm\
http://www.sap-img.com/abap/sending-email-with-attachment.htm
Sample Code
Sending External email through SAP
What is the FM for sending the external email through SAP by attaching layout set to it?
These are the FM for sending external email :-
SO_DOCUMENT_SEND_API1
SAPoffice: Send new document with attachments via RFC
SO_NEW_DOCUMENT_ATT_SEND_API1
(In 4.6C only, You can go to SE37 and click the documentation on how to use it. A sample program is provided there.)
SAPoffice: Send new document with attachments via RFC
Note : If you are using FM SO_NEW_DOCUMENT_ATT_SEND_API1 then Export Parameter DOCUMENT_DATA-OBJ_DESCR contains the Subject.
SO_NEW_DOCUMENT_SEND_API1
SAPoffice: Send new document
How to send a report to an external mail-id?
<b>
Try this sample code :-</b>
REPORT ZREPORT_TO_EMAIL NO STANDARD PAGE HEADING LINE-SIZE 200.
DATA : BEGIN OF ITAB OCCURS 0,
PERNR LIKE PA0001-PERNR,
ENAME LIKE PA0001-ENAME,
END OF ITAB.
DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,
receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
listobject LIKE abaplist OCCURS 10,
compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
w_object_hd_change LIKE sood1,
compressed_size LIKE sy-index.
START-OF-SELECTION.
SELECT PERNR ENAME
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM PA0001
WHERE PERNR < 50.
LOOP AT ITAB.
WRITE :/02 SY-VLINE , ITAB-PERNR, 15 SY-VLINE , ITAB-ENAME, 50
SY-VLINE.
ENDLOOP.
Receivers
receiver_list-recextnam = '[email protected]'. "-->
EMAIL ADDRESS
RECEIVER_list-RECESC = 'E'. "<-
RECEIVER_list-SNDART = 'INT'."<-
RECEIVER_list-SNDPRI = '1'."<-
APPEND receiver_list.
General data
w_object_hd_change-objla = sy-langu.
w_object_hd_change-objnam = 'Object name'.
w_object_hd_change-objsns = 'P'.
Mail subject
w_object_hd_change-objdes = 'Message subject'.
Mail body
APPEND 'Message content' TO message_content.
Attachment
CALL FUNCTION 'SAVE_LIST'
EXPORTING
list_index = '0'
TABLES
listobject = listobject.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
compressed_size = compressed_size
TABLES
in = listobject
out = compressed_attachment.
DESCRIBE TABLE compressed_attachment.
CLEAR packing_list.
packing_list-transf_bin = 'X'.
packing_list-head_start = 0.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = sy-tfill.
packing_list-objtp = 'ALI'.
packing_list-objnam = 'Object name'.
packing_list-objdes = 'Attachment description'.
packing_list-objlen = compressed_size.
APPEND packing_list.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = w_object_hd_change
object_type = 'RAW'
owner = sy-uname
TABLES
objcont = message_content
receivers = receiver_list
packing_list = packing_list
att_cont = compressed_attachment.
<b>
2nd Program</b>
REPORT ZSENDEXTERNAL.
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: TAB_LINES LIKE SY-TABIX.
Creation of the document to be sent
File Name
DOC_CHNG-OBJ_NAME = 'SENDFILE'.
Mail Subject
DOC_CHNG-OBJ_DESCR = 'Send External Mail'.
Mail Contents
OBJTXT = 'Minimum bid : $250000'.
APPEND OBJTXT.
OBJTXT = 'A representation of the pictures up for auction'.
APPEND OBJTXT.
OBJTXT = 'was included as attachment.'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
Creation of the entry for the compressed document
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
Creation of the document attachment
(Assume that the data in OBJBIN is in BMP format)
*OBJBIN = ' \O/ '. APPEND OBJBIN.
*OBJBIN = ' | '. APPEND OBJBIN.
*OBJBIN = ' / \ '. APPEND OBJBIN.
*DESCRIBE TABLE OBJBIN LINES TAB_LINES.
*OBJHEAD = 'PICTURE.BMP'.
*APPEND OBJHEAD.
Creation of the entry for the compressed attachment
*OBJPACK-TRANSF_BIN = 'X'.
*OBJPACK-HEAD_START = 1.
*OBJPACK-HEAD_NUM = 1.
*OBJPACK-BODY_START = 1.
*OBJPACK-BODY_NUM = TAB_LINES.
*OBJPACK-DOC_TYPE = 'BMP'.
*OBJPACK-OBJ_NAME = 'PICTURE'.
*OBJPACK-OBJ_DESCR = 'Representation of object 138'.
*OBJPACK-DOC_SIZE = TAB_LINES * 255.
*APPEND OBJPACK.
Completing the recipient list
RECLIST-RECEIVER = '[email protected]'.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
*RECLIST-RECEIVER = 'SAPUSERNAME'.
*RECLIST-REC_TYPE = 'P'.
*APPEND RECLIST.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
CASE SY-SUBRC.
WHEN 0.
WRITE: / 'Result of the send process:'.
LOOP AT RECLIST.
WRITE: / RECLIST-RECEIVER(48), ':'.
IF RECLIST-RETRN_CODE = 0.
WRITE 'The document was sent'.
ELSE.
WRITE 'The document could not be sent'.
ENDIF.
ENDLOOP.
WHEN 1.
WRITE: / 'No authorization for sending to the specified number',
'of recipients'.
WHEN 2.
WRITE: / 'Document could not be sent to any recipient'.
WHEN 4.
WRITE: / 'No send authorization'.
WHEN OTHERS.
WRITE: / 'Error occurred while sending'.
ENDCASE.
Message was edited by: Manoj Gupta -
How to send the sap data to mobile service through custmozed object
Dear ABAPer,
I have developed the customized object. But , I want to send the data to radio frequency service( Example: Mobile No ) through sap customized object.
if you have any idea , please send the document with example roughly.
advance thanks.
with best regards,
velmurugan.SHello,
you can create a Report that accepts the search parameters from the Forms mask and generates a PDF. You also have the option to send the report via mail.
Personally I would generate the report with a tool like as_pdf
http://technology.amis.nl/2012/04/11/generating-a-pdf-document-with-some-plsql-as_pdf_mini-as_pdf3/
Then you can send the mail using utl_mail or utl_smtp.
www.google.com/search?q=site:forums.oracle.com+utl_mail+utl_smtp
Regards
Marcus
Maybe you are looking for
-
Active Directory Domain Name Convention
Hi All I'm creating a brand new domain for a new company I have just started at. We currently use Office 365 so sharepoint and Exchange are both in the cloud and our website is also outsourced. I am now rolling out our first DC on Windows 2012 Server
-
Mail.app: Select outgoing (SMTP) server per message?
Dear community members, I'm looking for a solution to the following problem: I do have multiple e-mail accounts which are configured in the following way: One of them is the master account (let's say [email protected]) added to Mail.app as a POP acco
-
W530 Nvidia 2100m Projector Issues
Hi, I am having problems when connecting to projectors. For some projectors, it only allows me to connect to them when I choose "only projector" mode, not extended or duplicate. Even when I can connect, videos often are unplayable because intense vid
-
I deleted aperture and now my sistem is acting crazy.The dock disappeared and almost all icons are gone except for their names.I have an important project for tomorrow and I desperately need help fixing it.Can anyone help me please?
-
TS3274 I have an ipad and it is disabled, therefore how do I enable this pad?
I have an ipad and it is disabled, therefore how do I enable the pad?