How to call this procedure in my report to print my procedure output

Hi,
i have a table named letter,it contains 2 columns named as letter_id and letter_content.
select * from letter;
letter_id letter_content
103 Dear MFR
103 This is in regards to the attached DM List
103 Please Credit us after reviewing it.
103 Thanks
103 Regards
103 xxxx
108 Dear customer
108 This is to inform that ur DM List is as follows
108 Credit us according to the Dm after reviewing it.
108 Thanks
108 Regards
108 xxxx
now my requirement is,i need send a parameter as letter_id to a procedure or function in pl/sql in oracle,the output should be as follows:
if we will pass parameter(letter_id) = 103 then it displays as follows:
Dear MFR
This is in regards to the attached DM List.Please Credit us after reviewing it.
Thanks
Regards,
XXXXX.
if we will pass parameter(letter_id) = 108 then it should displays as follows:
Dear customer,
This is to inform that ur DM List is as follows. Credit us according to the Dm after reviewing it.
Thanks
Regards,
XXXXX.
the procedure for my requirement is like below.now my problem is how to call this procedure in my report.so that if i will send a parameter as letter_id then it should get my report stated above.
CREATE OR REPLACE PROCEDURE letter_text ( p_letter_id letter.letter_id%TYPE , p_letter_contents_out OUT SYS_REFCURSOR )
IS
BEGIN
OPEN p_letter_contents_out
FOR
SELECT letter_content
FROM letter
WHERE letter_id = p_letter_id
ORDER BY line_seq;
END letter_text;
which you might call with something like
SQL> var results refcursor
SQL> exec letter_text(103, :results)
PL/SQL procedure successfully completed.
SQL> print :results;
CONTENT
Dear MFR
this is in regards to the attached DM List
Please credit us after reviewing it
thanks
Regards
EXP
6 rows selected.
so, the same out put i need to get it in a report.
Thanks

Thanks for ur suggestions.
i have 2 select statements.1st query is the main query for the report.so i used it at the time of report created with datablock.
now my 2nd query is
select letter_content
from ( select content_seq,
     content || case content_seq
when 2 then
' ' || lead(content) over (partition by letter_id order by content_seq)
end as letter_content
from exp_letter_contents
     where letter_id = 103)
where content_seq <> 3;
i had taken 2parameters 1 for the main query and 2nd is for the above query(parameter is letter_id).
now i have to write the above select statement in the report.
so i had taken a field object in the report and then i had written this code in before report trigger.
function letter_contentFormatTrigger return boolean is
begin
select letter_content
from ( select content_seq,
                    content ||
                    case content_seq when 2 then
                         ' ' || lead(content) over (partition by letter_id order by content_seq)
                    end as letter_content
          from exp_letter_contents
          where letter_id = 103)
