Problem using function SO_DOCUMENT_SEND_API1,
Dear All,
I used this function for attach the txt file and send the e-mail to relate user.
Now, My output file print out all the data in the same line.
how i can split the data line by line ?
below is my coding.
Please kindly to help me.
Regards,
Luke
PERFORM send_file_as_email_attachment
TABLES it_mess_bod
it_mess_att
USING P_TITLE
'FIX'
gd_attachment_name
gd_attachment_desc
p_FROM
'INT'
CHANGING gd_error
gd_reciever.
*& Form send_file_as_email_attachment
text
-->IT_MESSAGE text
-->IT_ATTACH text
-->P_MTITLE text
-->P_FORMAT text
-->P_FILENAME text
-->P_ATTDESCRIPTION text
-->P_SENDER_ADDRESS text
-->P_SENDER_ADDRES_TYPE text
-->P_ERROR text
-->P_RECIEVER text
FORM send_file_as_email_attachment TABLES it_message
it_attach
USING p_email
USING 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.
LOOP AT itab_mailto.
t_receivers-receiver = itab_mailto-smtp_addr.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
t_receivers-copy = ''.
APPEND t_receivers.
ENDLOOP.
LOOP AT S_CC.
t_receivers-receiver = S_CC-low.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
t_receivers-copy = 'X'.
APPEND t_receivers.
ENDLOOP.
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. "send_file_as_email_attachment
Hi,
Try This ....
DATA: l_tab_lines TYPE i,
l_error TYPE string.
CONSTANTS : l_c_name(13) TYPE c VALUE 'HC Error File', "#EC NOTEXT
l_c_255(255) TYPE c VALUE '255',
l_c_txt(3) TYPE c VALUE 'TXT'.
DATA: lt_reclist TYPE STANDARD TABLE OF somlreci1, "Recipients
lt_objpack TYPE STANDARD TABLE OF sopcklsti1,
lt_objhead TYPE STANDARD TABLE OF solisti1,
lt_objtxt TYPE STANDARD TABLE OF solisti1, "Body of EMail
lt_objbin TYPE STANDARD TABLE OF solisti1."Attachment of EMail
DATA: l_wa_doc_chng TYPE sodocchgi1, "attributes of document to send
l_wa_reclist LIKE LINE OF lt_reclist,
l_wa_objpack LIKE LINE OF lt_objpack,
l_wa_obj LIKE LINE OF lt_objhead.
Begin of Insert CHRK941885
DATA :
l_hex LIKE solix,
lt_contents_hex LIKE STANDARD TABLE OF solix ,
conv TYPE REF TO cl_abap_conv_out_ce,
l_buffer TYPE xstring,
l_hexa(510) type x.
End of Insert CHRK941885
Fill attachment contents: body of email message
CONCATENATE 'Click on attachment to view the extract file :'(t01)
l_c_name INTO l_wa_obj-line SEPARATED BY space.
APPEND l_wa_obj TO lt_objtxt. CLEAR l_wa_obj.
APPEND l_wa_obj TO lt_objtxt. CLEAR l_wa_obj.
DESCRIBE TABLE lt_objtxt LINES l_tab_lines.
Information about the email body data
CLEAR l_wa_objpack-transf_bin. "Attachment not binary
l_wa_objpack-head_start = 1.
l_wa_objpack-head_num = 0.
l_wa_objpack-body_start = 1.
l_wa_objpack-body_num = l_tab_lines * l_c_255.
l_wa_objpack-doc_type = 'TXT'.
APPEND l_wa_objpack TO lt_objpack.
CLEAR :l_wa_objpack.
Move error records to the file, semi-colon delimited
LOOP AT e_error INTO g_error.
CONCATENATE g_error-pernr ';'
g_error-nachn ';'
g_error-vorna ';'
g_error-werks ';'
g_error-persg ';'
g_error-eligr ';'
g_error-msg INTO l_error.
APPEND l_error TO lt_objbin.
ENDLOOP.
Document type is TXT
l_wa_objpack-doc_type = l_c_txt.
APPEND object_header.
CALL FUNCTION 'SO_RAW_TO_RTF'
TABLES
objcont_old = lt_objbin
objcont_new = lt_objbin.
Begin of Insert CHRK941885
LOOP AT lt_objbin into l_error.
conv = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' endian = 'B').
CALL METHOD conv->write( data = l_error ).
l_buffer = conv->get_buffer( ).
move l_buffer to l_hexa.
move l_hexa to l_hex-line.
APPEND l_hex to lt_contents_hex.
ENDLOOP.
End of Insert CHRK941885
File name for attachment
l_wa_obj = l_c_name.
APPEND l_wa_obj TO lt_objhead.
CLEAR l_wa_obj.
DESCRIBE TABLE lt_objbin LINES l_tab_lines.
Creation of the entry for the compressed attachment
l_wa_objpack-transf_bin = 'X'.
l_wa_objpack-head_start = 1.
l_wa_objpack-head_num = 1.
l_wa_objpack-body_start = 1.
l_wa_objpack-obj_name = l_c_name.
l_wa_objpack-obj_descr = l_c_name.
l_wa_objpack-body_num = l_tab_lines.
l_wa_objpack-doc_size = l_tab_lines * l_c_255.
APPEND l_wa_objpack TO lt_objpack.
CLEAR l_wa_objpack.
Completing the recipient list
LOOP AT s_email.
l_wa_reclist-receiver = s_email-low.
l_wa_reclist-express = 'X'.
l_wa_reclist-rec_type = 'U'.
APPEND l_wa_reclist TO lt_reclist.
CLEAR l_wa_reclist.
ENDLOOP.
Document to send
MOVE 'Health Risk Assessment Batch extract'(h01)
TO l_wa_doc_chng-obj_descr.
Send mail as a confidential
l_wa_doc_chng-sensitivty = 'P'.
Send the document
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = l_wa_doc_chng
put_in_outbox = ' '
commit_work = 'X'
TABLES
packing_list = lt_objpack
object_header = lt_objhead
contents_bin = lt_objbin " Comment CHRK941885
contents_txt = lt_objtxt
contents_hex = lt_contents_hex " Insert CHRK941885
receivers = lt_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 s000(oo) WITH 'Email sent to recipients'(s12).
To refresh SAP Work Office so that mail can be recieved immediataly.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = ''
AND RETURN.
ELSE.
MESSAGE e000(oo) WITH 'Problem sending Email.'(e02).
ENDIF.
Similar Messages
-
Problem using FM SO_DOCUMENT_SEND_API1
hi gurus,
I'm having a hard time trying to get the right result using FM SO_DOCUMENT_SEND_API1 to send and attachment with email.
I collected a number of lines (8252 lines !) into an internal table defines as followed :
DATA : wt_report TYPE TABLE OF SOLISTI1 WITH HEADER LINE.
Now I would like to send the content of each line as email attachement as EITHER .xls OR .txt files. (for now I get an email with attachment but canno view the content of the email)
Here is my code :
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = ws_doc_data
PUT_IN_OUTBOX = 'x'
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
SENDER_ID =
tables
packing_list = it_packing_list <----
what is this supposed to contain ??
OBJECT_HEADER =
CONTENTS_TXT = wt_report <------ Here is my itab with 8252 lines
CONTENTS_HEX = wt_report
OBJECT_PARA =
OBJECT_PARB =
receivers = wt_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
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thank you so much for help, <removed_by_moderator>
C.K.
Edited by: Julius Bussche on Jul 8, 2008 4:36 PMhi check this....
REPORT ZMAIL.
TABLES: ekko.
PARAMETERS: p_email TYPE somlreci1-receiver .
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
wa_ekpo TYPE t_ekpo.
TYPES: BEGIN OF t_charekpo,
ebeln(10) TYPE c,
ebelp(5) TYPE c,
aedat(8) TYPE c,
matnr(18) TYPE c,
END OF t_charekpo.
DATA: wa_charekpo TYPE t_charekpo.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
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,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_xls_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
perform populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp aedat matnr
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekpo.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM build_xls_data_table.
data: ld_store(50) type c. "Leading zeros
CONSTANTS: con_cret(5) TYPE c VALUE '0D', "OK for non Unicode
con_tab(5) TYPE c VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR' INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT it_ekpo INTO wa_charekpo.
*Modification to retain leading zeros
inserts code for excell REPLACE command into ld_store
=REPLACE("00100",1,5,"00100")
concatenate '=REPLACE("' wa_charekpo-ebelp '",1,5,"'
wa_charekpo-ebelp '")' into ld_store .
concatenate ld_store into .xls file instead of actual value(ebelp)
CONCATENATE wa_charekpo-ebeln ld_store wa_charekpo-aedat wa_charekpo-matnr INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables pit_message
pit_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.
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[] = pit_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.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test ekpo records'.
APPEND it_message.
endform. " POPULATE_EMAIL_MESSAGE_BODY -
Problem using functions in discov
Hi all,
I`m creating a report and I`m using 2 complex folders and 3 database functions as calculations.
when I use the first two the report works fine, but when I use the third function the report stop working.
works with almost 79000 rows. is it possible that the problem is I am using too much functios?
thanx for your time.Another check would be to get the SQL generated by the worksheet, and run it in SQL Plus to see whether there are any errors that pop up there.
-
Serious Problem using function
Hello mates,
I new to Oracle JDBC and im working on a project that uses Oracle as DB. There are some stored procedures and functions that i have to access , but some of them are getting me nervous. The problem is that when i call a simple function returning a simple CHAR i get the result OK, but when i call two specific functions that also returns CHAR i get null as result, the problem is that when i call them from sqlplus and from Perl i get the result OK, but i call the like SELECT USR_ONLINE.MONTAPOP(160008,'') AS TEST FROM DUAL. Plz help me solve this problem cause my project is stopped because of that.
Ty Very much. Here comes my code:
String sql ="{ ? = call USR_ONLINE.MONTAPOP(160008,'') }";
OracleCallableStatement cstmt = (OracleCallableStatement) con.prepareCall(sql);
cstmt.registerOutParameter(1,Types.CHAR);
cstmt.execute();
System.out.println(cstmt.getString(1));Bruno,
I get the impression that English is not your first language, so excuse me if I have misunderstood your question.
From the code you posted, it looks like the "MONTAPOP" function takes two parameters -- a NUMBER and a VARCHAR2, I believe -- and that you are calling the function with a null second parameter.
If the above is correct, then I suggest the following:
[Note: Uncompiled and untested.]
String sql ="{? = call USR_ONLINE.MONTAPOP(?,?)}";
CallableStatement cstmt = con.prepareCall(sql);
cstmt.registerOutParameter(1,Types.CHAR);
cstmt.setBigDecimal(2, new BigDecimal(160008));
cstmt.setNull(3, Types.VARCHAR);
cstmt.execute();
System.out.println(cstmt.getString(1));Good Luck,
Avi. -
Problem using Function Module IDOC_INBOUND_ASYNCHRONOUS
Hi friends,
I have a critical problem load idoc ARTMAS05. I development a program for load the data with idoc but my program call the function module IDOC_INBOUND_ASYNCHRONOUS close my session of the SAP GUI and lose the load. This problem begining today because yesterday was work well. This morning when I'm load the idoc gave to me a short dump with this message "SNAP_NO_NEW_ENTRY" I have find some notes and obtained this note 17537.
Note Solution
Solution
When the SNAP Table is full: Reorganize the table e.g. via Transaction ST22->Go to->Reorganize. Please also refer to Note 16083. This may lead to other errors of this kind since not all dumps e.g. from SM21 can be displayed.
In case of database problems, the errors should no longer occur with new short dumps after correcting the database error. Here, other errors of this kind may occur in SM21 as well.
After apply the correction begin the error that I close me the Session of SapGui and lose all my data proccessing. Please need your help.
Thank and regards..Hi Sir,
I am also facing the same issue...i need to update dependents Information Date Of Birth n Perid(Which is stored in IT0106)...in IT 0021..
Kindly correct my code....
I am using the following code for this...
data: w_return type bapireturn1.
data: p0021_struc TYPE p0021,
p0106_struc TYPE p0106,
p_pskey TYPE pskey.
start-of-selection.
get pernr.
p0021_struc = p0021.
p0021_struc-favor = 'Gaurav'.
p0021_struc-fgbdt = '05/10/1955'.
Move p0021_struc-favor to p0021-favor.
p0106_struc = p0106.
p0106_struc-stras = '2235 BOmbay Road'.
p0106_struc-perid = '123456789'.
MOVE p0106_struc-stras to p0106-stras.
Enqueue personnel number
call function 'BAPI_EMPLOYEE_ENQUEUE'
exporting
number = pernr-pernr
importing
return = w_return.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = p_pskey-infty
number = p_pskey-pernr
subtype = p_pskey-subty
objectid = p_pskey-objps
lockindicator = p_pskey-sprps
validityend = p0021-endda " '99991231'
validitybegin = p0021-begda
record = p0021_struc
operation = 'mod'
tclas = 'A'
dialog_mode = '2'
nocommit = p_test
VIEW_IDENTIFIER = '07' "p0003-viekn
secondary_record = p0106_struc
IMPORTING
return = w_return
key = familykey
EXCEPTIONS
OTHERS = 0.
Enqueue personnel number
call function 'BAPI_EMPLOYEE_DEQUEUE'
exporting
number = pernr-pernr
importing
return = w_return. -
Problem using function call in WHERE part of a Report's SQL query
I tried doing some searches on this, but couldn't find anything. I'm trying to run something similar to the following query in my report, but keep getting a "Query cannot be parsed within the Builder" error:
SELECT function1(TABLE2.ID) A
FROM TABLE1, TABLE2
WHERE TABLE1.ID = TABLE2.ID AND
TABLE1.NAME = 'BLAH' AND
TABLE2.DATE > SYSTIMESTAMP AND
(function2(TABLE2.ID) = 'YES' OR
function3(:USER_ID) = 'YES')
ORDER BY TABLE1.NAMEWhy won't this work? I can take out the 2 lines with function calls from the WHERE clause, and it works, so I'm assuming that APEX doesn't like something about my function calls. I know the functions are valid and work properly, because I tested them independently. Can anyone see what the problem is? Thanks!Here's the actual query:
SELECT BUILD_EXT_RES_LIST(EXT_FILE.ID) A
FROM EXT_FILE_RES, EXT_FILE
WHERE EXT_FILE_RES.ON_OWNER_PROFILE = 'Y' AND
EXT_FILE.OWNER_ID = :PROFILE AND
EXT_FILE.ID = EXT_FILE_RES.EXT_ID AND
(RES_SUBSCRIBER_YN(EXT_FILE.ID,:CURR_ID) = 'YES' OR
ADMINYESNO(:CURR_ID,:PROFILE) = 'YES')
ORDER BY EXT_FILE.FILE_NAMEAnd here's the actual error message:
1 error has occurred
Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. ORA-00904: "SER_IS_ADMINYESNO": invalid identifier -
Hi,
I am using RH_STRUC_GET with evalPath O-O-S-P and get the or g structure. I then loop through the table obtained from RH_STRUC_GET and re-use RH_STRUC_GET with a evaluation path 'bossonly' to find out who the managers are. But it does not work. I get No ROOTS FOUND error.
When I try the function module RH_STRUC_GET separately with the same input fields then it works!!!
Please let me know if I am doing anything wrong. My code is shown below....
FUNCTION Z_ORGBUILDER_CONN.
""Local interface:
*" IMPORTING
*" VALUE(OTYPE) LIKE OBJEC-OTYPE
*" VALUE(OBJID) LIKE OBJEC-OBJID
*" VALUE(PATHID) LIKE GDSTR-WEGID
*" VALUE(PLVAR) LIKE OBJEC-PLVAR
*" EXPORTING
*" VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
*" TABLES
*" L_ZCONN_TAB TYPE ZCONN_TAB
*" RESULT_TAB STRUCTURE SWHACTOR OPTIONAL
*" RESULT_OBJEC STRUCTURE OBJEC OPTIONAL
*" RESULT_STRUC STRUCTURE STRUC OPTIONAL
*" L_ZCONN_ORG TYPE ZCONN_TAB
*" L_ZCONN_POS_HOLDER TYPE ZCONN_POS_TAB
*" L_MANAGERS STRUCTURE OBJEC
DATA: z_struc type zconn_struc.
DATA: xresult_struc like result_struc.
DATA: yresult_struc like result_struc.
DATA: z_struc1 type zconn_struc.
DATA: z_struc_pos type zconn_position.
DATA: temp_tab LIKE SWHACTOR occurs 0 with HEADER LINE.
DATA: temp like struc-objid.
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype = otype
act_objid = objid
act_plvar = plvar
act_wegid = pathid
TABLES
result_tab = result_tab
result_struc = result_struc
result_objec = result_objec
EXCEPTIONS
no_plvar_found = 1
no_entry_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
RAISE no_roots_found.
ENDIF.
LOOP AT result_struc into xresult_struc.
read table result_struc into yresult_struc with key seqnr =
xresult_struc-pup.
if sy-subrc = 0.
z_struc-objectID = xresult_struc-OBJID.
z_struc-objectType = xresult_struc-otype.
z_struc-parentID = yresult_struc-objid.
z_struc-parentType = yresult_struc-otype.
endif.
Append z_struc to l_zconn_tab.
ENDLOOP.
LOOP AT l_zconn_tab.
if l_zconn_tab-objectType = 'O' or l_zconn_tab-objectType = 'S'.
z_struc1-objectID = l_zconn_tab-objectID.
z_struc1-objectType = l_zconn_tab-objectType.
z_struc1-parentID = l_zconn_tab-parentID.
z_struc1-parentType = l_zconn_tab-parentType.
Append z_struc1 to l_zconn_org.
endif.
ENDLOOP.
LOOP AT l_zconn_tab.
if l_zconn_tab-objectType = 'P'.
z_struc_pos-position = l_zconn_tab-parentID.
z_struc_pos-pos_holder = l_zconn_tab-objectID.
Append z_struc_pos to l_zconn_pos_holder.
endif.
ENDLOOP.
loop at result_struc.
if result_struc-otype = 'O'.
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype = 'O'
act_objid = result_struc-objid
act_plvar = '01'
act_wegid = 'bossonly'
TABLES
result_tab = temp_tab
EXCEPTIONS
no_plvar_found = 1
no_entry_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
RAISE no_roots_found.
ENDIF.
APPEND LINES OF temp_tab to L_managers.
endif.
endloop.
ENDFUNCTION.data: begin of itab occurs 0,
orgunit(10) type c,
mananger(30) type c,
end of itab.
* This will add a record to your itab
loop at result.
itab-orgunit = result-orgunit. " I don't know what fields they are
itab-manager = result-manager.
append itab.
endloop.
Please remember to award points for helpful answers and mark this post as solved if you question has been answered. Thanks.
Regards,
Rich Heilman -
Problem using function module for infotype 21
hi
im uploading the infotype 21 (family details) through function module hr_infotype_operations. i found that infotype 0106 (family/related person)
is a secondary infotype and that a record is created for 0106 ,everytime you create a record in 21. so i upload the family data of an employee using the function module for infotype 21 initially. and then fetch the same record from the table pa0106 and modify the same record with other information.
for example : u have the address details of a dependent(father subtype 11) in infotype 21. this address data is stored in the table pa0106 . im not able to modify the record for infotype 0106 using the function module 0106.
i would like to know the reason for the same. Is it because that infotype 0106 is a secondary infotype and u cannot modify the record using the fn module..?/
thanks
sridharanHi Sir,
I am also facing the same issue...i need to update dependents Information Date Of Birth n Perid(Which is stored in IT0106)...in IT 0021..
Kindly correct my code....
I am using the following code for this...
data: w_return type bapireturn1.
data: p0021_struc TYPE p0021,
p0106_struc TYPE p0106,
p_pskey TYPE pskey.
start-of-selection.
get pernr.
p0021_struc = p0021.
p0021_struc-favor = 'Gaurav'.
p0021_struc-fgbdt = '05/10/1955'.
Move p0021_struc-favor to p0021-favor.
p0106_struc = p0106.
p0106_struc-stras = '2235 BOmbay Road'.
p0106_struc-perid = '123456789'.
MOVE p0106_struc-stras to p0106-stras.
Enqueue personnel number
call function 'BAPI_EMPLOYEE_ENQUEUE'
exporting
number = pernr-pernr
importing
return = w_return.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = p_pskey-infty
number = p_pskey-pernr
subtype = p_pskey-subty
objectid = p_pskey-objps
lockindicator = p_pskey-sprps
validityend = p0021-endda " '99991231'
validitybegin = p0021-begda
record = p0021_struc
operation = 'mod'
tclas = 'A'
dialog_mode = '2'
nocommit = p_test
VIEW_IDENTIFIER = '07' "p0003-viekn
secondary_record = p0106_struc
IMPORTING
return = w_return
key = familykey
EXCEPTIONS
OTHERS = 0.
Enqueue personnel number
call function 'BAPI_EMPLOYEE_DEQUEUE'
exporting
number = pernr-pernr
importing
return = w_return. -
I have Oracle 9i and the manual says that I can use de VARIANCE, VAR_SAMP and STDDEV_SAMP functions, but when I use it it gives me the following error "Function VARIANCE is not defined in the expresion", could Anybody tell me what is wrong?, thanks
What exact version of the DB are you running?
Also, post the SQL statement and the exact complete error stack.
SQL> select variance(sal) from scott.emp ;
VARIANCE(SAL)
1398313.87
SQL> disconnect
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.5.0 - Production
SQL> -
C++ and GTKMM Problem using function set_resizable()
When I set the function set_resizable to false, the window open too small and only shows the label .
What am I making wrong ?
The code:
#include <gtkmm/window.h>
#include <gtkmm/main.h>
#include <gtkmm/layout.h>
#include <gtkmm/button.h>
#include <gtkmm/box.h>
#include <gtkmm/buttonbox.h>
#include <gtkmm/label.h>
class Janela : public Gtk::Window{
public:
Janela() :
layout(),
adicionar("Adicionar"),
remover("Remover"),
pesquisar("Pesquisar"),
sobre("Sobre"),
cvbotao(Gtk::BUTTONBOX_START, 10),
label("bla bla bla bla"),
caixa(){
Gtk::Window::set_size(500,300);
Gtk::Window::set_resizable(false);
Gtk::Window::set_title("Receitas Vegetarianas");
add(caixa);
caixa.pack_start(layout);
caixa.pack_end(label);
cvbotao.add(pesquisar);
cvbotao.add(adicionar);
cvbotao.add(remover);
cvbotao.add(sobre);
layout.put(cvbotao,30,140);
layout.show();
label.show();
cvbotao.show();
adicionar.show();
remover.show();
pesquisar.show();
sobre.show();
caixa.show();
~Janela(){
protected:
Gtk::Button adicionar;
Gtk::Button remover;
Gtk::Button pesquisar;
Gtk::Button sobre;
Gtk::Layout layout;
Gtk::VButtonBox cvbotao;
Gtk::Label label;
Gtk::HBox caixa;
int main(int argc, char * argv[]){
Gtk::Main kit(argc, argv);
Janela janela;
Gtk::Main::run(janela);please somebody delete this topic I got fix the problem change set_size by set_size_request.
Thanks -
Attachment using function module SO_DOCUMENT_SEND_API1
I am using the function module "SO_DOCUMENT_SEND_API1" to send a mail with a pdf attachment. My e-mail contains some text also.
The problem is along with the PDF I am also getting a TXT file as an attachment, which contains the same text data as the e-mail content. How can I delete the TXT attachment?
AnjuCALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
sender_address = w_sender
sender_address_type = w_sender_add_type
TABLES
packing_list = it_packing_list_mail
contents_bin = it_attachment
contents_txt = it_mess_body_mail
receivers = it_receivers_mail
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.
ENDIF.
DESCRIBE TABLE it_mess_body_mail LINES w_cnt.
w_doc_data-doc_size = ( w_cnt - 1 ) * 255 +
STRLEN( it_mess_body_mail ).
w_mtitle = text1222.
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = w_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR it_packing_list_mail.
it_packing_list_mail-transf_bin = space.
it_packing_list_mail-head_start = 1.
it_packing_list_mail-head_num = 0.
it_packing_list_mail-body_start = 1.
DESCRIBE TABLE it_mess_body_mail LINES it_packing_list_mail-body_num.
it_packing_list_mail-doc_type = 'RAW'.
APPEND it_packing_list_mail.
DESCRIBE TABLE it_attachment LINES it_packing_list_mail-body_num.
it_packing_list_mail-transf_bin = 'X'.
it_packing_list_mail-head_start = 1.
it_packing_list_mail-head_num = 1.
it_packing_list_mail-body_start = 1.
it_packing_list_mail-doc_type = 'XLS'.
it_packing_list_mail-obj_name = 'ATTACHMENT'.
it_packing_list_mail-obj_descr = 'Attached Document'.
it_packing_list_mail-doc_size = it_packing_list_mail-body_num * 255.
APPEND it_packing_list_mail.
Thanks,
Anju -
Problem in using function module parameters in abap program
i want to use the coding present in on one of the function module 'AS_API_INFOSTRUC_FIND' i got the problem using the function module parameters in my abap program.
these are the parameters inside fm
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_FIELDCAT) TYPE AIND_FCAT
*" VALUE(I_FIELDS) TYPE TABLE OPTIONAL
*" VALUE(I_OBLIGATORY_FIELDS) TYPE TABLE OPTIONAL
*" EXPORTING
*" VALUE(E_INFOSTRUC) TYPE AIND_DESC
*" REFERENCE(E_ALL_FIELDS) TYPE TABLE
*" REFERENCE(E_MATCHING_FIELDS) TYPE TABLE
*" EXCEPTIONS
*" NO_INFOSTRUC_FOUND
i want to declare E_ALL_FIELDS parameter in my abap program,
i have declared as
data: E_ALL_FIELDS TYPE TABLE.
but the system throws error that
'type of field 'TABLE' is generic .no table line has been specified'.
i want to use it in my abap program how can i declare in my abap program .You have to declare the table using any specific type.
The type table in the FM is generic so you can pass any type you need.
For instance:
TYPES: BEGIN OF ty_fields,
fieldname LIKE dfies-fieldname,
END OF ty_fields,
TYPES: TY_T_GLU1 LIKE GLU1 OCCURS 0,
ty_t_fields type ty_fields occurs 0.
DATA: lt_info_struct_fields TYPE ty_t_fields WITH HEADER LINE,
lt_matching_fields TYPE ty_t_fields WITH HEADER LINE.
CALL FUNCTION 'AS_API_INFOSTRUC_FIND'
EXPORTING
i_fieldcat = ft_fieldcat-fieldcat
i_fields = ft_fields_filled[]
IMPORTING
e_infostruc = lv_info_struct_name
e_all_fields = lt_info_struct_fields[]
e_matching_fields = lt_matching_fields[]
EXCEPTIONS
no_infostruc_found = 1. -
Problem with sender name CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
Hi All ,
I am using below function module to send a mail to external email Id's , Everything is working perfectly .
But in the sender address I have passed text as 'infomation ' , In email which i am recieving sender address is like text and '@xyz.com' .
Any idea from where this @xyz.com is picking ? .
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
sender_address = 'Information'
sender_address_type = 'INT'
commit_work = 'X'
IMPORTING
sent_to_all = gd_sent_all
TABLES
packing_list = it_packing_list
contents_bin = it_attachment
contents_txt = it_message
receivers = it_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.Hi All ,
I am using below function module to send a mail to external email Id's , Everything is working perfectly .
But in the sender address I have passed text as 'infomation ' , In email which i am recieving sender address is like text and '@xyz.com' .
Any idea from where this @xyz.com is picking ? .
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
sender_address = 'Information'
sender_address_type = 'INT'
commit_work = 'X'
IMPORTING
sent_to_all = gd_sent_all
TABLES
packing_list = it_packing_list
contents_bin = it_attachment
contents_txt = it_message
receivers = it_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. -
Problem using two function based indexes at once!
Hello Oracle!
I've got problems using two function based indexes on geometries at once.
The problem occures, when I use a spatial join between two geometries both using function based indexes.
The test case:
CREATE TABLE quad (centroid NUMBER);
CREATE TABLE points (no NUMBER, point MDSYS.SDO_GEOMETRY);
CREATE OR REPLACE FUNCTION getQuad (centroid NUMBER) RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC IS
BEGIN
RETURN MDSYS.SDO_GEOMETRY(2003, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(centroid-5,centroid-5,centroid+5,centroid-5,centroid+5,centroid+5,centroid-5,centroid+5,centroid-5,centroid-5));
END;
INSERT INTO USER_SDO_GEOM_METADATA VALUES('quad','tiedge.getQuad(centroid)',MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X', -100, 100, .0000001), MDSYS.SDO_DIM_ELEMENT('Y', -100, 100, .0000001)),NULL);
CREATE INDEX quad_idx on quad(getQuad(centroid)) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
INSERT INTO quad VALUES (0);
INSERT INTO quad VALUES (5);
INSERT INTO quad VALUES (10);
INSERT INTO points VALUES (1, MDSYS.SDO_GEOMETRY(1001,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),MDSYS.SDO_ORDINATE_ARRAY(4,4)));
ALTER SESSION SET QUERY_REWRITE_INTEGRITY=TRUSTED;
ALTER SESSION SET QUERY_REWRITE_ENA[i]Long postings are being truncated to ~1 kB at this time.hi there,
For a better audience for this question, I'd look at the database forum.
guys on that will be a lot more familiar with FBIs
thanks
Barry -
Hi Guyz,
I am having small problem using LIKE function . The problem is I am using LIKE function in the WHERE clause
to compare a column to a particular value, which gets this value from the front end. If the user has a single quote in the string he entered then the LIKE function is not working because of the single quote. Is there any way I can escape the single quote like we escape '%' and '_'.
Thankyou.Mod_plsql supports bind variables, as do almost all front-end tools that deal with Oracle (and most other databases). I do not code mod pl/sql myself, but others here do, and I see bind variables in their code all the time (if I don't, they hear from me :-)).
If you pass a bind variable, the quote problem goes away. As far as I know (which is not very far), you should be able to take the string with the quote directly from your input field, bind it to the variable in your query and have no problems.
I suspect that the reson you are having issues is that you are just gluing strings together to create a sql statement. this is the wrong approach.
The java term for what you are looking for is prepared statement, I'm not sure what the equivalent is i mod plsql, but that should give you a start.
John
Maybe you are looking for
-
Oracle8 Enterprise Edition for Windows 8.0.6
I'm a naïve user in Oracle and would like to know the following details from the Gurus. Any information in this regard will be highly appreciated ! We are trying to use Oracle8 Enterprise Edition for Windows 8.0.6 for some specific reason. Some gener
-
How can I upload digital video from a HDD camcorder to iMac Intel?
I bought a Sony DCR SR100 camcorder with 30 gig HD, and the software that comes with it is Windows only, and the Mac software that they refer you to on the internet says "not Intel Core compatible" So get this - the online support guy from Sony says
-
Acrobat will not accept license code after installing cs4 premium upgrade
We just upgraded to CS4 premium, from CS3 premium. In doing so acrobat replaced Acrobat 8 pro with Acrobat 9 pro. All our tools only work in Acrobat 8 pro, so we unistalled the Acrobat 9 pro and the software will not accept the keys from the product
-
I am in Hong Kong. How can I buy Export PDF (convert PDF to Word) ?
I am in Hong Kong. How can I buy Export PDF (convert PDF to Word) ?
-
How do I share one folder on iCloud Drive
Me and my wife have different AppleID. We are going paperless and want to share one folder either on my or her iCloud Drive. Using a mutual Dropbox account today but want to be inside Apples ECO-system. Called Apple and they told me not possible. Are