Dynamic attach RTF in AfterReport Trigger
Hi all,
I have a concurrent program where i want in runtime to attach RTF template based on some logic. I placed my code in After Report Trigger but i receive error when submitting the concurrent request:
REP-1401: 'afterreport': Fatal PL/SQL error occurred.
ORA-06503: PL/SQL: Function returned without valueI checked the code and i see no reason of getting this error.
The executable of my Report is "Oracle Reports" and the output format is XML.
Here is the code of the trigger:
function AfterReport return boolean is
v_set_layout_option boolean;
v_conc_request_id number;
v_printer_name varchar2(100);
v_printer boolean;
v_template_name varchar2(100);
v_invoice_type ra_cust_trx_types_all.type%type;
v_batch_source_name varchar2(100);
begin
dbms_application_info.set_client_info(:P_ORG_ID);
select
type, rbsa.name
into
v_invoice_type, v_batch_source_name
from
ra_customer_trx_all ra_ctp
,ra_cust_trx_types_all ra_cty
,ra_batch_sources_all rbsa
where ra_ctp.customer_trx_id = :p_customer_trx_id
and ra_ctp.cust_trx_type_id = ra_cty.cust_trx_type_id
and ra_ctp.org_id = ra_cty.org_id
and rbsa.BATCH_SOURCE_ID = ra_ctp.BATCH_SOURCE_ID
and ra_ctp.org_id = rbsa.org_id
v_template_name :=
case
when v_invoice_type = 'INV' then 'XX_AR_INVOICE_CURR'
when v_invoice_type = 'CM' then 'XX_AR_INVOICE_CURR_CR'
when v_invoice_type = 'DM' then 'XX_AR_INVOICE_CURR_DEBIT'
when v_invoice_type = 'PROFORMA' then 'XX_AR_INVOICE_CURR_PROFORMA'
when v_invoice_type = 'INVALIDATE' then 'XX_AR_INVOICE_CURR_INVAL'
when v_invoice_type = 'MONTHLY' then 'XX_AR_INVOICE_CURR_MONTHLY'
end;
v_set_layout_option := apps.fnd_request.add_layout( template_appl_name => 'AR' --application
,template_code => v_template_name
,template_language => 'en'
,template_territory => 'US'
,output_format => 'PDF');
begin
select printer_name
into v_printer_name
from fnd_concurrent_programs
where CONCURRENT_PROGRAM_NAME = 'XX_AR_INVOICE_CURR';
exception
when others then
null;
end;
if v_printer_name is not null then
v_printer := fnd_request.set_print_options(v_printer_name,
null,
1, -- no of copies
TRUE,
'N');
end if;
exception when others then return (false);
return (TRUE);
end;Version:Report Builder 10.1.2.2.0
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
PL/SQL Release 11.1.0.7.0 - Production
"CORE 11.1.0.7.0 Production"
TNS for Linux: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - ProductionAny ideas?
Thanks in advance,
Bahchevanov.
Edited by: bahchevanov on Dec 27, 2011 7:27 AM
Edited by: bahchevanov on Dec 27, 2011 7:28 AM
Solved! It seems that is impossible to attache template runtime via Report Builder(or it is...). So i made a new concurrent program with executable - PL/SQL Stored Procedure where i submit the request i want and attach an appropriate RTF file. Here is my procedure:
procedure submit_XX_AR_INVOICE_CURR(ERRBUF OUT varchar2, RETCODE OUT number, p_customer_trx_id number ) as
v_rid number;
v_org_id number;
call_status BOOLEAN;
request_phase VARCHAR2(30);
request_status VARCHAR2(30);
dev_request_status VARCHAR2(30);
dev_request_phase VARCHAR2(30);
request_status_mesg VARCHAR2(255);
v_invoice_type ra_cust_trx_types_all.type%type;
v_report_short_name varchar2(100);
v_batch_source_name varchar2(100);
check_status boolean;
v_set_layout_option boolean;
lv_document_type varchar2(10 char);
lv_org_id varchar2(10 char);
lv_tax_code varchar2(10 char);
v_template_name varchar2(50 char);
begin
select type, rbsa.name
into v_invoice_type, v_batch_source_name
from ra_customer_trx_all ra_ctp
join ra_cust_trx_types_all ra_cty on ra_ctp.cust_trx_type_id = ra_cty.cust_trx_type_id and ra_ctp.org_id = ra_cty.org_id
join ra_batch_sources_all rbsa on rbsa.BATCH_SOURCE_ID = ra_ctp.BATCH_SOURCE_ID and ra_ctp.org_id = rbsa.org_id
where ra_ctp.customer_trx_id = p_customer_trx_id
SELECT FND_PROFILE.VALUE('ORG_ID') INTO lv_org_id FROM dual;
v_template_name :=
CASE
WHEN v_invoice_type = 'INV' THEN 'XX_AR_INVOICE_CURR'
WHEN v_invoice_type = 'CM' THEN 'XX_AR_INVOICE_CURR_CR'
WHEN v_invoice_type = 'DM' THEN 'XX_AR_INVOICE_CURR_DEBIT'
WHEN v_invoice_type = 'PROFORMA' THEN 'XX_AR_INVOICE_CURR_PROF'
WHEN v_invoice_type = 'INVALIDATE' THEN 'XX_AR_INVOICE_CURR_INVAL'
WHEN v_invoice_type = 'MONTHLY' THEN 'XX_AR_INVOICE_CURR_MONTH'
END;
v_report_short_name := 'XX_AR_INVOICE_CURR';
v_set_layout_option := apps.fnd_request.add_layout(template_appl_name => 'AR' --application
,template_code => v_template_name -- template_name from XML_Publisher
,template_language => 'en' -- ISO format
,template_territory => 'US' -- ISO format
,output_format => 'PDF'); -- PDF, EXCEL, RTF
v_rid := fnd_request.submit_request('AR' -- application
,v_report_short_name -- program name ( GL interface)
,'Печат' -- description
,sysdate -- start time
,FALSE -- sub request
,p_customer_trx_id
,lv_org_id
,chr(0)
if nvl(v_rid,0) = 0 then
errbuf := sqlerrm;
RETCODE := 2;
end if;
commit;
check_status := FND_CONCURRENT.WAIT_FOR_REQUEST(v_rid
,2
,0
,request_phase
,request_status
,dev_request_phase
,dev_request_status
,request_status_mesg);
if (dev_request_phase != 'COMPLETE' or dev_request_status != 'NORMAL') then
dbms_output.put_line(dev_request_phase || ' -- ' || dev_request_status);
errbuf := sqlerrm;
RETCODE := 2;
end if;
dbms_output.put_line('v_rid :' || v_rid);
end submit_XX_AR_INVOICE_CURR;Best Regards,
Bahchevanov.
Similar Messages
-
I am in the process of building an application where all of
the functions will be eventually exported into seperate AS files. I
am having issues with a Sub Navigation that is attached and managed
dynamically.
The Sub Navigation is in an MC which contains a mask (which
has a tween animation to add a fade in effect), and a blank MC
which will contain all of the navigation items.
Upon load of an XML file, the navigation items are extracted
and buttons are created within the blank MC. Each button is
inserted using the blank MC instance name at the next highest
depth.
All of the actions associated with the above need to be
issued from the root timeline but when I call the dynamically
attached clips (full target path) it cannot seem to find the clips.
I have checked the target path numerous times and used a variety of
debugging techniques but no luck.
Has anyone else had issued targeting dynamically attached
MC's that are nested two - three levels deep?
Thank you so much in advance!Here is what is being returned by the output when the Sub
Navigation is displayed:
Level #0:
Variable _level0.$version = "MAC 8,0,22,0"
Variable _level0.NAV_Active = false
Variable _level0.NAV_ActiveButton = 0
Variable _level0.NAV_MaximumButtons = 7
Variable _level0.NAV_EaseSpeed = 1.5
Variable _level0.Navigation_ActiveButton = 0
Variable _level0.SubNavigation_XML =
"_xml/DestinationDetails.xml"
Variable _level0.SubNavigation_ItemCount = 0
Variable _level0.SubNavigation_ItemsXPositioning = 10
Variable _level0.SubNavigation_ItemsYPositioning = 12
Movie Clip: Target="_level0.instance1"
Movie Clip: Target="_level0.instance2"
Movie Clip: Target="_level0.instance3"
Movie Clip: Target="_level0.instance4"
Movie Clip: Target="_level0.instance5"
Movie Clip: Target="_level0.instance6"
Movie Clip: Target="_level0.NAV_Master"
Movie Clip: Target="_level0.NAV_Master.instance7"
Movie Clip: Target="_level0.NAV_Master.SNAV_Master"
Movie Clip: Target="_level0.NAV_Master.SNAV_Master.instance8"
Movie Clip:
Target="_level0.NAV_Master.SNAV_Master.Button_Container"
Movie Clip: Target="_level0.NAV_Master.SNAV_Master.instance9"
Movie Clip:
Target="_level0.NAV_Master.SNAV_Master.Scroll_Down"
Movie Clip:
Target="_level0.NAV_Master.SNAV_Master.Scroll_Down.States"
Movie Clip:
Target="_level0.NAV_Master.SNAV_Master.Scroll_Down.States.instance10"
Movie Clip:
Target="_level0.NAV_Master.SNAV_Master.Scroll_Down.instance11"
Movie Clip: Target="_level0.NAV_Master.SNAV_Master.Scroll_Up"
Variable _level0.NAV_Master.SNAV_Master.Scroll_Up.onRollOver
= [function 'onRollOver']
Movie Clip:
Target="_level0.NAV_Master.SNAV_Master.Scroll_Up.States"
Movie Clip:
Target="_level0.NAV_Master.SNAV_Master.Scroll_Up.States.instance12"
Movie Clip:
Target="_level0.NAV_Master.SNAV_Master.Scroll_Up.instance13"
Movie Clip: Target="_level0.NAV_Master.PNB_6"
Variable _level0.NAV_Master.PNB_6.onRollOver = [function
'onRollOver']
Variable _level0.NAV_Master.PNB_6.onRollOut = [function
'onRollOut']
Variable _level0.NAV_Master.PNB_6.onRelease = [function
'onRelease']
Movie Clip: Target="_level0.NAV_Master.PNB_6.PNBS_6"
Movie Clip: Target="_level0.NAV_Master.PNB_5"
Variable _level0.NAV_Master.PNB_5.onRollOver = [function
'onRollOver']
Variable _level0.NAV_Master.PNB_5.onRollOut = [function
'onRollOut']
Variable _level0.NAV_Master.PNB_5.onRelease = [function
'onRelease']
Movie Clip: Target="_level0.NAV_Master.PNB_5.PNBS_5"
Movie Clip: Target="_level0.NAV_Master.PNB_4"
Variable _level0.NAV_Master.PNB_4.onRollOver = [function
'onRollOver']
Variable _level0.NAV_Master.PNB_4.onRollOut = [function
'onRollOut']
Variable _level0.NAV_Master.PNB_4.onRelease = [function
'onRelease']
Movie Clip: Target="_level0.NAV_Master.PNB_4.PNBS_4"
Movie Clip: Target="_level0.NAV_Master.PNB_3"
Variable _level0.NAV_Master.PNB_3.onRollOver = [function
'onRollOver']
Variable _level0.NAV_Master.PNB_3.onRollOut = [function
'onRollOut']
Variable _level0.NAV_Master.PNB_3.onRelease = [function
'onRelease']
Movie Clip: Target="_level0.NAV_Master.PNB_3.PNBS_3"
Movie Clip: Target="_level0.NAV_Master.PNB_2"
Variable _level0.NAV_Master.PNB_2.onRollOver = [function
'onRollOver']
Variable _level0.NAV_Master.PNB_2.onRollOut = [function
'onRollOut']
Variable _level0.NAV_Master.PNB_2.onRelease = [function
'onRelease']
Movie Clip: Target="_level0.NAV_Master.PNB_2.PNBS_2"
Movie Clip: Target="_level0.NAV_Master.PNB_1"
Variable _level0.NAV_Master.PNB_1.onRollOver = [function
'onRollOver']
Variable _level0.NAV_Master.PNB_1.onRollOut = [function
'onRollOut']
Variable _level0.NAV_Master.PNB_1.onRelease = [function
'onRelease']
Movie Clip: Target="_level0.NAV_Master.PNB_1.PNBS_1"
Movie Clip: Target="_level0.NAV_Master.PNB_0"
Variable _level0.NAV_Master.PNB_0.onRollOver = [function
'onRollOver']
Variable _level0.NAV_Master.PNB_0.onRollOut = [function
'onRollOut']
Variable _level0.NAV_Master.PNB_0.onRelease = [function
'onRelease']
Movie Clip: Target="_level0.NAV_Master.PNB_0.PNBS_0" -
HOW TO FIRE AN AFTERREPORT TRIGGER
Hi all,
I have an issue concerning executing an afterreport trigger. In my Data template, I put that trigger after the tag </dataQuery> and I have something like this:
</dataQuery>
<dataTrigger name="afterReport" source="XXEOC_AP_INVOICE_PRINT_pkg.XXEOC_print_invoice(:SUPPLIER_NAME,:SUPPLIER_SITE,:INVOICE_NUMBER,:INVOICE_DATE_FROM,:INVOICE_DATE_TO,:NEW_INVOICES)"/>
</dataTemplate>
That function is making an update on a table, but I want that the update to be done AFTER the report was executed....Now the trigger is executed before. Can anybody tell me how to put the trigger to be executed AFTER the report?
Thank you in advance.
MariusYou need to re-position after dataStructure section
<?xml version="1.0" encoding="WINDOWS-1252" ?>
<dataTemplate name="dataTemplateName" description="Template description" defaultPackage="employee" version="1.0">
<parameters>
</parameters>
<dataQuery>
<sqlStatement name="Q1">
<![CDATA[SELECT EMPNO,ENAME,SAL
from EMP
WHERE DEPTNO = :P_DEPTNO ]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_EMP" source="Q1">
<element name="EMPLOYEE_NUMBER" value="EMPNO" />
<element name="NAME" value="ENAME"/>
<element name="SALARY" value="SAL"/>
</group>
</dataStructure>
<dataTrigger name="afterReport" source="EMPLOYEE.AfterReport" />
</dataTemplate> -
AfterReport Trigger not working
Hi. My XML contains before and after report trigger. My beforeReport trigger works well but my afterReport trigger got problem. My afterReport trigger triggered before my dataStructure.
Below is my XMl sample.
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Header: Vacancy Raised with Status Summary Report.xml 2010/11/12 Gunasilan Muniandy $-->
<dataTemplate name="Recruitment_Key_Performance_Indicators_Report" defaultPackage="MASIRC_KPI_REPORT_PKG" version="1.0">
<properties>
<property name="xml_tag_case" value="upper"/>
<property name="debug_mode" value="on"/>
</properties>
<parameters>
<parameter name="P_Vacancy_From" dataType="character" />
<parameter name="P_Vacancy_To" dataType="character" />
<parameter name="P_Report_Time" dataType="character" />
</parameters>
<dataTrigger name ="beforeReport" source="MASIRC_KPI_REPORT_PKG.CallProcedure(:P_Vacancy_From,:P_Vacancy_To,:P_Report_Time)"/>
<dataQuery>
<sqlStatement name="details">
<![CDATA[
SELECT
NO,
VAC_NAME,
RAS_APPROVE,
PUB_ST_DATE,
PUB_EN_DATE,
SHORLISTING,
INTERVIEW,
OFFER_ST_DT,
OFFER_EN_DT,
REPORT_DT
FROM MAS_IRC_KPI_TBL
where Report_dt =:P_Report_Time
ORDER BY VAC_NAME,no
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_1" dataType="varchar2" source="details">
<element name="VAC_NAME" dataType="varchar2" value="VAC_NAME" />
<element name="RAS_APPROVE" dataType="varchar2" value="RAS_APPROVE" />
<element name="PUB_ST_DATE" dataType="varchar2" value="PUB_ST_DATE" />
<element name="PUB_EN_DATE" dataType="varchar2" value="PUB_EN_DATE" />
<element name="SHORLISTING" dataType="varchar2" value="SHORLISTING" />
<element name="INTERVIEW" dataType="varchar2" value="INTERVIEW" />
<element name="OFFER_ST_DT" dataType="varchar2" value="OFFER_ST_DT" />
<element name="OFFER_EN_DT" dataType="varchar2" value="OFFER_EN_DT" />
</group>
</dataStructure>
<dataTrigger name ="afterReport" source="MASIRC_KPI_REPORT_PKG.CallProcedureDelete(:P_Report_Time)"/>
</dataTemplate>
please advice. thanks.try with naming the procedure afterreport......
-
Forms 6i: Dynamically attach/detach LOV
Hi,
Is there a way to dynamically attach or detach an LOV to an item at run-time?
Thanks.Yes. you are right. I thought about set the lov_name to null but
I only looked the help says
"LOV_NAME Specify the VARCHAR2 name of an LOV to be associated with the given item. If the LOV name does not exist, you will get an error message. "
but did not do my own test.
Hedy -
Open report file generated from AfterReport trigger fails
Hi,
I generate reports files using rwrun.exe.
In order to know if my report file has been generated without error, I call TEXT_IO.FOpen(..., 'r') into my afterreport to see if any file has been generated.
It works fine under win2000 but not under Solaris 5.8.
The report file is generated but for some strange reason TEXT_IO.FOpen( ) generates a non oracle exception -302000.
Any idea about what happens and how to fix that?
Thanks,
ManuHi Sripathy,
Thanks for your answer.
In the afterreport trigger, I just open my file as read only to see if it's there.
The process has just created the file, so, it should be able to open it just to read.
Anyway, I checked the rights on the file and they are Ok.
Actually, I think it's a problem with the OS because sometimes, it works fine and the next report, it fails.
Maybe the file is still "locked" by some other process as I try to read it.
That's a pain to not be able to check if the report went fine from the afterreport trigger.
Manu -
Validate from List property of dynamically attached LOV
Dear Oracle Gurus,
I have multi record block , the fields are Argument_name,Argument_Code ,argument_lov
displaying two fields . data is populated at run time
user has to input for the argument_value according to the argument_name displayed
it may look like
Argument_name Argument_value
Date of Join User has to input
Branch office user has to select from a LOV
Dept User has to select from a LOV
the LOV's underlying Select statement will fetch data from a table based on other field Argument_Code
The LOV is attached dynamically for each row based on a value for the field argument_lov value will be Y or N
IF value for a argumet is Y , the LOV is attached with SET_ITEM_PROPERTY in the When NEW RECORD INSTANCE Trigger
when user moves to the argument Date of join there will be no lov and the user has to type out the data
whereas for the argument Branch Office , user can select from a LOV
now the user has to press the F9 key to invoke the Lov and then select
whereas we wanted in this way.. that the user can type the first character and the value automatically get selected
if the user types wrong data then the LOV to be displayed
For this we used the SET_ITEM_PROPERTY with VALIDATE_FROM_LIST, Property_true in the same trigger.
we have record validation trigger at the block level .
But it didnt work out exactly when ever the user moves from a record having LOV after selecting. the other field which is not having a LOV displays a lov with values belonging to another field and asks to select from the list . For example the date of join field displays the lov for dept and asks to input
please guide me in this regard
with warm regards
ssrBut when table hav too many rows (here i hav 18000 rows) getting too slow....Is this problem is common...? Yes, this is common when you have a lot of rows returned by your LOV query. In situations like this, it is best to try and reduce the size of the data returned by your LOV. One way of doing this is to enable the Filter Before Display property on the LOV. When enabled, it causes Forms to display a query criteria dialog before displaying the LOV. This too can cause slowness because this option could cause a full table scan to occur. Perhaps a better option would be to make your LOV dependent on other limiting values. For example, if your Form showed a list of all employees in a company you could make your user select limiting data like a department number to help reduce the number of employee records returned by your LOV.
Craig... -
Getting while attaching .rtf file in data template
Hi All,
When i am attaching a .RTF file to a data template , i am getting the following erro :
The referring page may have come from a previous session. Please select Close Window to proceed
i tried by login again but same error coming every time, please help me on thsi.
Thanks<?xml version = "1.0" encoding="UTF-8" ?>
<dataTemplate name="XMLTEST" description = "testing the" Version = "1.0">
<properties>
<property name="xml_tag_case" value="upper" />
<property name="include_parameters" value="true"/>
<property name="include_null_Element" value="true"/>
</properties>
<parameters>
<parameter name="P1" dataType = "CHARACTER"></parameter>
</parameters>
<dataQuery>
<sqlStatement name="Q1">
<![CDATA[
SELECT CASH_RECEIPT_ID , AMOUNT , SET_OF_BOOKS_ID
FROM AR_CASH_RECEIPTS_ALL
WHERE STATUS = :P1
]]>
</sqlStatement>
</dataQuery>
<datastructure>
<group name = "G1" SOURCE = "Q1" groupFilter="">
<element name="CASH_RECEIPT" value ="CASH_RECEIPT"/>
<element name="AMOUNT" value="AMOUNT"/>
<element name="SET_OF_BOOKS_ID" value="SET_OF_BOOKS_ID"/>
</group>
</datastructure>
</dataTemplate>
i have modified the date datatype. im still seeing the same output. how do i change the element to be derived value? can you help me with the syntax.
Thanks! -
Dynamic attachment name in receiver mail adapter
Hi all,
i am doing a receiver mail scenario (PI 7.1). my requirement is like this :
Receiver file need to be send in receiver mail attachment and attachment name should be dynamic
format for the attachment name should be like this
R+value from a particular field in payload +Timestamp
for example my file name should be like this R001_510815021009062532.xml
which is R+ 001_510815 + 021009062532 + .xml
can anybody suggest me how to go for this requirement? is ther any UDF or should i go for adapter module developement?
Thanks
sandeep sharma
Edited by: sandeep sharma on Oct 13, 2009 8:55 AMHi K Fatima,
I read your solution.I have a similar requiement but I need to send the entire output payload as an attachment,so I am using XSLT to send the payload as an attachment.
I am creating the file name through dynamic configuration in XSLT but the name of attachment is not as required but its any random generated name:
*code used:*
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:map="java:java.util.Map"
xmlns:dyn="java:com.sap.aii.mapping.api.DynamicConfiguration"
xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">
<xsl:output method="xml" version="1.0" encoding="UTF-8" />
<xsl:output indent="yes" />
<xsl:param name="inputparam"/>
<!-- mail parameters -->
<xsl:template match="*">
<ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
<xsl:variable name="new-value" select="Shipment/InternalShipmentNum"/>
<Subject>Mail</Subject>
<From>xyz</From>
<To>abc</To>
<xsl:variable name="dynamic-conf"
select="map:get($inputparam, 'DynamicConfiguration')" />
<xsl:variable name="dynamic-key"
select="key:create('http://sap.com/xi/XI/System/File', 'Directory')" />
<xsl:variable name="dynamic-value"
select="dyn:get($dynamic-conf, $dynamic-key)" />
<xsl:variable name="new-value"
select="concat($dynamic-value, 'subfolder\')" />
<xsl:variable name="dummy"
select="dyn:put($dynamic-conf, $dynamic-key, $new-value)" />
<!--Content type -->
<Content_Type>application/xml</Content_Type>
<!Content Description>
<Content_Disposition>attachment;filename "<xsl:copy-of select="$new-value"/>"</Content_Disposition>
<!--Content Disposition -->
<Content_Description><xsl:copy-of select="$new-value"/></Content_Description>
<Content>
<xsl:copy-of select=".">
<xsl:apply-templates/>
</xsl:copy-of>
</Content>
</ns:Mail>
</xsl:template>
</xsl:stylesheet>
Please suggest ! I need the value in "Shipment/InternalShipmentNum" as name of attachment.
Thanks in advance!
Indu Khurana -
Dynamic attachment name with receiver mail adapter and use mail package
We need to send mapped XML payload as attachment (with dynamic name) to a recepient (recepient email id is part of input xml payload, but not part of the mapped XML payload).
I could probably do this using the adapter module (as per the following link),
http://wiki.sdn.sap.com/wiki/display/XI/Adapter%20Module%20PI%207.0%20Set%20Attachment%20Name?bc=true
I would like to explore if this would be feasible using Mail package and XI payload.I already have a Java mapping that is converting the input XML to required Output format. If I am using Mail package (XI Payload), how do I go about sending this Output XML from java mapping as attachment to email id available in the input payload?Hi,
1) XML payload as attachment (with dynamic name)
2) recipient (recipient email id is part of input xml payload, but not part of the mapped XML payload)
These two is possible by using Mail Package. You have a standard xsd for mail package which you can download from the SAP Note 748024.
The xml created in you java mapping which will be your attachment should be put into the <content> tag of the mail package xml structure. and the file name can be set in the <Content_Type> tag.
<?xml version="1.0"; encoding="UTF-8"?>
<p2:Mail xmlns:p2="http://sap.com/xi/XI/Mail/30">
<Subject>My Invoice</Subject>
<From>from email address<;/From>
<To>to email address</To>
<Content_Type>text/plain;name="MyFile.csv";</Content_Type> --> file name here
<Content>123;A49;aaa</Content> -> attachment xml here
</p2:Mail>
And you have to select MailPackage in the receiver mail adapter.
Regards,
Aravind -
Setting dynamic attachment name in mail adapter
Hi experts,
I have a mail adapter that send e-mails from ECC to several address.
I have configured dynamically the FROM and TO field using the code showed below in message mapping:
public String SetMailParameters(String Mail_address_to, Container container){
//write your code here
String valueFrom = "my_address";
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/Mail", "THeaderFROM");
DynamicConfigurationKey key2 = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/Mail", "THeaderTO");
conf.put(key1, valueFrom);
conf.put(key2, Mail_address_to);
return "";
In communication channel I have checked ASMA and variable transport binding (using XHeaderName1 and 2), mail package is not checked.
It works fine!
My question is:
I need to dynamically configure also the Attachment name: is it possible?
I've tried adding the code below:
DynamicConfigurationKey key3 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
conf.put(key3,Attachment_name);
and also
Transform.ContentDisposition attachment;filename=<FileName>
in Message TransformBean in communication channel, but it doesn't work!!!
Any idea?
Thanks
Fabio BoniHi,
thanks a lot!!
ASMA and variable transport binding must be checked or not?
it raise an error in runtime workbench message monitoring:
2010-09-02 17:41:15 Success Mail: calling the adpter for processing
2010-09-02 17:41:15 Error Mail: call failed; com.sap.aii.messaging.util.XMLScanException: expecting end tag: Mail, but found {'}Content_Disposition at state 1
2010-09-02 17:41:15 Success Mail: sending a delivery error ack ...
2010-09-02 17:41:15 Success Mail: sent a delivery error ack
2010-09-02 17:41:15 Error Mail: error occured: com.sap.aii.af.ra.ms.api.RecoverableException: com.sap.aii.messaging.util.XMLScanException: expecting end tag: Mail, but found {'}Content_Disposition at state 1
2010-09-02 17:41:15 Error MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: com.sap.aii.messaging.util.XMLScanException: expecting end tag: Mail, but found {}Content_Disposition at state 1
2010-09-02 17:41:15 Error Exception caught by adapter framework: com.sap.aii.messaging.util.XMLScanException: expecting end tag: Mail, but found {}Content_Disposition at state 1
2010-09-02 17:41:15 Error Delivery of the message to the application using connection Mail_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: com.sap.aii.messaging.util.XMLScanException: expecting end tag: Mail, but found {}Content_Disposition at state 1.
This is my message in message monitoring:
<?xml version="1.0" encoding="UTF-8" ?>
- <ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30">
<Content_Disposition>"attachment; filename="MyFileName.txt"</Content_Disposition>
<Content>ZLF;0001000079;Dealer Motors UK</Content>
</ns1:Mail>
In message mapping with target message mail package I've linked Content_Disposition with the constant
"attachment; filename="MyFileName.txt"
If I cancel this relation the mail arrives correctly.
One other thing: when I took mail.xsd from SAP the fields Content_Disposition and Content_Description weren't in, so I added them manually in XSD.
thanks
Edited by: Fabio Boni on Sep 2, 2010 5:42 PM
Edited by: Fabio Boni on Sep 2, 2010 6:06 PM -
How to reference dynamically :new value in a trigger
Hi,
I have a trigger in which i have to check all fields of a table that have many fields, so i retrieve table fields from all_tab_columns and would like to check :new value but do not know how to do that. Does someone have an idea? Thanks.Tabit7 wrote:
I have a trigger in which i have to check all fields of a table that have many fields, Not fields. Records have fields. Tables have columns.
Why so many columns? That is often a sign of a poor data model or incorrect normalisation.
so i retrieve table fields from all_tab_columns and would like to check :new value but do not know how to do that. Sounds like a bad idea.
Does someone have an idea? That depends on the actual problem. You've only described what you think a potential solution is to this unknown problem - dynamically accessing column values in a trigger.
We need to know what that problem is, in order to comment on your approach and what other approaches can be considered. -
Java mail with Dynamic attachment?
Hi :-)
How to send the mails with dynamically created attachements..
The attachments may be a Excel file created dynamically according to the user inputs on the webpage. Is there any way to send those attachments to the receipients with out storing those attachements anywhere(server)?
Give me some tips to take my next step...
Thanx in advance
Krishnakumar S
(+919847706611)You should take a look at Sun's JavaMail site. It has quite a bit of info on JavaMail, located here: http://java.sun.com/products/javamail/.
See the FAQ here: http://java.sun.com/products/javamail/FAQ.html, it has questions dealing with attachments.
There is a tutorial here that covers sending and receiving attachments: http://java.sun.com/developer/onlineTraining/JavaMail/index.html. Specific section on attachments is located here: http://java.sun.com/developer/onlineTraining/JavaMail/contents.html#JavaMailAttachments -
Dynamic build of a table trigger - Issue building :new and :old vars
(which leads me to my next issue - this one might be a deal killer for me; see "Are Optional Parameters possible in Procedural Units?"
I'm using a Select statement to dynamically create a table trigger which looks like the following:
create or replace trigger tr_audit#reporter
after update on reporter
for each row
begin
ttms_audit_pkg.insert_audit_info( 'reporter', 'ZIP', :new.ZIP, :old.ZIP, 'REPORTER.REPORTER,REPORTER.PROJECT_CD', 'EXFC', :new.reporter, :new.project_cd);
end;
The :new. and :old. variables are generated based on which table_name is passed to the script creating this trigger. My problem is that I need all the :new. and :old. parameters to be passed in as Char. regardless of whether they are Number or Date variables.
So in the example above...if :new.reporter is a number on the table then I need to to_char is like this:
create or replace trigger tr_audit#reporter
after update on reporter
for each row
begin
ttms_audit_pkg.insert_audit_info( 'reporter', 'ZIP', :new.ZIP, :old.ZIP,
'REPORTER.REPORTER,REPORTER.PROJECT_CD', 'EXFC', to_char(:new.reporter), :new.project_cd);
end;
However, since this trigger is created dynamically I will not know in advance which :new. and :old. parameters will need to be converted to character. So if to_char(:new.reporter) is used and :new.reporter is already a character on the table then I will get an error.
So my question then is this. Is there a way to write this dynamic sql in a way to accomidate this problem? I'm thinking something that would act a bit like a decode does with values...pehaps something like this:
decode(:new.reporter, NUMBER, to_char(:new.reporter), DATE, to_char(:new.reporter,'DD-MON-YYYY HH12:MIPM'), :new.reporter)
...if :new.reporter is a number then to_char it; if :new.reporter is a date then to_char it; otherwise let it be.
By any chance does anyone know if this is possible? I would greatly appreciate any insights.Sure, you can selectively version-enable tables using Workspace Manager (you call DBMS_WM.EnableVersioning on each table you want Workspace Manager to track history for).
What do you mean by "programmatically rollback changes"? Workspace Manager has the ability to call GotoTime and queries against a version-enabled table will return results as if you were querying it at that specific point in time (unless you've purged history of course). You can also use it to create what are essentially long-running transactions where you can work on multiple sets of proposed data changes simultaneously for days or months before finally deciding to commit a one particular set. It's incredibly powerful.
Justin -
Below is code that has a timer countdown that reads off of the computer. Below in bold is code to read "if it reaches the date, go to and play frame (2).
timer.removeEventListener(TimerEvent.TIMER, updateTime);
timer.stop();
gotoAndPlay(2);
Below is code that is manual input- I had set up a dynamic txt field in flash named it : raffle_tix_remain When loaded on to the host I can manulally update the xml code and the change will take effect.
raffle_tix_remain.text = root.loaderInfo.parameters.raffle_tix_remain;
My question: Since the raffle_tix_remain is a manual input from a user to xml Is there a way to tell flash once it refreshes and "raffle_ tix_ remain" goes to (0) zero gotoAndPlay(2); and let it play like a "sold out" sign
i guess that would be a if else statement.
Code Below-----------------
stop();
var year:Number = 2011;
var month:Number = 12;
var day:Number = 30;
var finalDate:Date = new Date(year,month-1,day);
var timer:Timer = new Timer(100);
timer.addEventListener(TimerEvent.TIMER, updateTime);
timer.start();
function updateTime(e:TimerEvent):void{
var now:Date = new Date();
var remainTime:Number = finalDate.getTime() - now.getTime();
if (remainTime >0) {
var secs:Number = Math.floor(remainTime/1000);
var mins:Number = Math.floor(secs/60);
var hours:Number = Math.floor(mins/60);
var days:Number = Math.floor(hours/24);
var secsText:String = (secs%60).toString();
var minsText:String = (mins%60).toString();
var hoursText:String = (hours%24).toString();
var daysText:String = days.toString();
if (secsText.length < 2) {secsText = "0" + secsText;}
if (minsText.length < 2) {minsText = "0" + minsText;}
if (hoursText.length < 2) {hoursText = "0" + hoursText;}
if (daysText.length < 2) {daysText = "0" + daysText;}
day_txt.text = daysText;
hour_txt.text = hoursText;
min_txt.text = minsText;
sec_txt.text = secsText;
else {
timer.removeEventListener(TimerEvent.TIMER, updateTime);
timer.stop();
gotoAndPlay(2);stop();
var year:Number = 2011;
var month:Number = 12;
var day:Number = 30;
var finalDate:Date = new Date(year,month-1,day);
var now:Date = new Date();
var timer:Timer = new Timer(1000);
timer.addEventListener(TimerEvent.TIMER, updateTime);
timer.start();
function updateTime(e:TimerEvent):void{
var remainTime:Number = finalDate.getTime() - now.getTime()-e.currentCount;
if (remainTime >0 || raffle_tix_remain==0) {
var secs:Number = Math.floor(remainTime/1000);
var mins:Number = Math.floor(secs/60);
var hours:Number = Math.floor(mins/60);
var days:Number = Math.floor(hours/24);
var secsText:String = (secs%60).toString();
var minsText:String = (mins%60).toString();
var hoursText:String = (hours%24).toString();
var daysText:String = days.toString();
if (secsText.length < 2) {secsText = "0" + secsText;}
if (minsText.length < 2) {minsText = "0" + minsText;}
if (hoursText.length < 2) {hoursText = "0" + hoursText;}
if (daysText.length < 2) {daysText = "0" + daysText;}
day_txt.text = daysText;
hour_txt.text = hoursText;
min_txt.text = minsText;
sec_txt.text = secsText;
else {
timer.removeEventListener(TimerEvent.TIMER, updateTime);
timer.stop();
gotoAndPlay(2);
Maybe you are looking for
-
A Pages document will not open and there is a screen annoucement it will not open. Other Pages documents do open, but are slow. The one that will not open now was also very slow. My last visit to the Apple store the Genius Bar said I needed a new
-
In sql server 2000, what data type do I use for a field that needs to show two decimal places? It is a weight field, so the weight in ounces could be something like 12.25 and it needs to store it this way in the database. I'm kind of new to sql serve
-
Dynamic report Generation INSERT REPORT/INSERT TEXTPOOL
hi, I have problem while creating dynamic report I have a text file Containing all the lines of a Program If i download the text then the Pgm should be dynamically creted with text elements. i cant Copy text element alone in the text file So i used t
-
Movies converted to H.264 come out brighter. Is there a solution?
I love the quality of H.264 but after conversion they always seem to be brighter/lighter then the original. Is there a solution? Thanks Clank
-
Importance of T.codes MCEC,MCEA AND MCEB
Hi Gurus, 1) please explain where to use the aboves t.codes in long term planning. 2) How can we do collective planning run for many materials in LTP.I have to do LTP planning for more than 150 finished products. Which are t.codes used to do collecti