where content_seq <> 3;
return (letter_content);
end;
when i tried to compile it.i got an error as follows :
error 103 at line6,column 5
encountered the symbol "CASE" when expecting one of the following:
(- + mod null <an identifier>
<a double-quoted delimited-identifier><a bind variable> avg...etc
so,where can i write this select statement.
i am using oracle reports6i
Message was edited by:
user579585

Similar Messages

  • How to call a package from the Report in Oracle Application Express

    How to call a package from the Report in Oracle Application Express

    Hello,
    What do you mean? Something like SELECT mypackage.function( par1, par2) from dual?
    Or do you want to execute a procedure when something happens on the page, like clicking a button?
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • How to call our smartform in standard report

    Hi friends,
    How to call Zee smartform from standard report without affecting stadard flow.
    Thanks,
    Yogesh

    Hi,
      do it this way.
    in the ALV function call
    give in
    exporting
    I_CALLBACK_USER_COMMAND = 'user_command '
    write a subroutine
    FORM user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
    slis_selfield.
    case whatcomm.
    when 'print'.
    call 2 function modules here
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING FORMNAME = P_FORM "Your form name
    variant = ' '
    direct_call = ' '
    IMPORTING FM_NAME = FM_NAME
    EXCEPTIONS NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    EXIT.
    ENDIF.
    calling the generated function module
    CALL FUNCTION FM_NAME
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    CONTROL_PARAMETERS = CPARAM
    OUTPUT_OPTIONS = OUTOP
    USER_SETTINGS = SPACE
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    IMPORTING
    JOB_OUTPUT_INFO = TAB_OTF_DATA
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endcase.
    endform.
    This is an example in the function gereated call give you own importing and exporting parameters.
    Regards
    Kiran Sure

  • How to call a Workflow from a Report in SE38?

    How to call a Workflow from a Report in SE38?
    Please can Anyone Send me a Source code (with Explanation)which I can use for calling Workflow >> WS99900253?
    Regards,
    Shashank.

    you can use FM
    SAP_WAPI_CREATE_EVENT
    SWE_EVENT_CREATE
    OR
    SAP_WAPI_START_WORKFLOW
    Regarding usge of this FMS search the forums you will get ample examples.
    Thanks
    Arghadip

  • How to call a Shell Script from Report 6i

    Hi All,
    Can anybody tell, how to call a Shell Script from Report 6i.
    Thanks in Advance,
    Bala

    try the SRW.USER_EXIT (user_exit_string CHAR);

  • My iMac is connected to a Brother printer. I have Snow Leopard 10.7.3 As of yesterday, when I try to print a PDF it prints as a blank black page. Does anyone know how to correct this so that the PDF will print as I see it on screen?

    My iMac is connected to a Brother printer. I have Snow Leopard 10.7.3 As of yesterday, when I try to print a PDF it prints as a blank black page. Does anyone know how to correct this so that the PDF will print as I see it on screen?

    If you are running Mac OS X 10.7.3 then you have Lion installed, not Snow Leopard. It's probably not important to this discussion, but something you should be aware of.
    What application are you printing the PDF files from? Have you tried opening the PDF file using the Preview application that can be found in the Applications folder? Does the issue still occur? Have you tried other PDF files from a different source?
    Another poster in the following discussion thread reported that this method resolved their black blank PDF issue when viewing (and presumably printing) PDF files from Safari.
    https://discussions.apple.com/thread/3890509?start=0&tstart=0
    This solved my question by mcbuffy  on Apr 20, 2012 11:29 AM 
    There's a solution if you want to see the PDF inside Safari's window :
    Go to the folder : Your Hard Drive / Library / Internet Plug-ins.
    If you see a file with PDF in its name drag it to the trash.
    Quit and restart Safari to test with a PDF.
    If it works you can empty the trash.

  • How to call a badi implementaion from report program

    Hi ABAP Guru,
    I have ZBADI_FALLBACK_DEF new badi created by me and there two implementation ZBADI_FALLBACK_IMP and ZBADI_FALLBACK_IMP1
    Now I am calling this badi from report program
    DATA:
       W_HANDLE TYPE REF TO ZBADI_FALLBACK_DEF.
    * GET BADI - for getting objects..................
    GET BADI W_HANDLE.
    * CALL BADI - for calling interface methods.
    CALL BADI W_HANDLE->ADD.
    This is fine,,,
    But I want to call only one implementaion ZBADI_FALLBACK_IMP.But here two implementaion is called.Please help....

    Hi Palash,
    Then you create filter BADI  and  use filter in implementation.
    While getting BADI reference use filter
    GET BADI W_HANDLE FILTERS
    Thanks & Regards,
    Arun

  • How to call this function in onload event

    Hi All,
    I would like to call this function on page load, how to achieve? Thanks in advance.
    var siteUrl = '/sites/MySiteCollection';
    function retrieveListItems() {
    var clientContext = new SP.ClientContext(siteUrl);
    var oList = clientContext.get_web().get_lists().getByTitle('Announcements');
    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
    '<Value Type=\'Number\'>1</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
    this.collListItem = oList.getItems(camlQuery);
    clientContext.load(collListItem);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
    function onQuerySucceeded(sender, args) {
    var listItemInfo = '';
    var listItemEnumerator = collListItem.getEnumerator();
    while (listItemEnumerator.moveNext()) {
    var oListItem = listItemEnumerator.get_current();
    listItemInfo += '\nID: ' + oListItem.get_id() +
    '\nTitle: ' + oListItem.get_item('Title') +
    '\nBody: ' + oListItem.get_item('Body');
    alert(listItemInfo.toString());
    function onQueryFailed(sender, args) {
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());

    Try modifying as
    <script language="javascript" type="text/javascript">
    var siteUrl = 'http://mysite/sites/';
    $(document).ready(function()
    //Call your function here like
    ExecuteOrDelayUntilScriptLoaded(retrieveListItems,"SP.js");
    function retrieveListItems() {
    var clientContext = new SP.ClientContext(siteUrl);
    var oList = clientContext.get_web().get_lists().getByTitle('Project_Issues_and_Risks');
    var camlQuery = new SP.CamlQuery();
    // camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=\'Project_x0020_Code\'/>' +
    // '<Value Type=\'Lookup\'>NGI-P1</Value></Eq></Where></Query><RowLimit>10</RowLimit></View>');
    // <Query><Where><And><IsNotNull><FieldRef Name="ID" /></IsNotNull><IsNotNull><FieldRef Name="Title" /></IsNotNull></And></Where></Query>
    camlQuery.set_viewXml('<View><Query><Where><And><Eq><FieldRef Name="Project_x0020_Code" /><Value Type="Lookup">NGI-P1</Value></Eq><Eq><FieldRef Name="Project_x0020_Issue_x0020_Status" /><Value Type="Choice">Issue</Value></Eq></And></Where></Query></View>');
    this.collListItem = oList.getItems(camlQuery);
    clientContext.load(collListItem);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
    function onQuerySucceeded(sender, args) {
    var listItemInfo = '';
    var close = '';
    var open = '';
    var listItemEnumerator = collListItem.getEnumerator();
    while (listItemEnumerator.moveNext()) {
    var oListItem = listItemEnumerator.get_current();
    listItemInfo += '\nID: ' + oListItem.get_id()+
    '\nTitle: ' + oListItem.get_item('Close')+
    '\nBody: ' + oListItem.get_item('Open');
    close = oListItem.get_item('Close');
    open = oListItem.get_item('Open');
    alert(close);
    alert(listItemInfo.toString());
    function onQueryFailed(sender, args) {
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    </script>
    <input id="Button1" type="button" value="Retrieve Data" OnClick="retrieveListItems()" />
    Geetanjali Arora | My blogs |

  • How to call this out by clicking button from other file??

    The following coding is easy and workable...!! i wonder how do i call this out by clicking button from other file... please help!!
    import java.awt.geom.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.print.PrinterJob;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.print.*;
    public class Receipt extends JPanel implements Printable, ActionListener {
    final static Color bg = Color.white;
    final static Color fg = Color.black;
    final static Color red = Color.red;
    final static Color white = Color.white;
    final static BasicStroke stroke = new BasicStroke(2.0f);
    final static BasicStroke wideStroke = new BasicStroke(8.0f);
    final static float dash1[] = {10.0f};
    final static BasicStroke dashed = new BasicStroke(1.0f,
    BasicStroke.CAP_BUTT,
    BasicStroke.JOIN_MITER,
    10.0f, dash1, 0.0f);
    final static JButton button = new JButton("Print");
    public Receipt() {
         setBackground(bg);
    button.addActionListener(this);
    public void actionPerformed(ActionEvent e) {
    if (e.getSource() instanceof JButton) {  
    PrinterJob printJob = PrinterJob.getPrinterJob();
    printJob.setPrintable(this);
    if (printJob.printDialog()) {
    try {
    printJob.print();
    catch (Exception ex) {
    ex.printStackTrace();
    public void paintComponent(Graphics g) {
         super.paintComponent(g);
         Graphics2D g2 = (Graphics2D) g;
         drawShapes(g2);
    public void drawShapes(Graphics2D g2){
    g2.drawString("Hello world",50,50);
    public int print(Graphics g, PageFormat pf, int pi) throws PrinterException {
    if (pi >= 1) {
    return Printable.NO_SUCH_PAGE;
         drawShapes((Graphics2D) g);
    return Printable.PAGE_EXISTS;
    public static void main(String s[]){
         JFrame f = new JFrame();
         JPanel panel = new JPanel();
         panel.add(button);
         f.getContentPane().add(BorderLayout.SOUTH, panel);
         f.getContentPane().add(BorderLayout.CENTER, new Receipt());
         f.setSize(580, 500);
         f.show();

    The following coding is easy and workable...!! i wonder how do i call
    this out by clicking button from other file... please help!!Copy the code from your main() method and put it into the actionPerformed() method of the other class. If you do not need to reference the instance of Receipt from the othe class, it is that easy.

  • How to create RFC function module and how to call this function module

    Hi,
    i want to know step for creating RFC function module and then How to  use this function module from some other sap system.
    Thnaks,
    jigar

    Jigar,
    To implement a remote function module in ABAP, perform the following steps:
    Register the module as remotely callable in the RFC server system.
    In the function module Administration screen (transaction code SE37), set the field Can be called via REMOTE CALL. Registering a module as remote causes an RFC stub to be generated for it.
    Write the code for the function module.
    Create the destinations.....................
    Displaying, Maintaining and Testing Destinations
    To display, create or modify destinations, choose Tools ® Administration ® Administration ® Network ® RFC destinations or enter transaction code SM59.
    Remote Destinations are stored in table RFCDES. The RFCDES table describes logical destinations for remote function calls.
    It is not possible to maintain the RFCDES table directly.
    You can also access logical destinations via the Implementation Guide (IMG) by choosing Tools ® AcceleratedSAP ® Customizing ® Execute Project ® SAP Reference IMG.
    In the Implementation Guide, expand the following hierarchy structure:
    Basis
    Application Link Enabling (ALE)
    Sending and Receiving Systems
    Systems in Network
    Define Target Systems for RFC Calls
    Displaying Destinations
    The initial screen for this transaction displays a tree:
    Different connection types (i.e. partner systems or programs) are possible. For further information, see Types of Destinations.
    To display all information for a given destination, double-click it, or place the cursor on it and press F2 .
    To search for a destination, press the Find button and specify your selection. You get a list of all entries matching your selection. Place the cursor on the one you want, and press F2 or simply double-click the destination. All information for the given entry appears.
    Creating Destinations
    On the destinations overview screen (transaction code SM59), the connection types and all existing destinations are displayed in a tree structure.
    All available connection types are explained in Types of Destinations.
    To create a new RFC destination, press the Create button. A new screen is displayed with empty fields for you to fill in.
    If you want to create a new destination
    As you create a remote destination, you can specify a particular application server or a group of servers for a balanced distribution of system load.
    For details of the destination parameters, see Entering Destination Parameters.
    Changing Existing Destinations
    On the destinations overview screen (transaction code SM59), the connection types and all existing destinations are displayed in a tree structure.
    You can display all information for a given destination by double-clicking it or pressing F2 on it.
    To change an existing destination, double-click it, or place the cursor on it and press the Change button.
    For details of the destination parameters, see Entering Destination Parameters.
    Testing Destinations
    To test a destination, choose the appropriate function from the Test menu.
    Connection (also available via the Test connection pushbutton)
    Authorization (checks logon data)
    Local network (provides a list of application servers)
    You can use the CALL FUNCTION statement to call remote functions, just as you would call local function modules. However, you must include an additional DESTINATION clause to define where the function should run:
    CALL FUNCTION RemoteFunction
    DESTINATION Dest
    EXPORTING
    f1 =...
    f2 =...
    IMPORTING
    f3 =...
    TABLES
    t1 =...
    EXCEPTIONS......
    The field Dest can be either a literal or a variable: its value is a logical destination (for example, "hw1071_53") known to the local SAP System. Logical destinations are defined in the RFCDES table (or the TRFCD table in R/2 Systems) via transaction sm59 or the following menu path: Tools ® Administration, Administration ® Network ® RFC destinations. You can also access logical destinations via the Implementation Guide (IMG) by choosing Tools ® Customizing ® Enterprise IMG. In the Implementation Guide, you can then choose Cross-application components ® ALE ® Communication ® Define RFC destination.
    The remote function call concept, for example, allows you to access a function module in an R/2 System from an ABAP program in an R/3 System. If you want to read a customer record from your R/2 System’s database, create a remotely callable function module in the R/2 environment which retrieves customer records. Call this function from your R/3 System using a remote function call and listing the destination for the target R/2 System:
    Pls. reward if useful

  • How to call the Database views in  Reports?

    Hai experts,
                        i created one Database view in data dictionary for that how to call the that in my program?
                        are we write the select quries on views.
                         plz help me.
    thanks in adv.

    thanks for ur reply.
    how to maintain data in maintance  view . is it possible write the select query on that . I know it most be relate with forgien key.
    plz help.
    thanks in adv.

  • How to call a process in a report?

    Hi Friends,
    Is there any standard Function Module or something like callprocess   to call a process in the tcode     hrasr_test _process ?
    With Regaeds,
    SHARMILA BRINDHA.M

    HI Friend,
    Thank You for your reply.But my requirement is completely different.No need to call Function module.
    I was in need to call a process in my report from the  tcode hrasr_test_porocess.
    With Regards,
    SHARMILA BRINDHA.M

  • How to call a screen /t-code by double clicking on the output of an alv?

    Hi,
    I want to call a screen /  t-code on double clicking on the output of an alv report.
    Suppose we click on a value in the "Pur Req" feild of the ALV output  it should  open the the transaction code and give us  the  details of that particular value. How can I do that?
    Thanx in advance..

    If you displaying ALV using Classes..( CL_GUI_ALV_GRID)... You need to create event receiver and register the double click event handler method dynamically.... Here's the sample code...
    *                            C L A S S E S                             *
    class lcl_event_receiver definition.
      public section.
        methods:  handle_double_click
                  for event double_click
                  of cl_gui_alv_grid
                  importing e_row e_column.
    endclass.
    *       CLASS lcl_event_receiver IMPLEMENTATION
    class lcl_event_receiver implementation.
      method handle_double_click.
        data: l_cc like line of gt_cc.
        data:
        g_row type i,
          g_value(10),
          g_col type i,
          g_row_id type lvc_s_row,
          g_col_id type lvc_s_col,
          g_row_no type lvc_s_roid.
    *  Read the double click cell
        call method gr_grid->get_current_cell
               importing
                 e_row     = g_row
                 e_value   = g_value
                 e_col     = g_col
                 es_row_id = g_row_id
                 es_col_id = g_col_id
                 es_row_no = g_row_no.
        clear wa_itab
        read table gt_itab index g_row_id into wa_itab.
        case g_col_id.
          when 'EBELN'.                   "Show Process Order
            if not wa_itab-ebeln is initial.
              set parameter id 'BES' field wa_cc-ebeln.
              call transaction 'ME22N'  and skip first screen.
            endif.
        call method gr_grid->set_table_for_first_display
            exporting
            i_consistency_check   =  g_consistency_check
            it_toolbar_excluding  =  gt_exclude
            is_variant            =  gs_variant
            i_save                =  g_save
            i_default             =  'X'
            is_layout             =  g_layout
        changing it_outtab        =  gt_cc[]
                 it_fieldcatalog  =  gt_fieldcat[]
                 it_sort          =  gt_sortcat[].
        create object event_receiver.
    *   Register the 'Double Click' event handler method dynamically.
        set handler event_receiver->handle_double_click for gr_grid.

  • How to fetch this field for my report?

    Hi.,
    In my system I am having one zprogram, where..,
    If we enter F1 and F2 in the first screen we can present with second screen where we can have details...
    In that details we are having F3 field(Say).
    So this is not standard program. and for first screen we are having T'Code as TT1(Say).
    And the most important thing here we have to note is F3 is not fetching from any database or tables...
    So Here they are developed one code to generate that. Later they are not saving it in any data base or custom table..!
    So Now my reuirement is..,
    Here I want to develop one report with some columns(Fields) where it contains above F3.
    Now,
    I am having F1 and F2 with me.,
    So how can I get F3 Value?
    Do i need to use same logic behind the above program?
    Or,
    Can I call that second screen by inputting first screen inputs i.e F1 and F2?
    If soo, How can read F3 from second screen?
    Thanks for your attention.
    Let me know if you want any further information.
    --Naveen Inuganti.

    In your report ,u can use the same logic code to calculate F3 ,dat they have used in the program.
    If you feel value of F3 is needed in lots of places in your project,then u can develop a FM to calculte F3 inpuuting F1 and F2..and use the FM where evr u want...

  • How to call C++ function in Crystal report

    Hi,
    i am working on serious issue now, i need some help, Could you please tell me how can i call my C++ method in crystal report designer (may be formula editor), i can see only this support VB and Crystal basic.
    Regards,
    Prabhakar J.

    Hi Prabhakar,
    The name of the UFL dll must begin with U2L. Rename your and if it's compile properly CR should find it when loading all of it's dependencies.
    Check the developers help file and search for Custom User Function Library.
    I should also mention that UFL's only support MBCS string formats so if you define them they must be defined this way or CR will have problems passing them from/to your UFL. CR uses UNICODE format internally but the UFL bridge will thunk them to MBCS format on the way out and expect that format on the way in. There is a possibility of data loss in the conversion routines.
    Thank you
    Don
    Edited by: Don Williams on Jun 12, 2009 11:24 AM

Maybe you are looking for

  • How to find out what a string contains?

    I'm in the process of writing an XML parser for a project that I am working on. There will be one field in the XML that can be used to store an int, a date, or a string. I need to figure out a way to determine if that field contains an int, a date, o

  • Purchase Order, print problem

    Hi All, I created PO, and before printing I deleted the line 00010 in the PO. When I print the first line was not showing. This was expected & is fine. But today, I deleted line 00020 – 00090, when I print, the line 00020 – 00090 disappear but line 0

  • CNAME value too long

    We are trying to Setup Intune Management for mobile devices. Due to the fact that the required cname "enterpriseenrollment.manage.microsoft.com" has 41 characters our Hosting Provider is not accepting it (will only accept CNAME values with up to 36 c

  • Where can we see the consumption of material for 3 or more years

    hi mm gurus , where can we see the consumption of material for 3 or more years . pl comment on this . nagaraju.

  • URL link at the end of flv/swf video???

    Hi, I need to have a link at the end of a video so the viewer can click on it and go to a survey page. We need the viewer to watch the entire video so it has to be at the end. I'm not an AS expert but I have the Master collection so whever software i