Error while creating document with attachment.

Hi,
I am getting an error "An error occured while creating the original attribute for PDF"
I tried with out file attachment, it works as you know it is simple....
I tried with various types of attachments like .TXT and .WRD (changed both wsapplication and docfile parameters), however i get the same error. I tried both from presentation and application server (by providing   pf_ftp_dest                = 'SAPFTPA'    pf_http_dest               = 'SAPHTTPA' )
Any idea on how to solve this?
All i need is create a DMS document with a PDF attachment from application server. Are there any other ways to solve this issue?
ws_docdata-documenttype = 'ARE'.
ws_docdata-description = 'BAPI DMS'.
ws_docdata-statusextern = 'CR'.
ws_file-storagecategory = 'DMS_C1_ST'.
ws_file-wsapplication   = 'PDF'.
ws_file-description = 'Job output'.
ws_file-docfile = 'C:\CAD Integ BAPIS_46.pdf'.
append ws_file to it_files.
CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
  EXPORTING
     documentdata               = ws_docdata
IMPORTING
     return                     = v_ret
TABLES
     documentfiles              = it_files   .
BREAK-POINT.
IF v_ret-type CA 'EA'.
  ROLLBACK WORK.
  WRITE : v_Ret-message.
ELSE.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait = '5'.
ENDIF.
Thanks
Pavan

Hi,
I found that it is due to document type = 'ARE'. I changed hte document type to one of hte standard type 'TST'. It works for presentation server, but does not work for application server. Any ideas? Any help is appreciated with points.
ws_docdata-documenttype = 'TST'.
ws_docdata-description = 'BAPI DMS'.
ws_docdata-statusextern = 'CT'.
ws_docdata-documentnumber = 'ZNG-10000000017'.
ws_file-storagecategory = 'DMS_C1_ST'.
ws_file-wsapplication   = 'PDF'.
ws_file-description = 'Job output'.
ws_file-docfile = p_file.
append ws_file to it_files.
CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
  EXPORTING
    documentdata               = ws_docdata
   pf_ftp_dest                = 'SAPFTPA'
   pf_http_dest               = 'SAPHTTPA'
IMPORTING
   documentnumber             = v_docnum
   documentpart               = v_docpart
   documentversion            = v_docver
   return                     = v_ret
TABLES
   documentfiles              = it_files   .
IF v_ret-type CA 'EA'.
  ROLLBACK WORK.
  WRITE : v_Ret-message.
ELSE.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait = '5'.
ENDIF.
Thanks
Pavan

Similar Messages

  • Error while creating document numbering series via SDK add on

    Dear Experts,
    We receive the following error while creating the document numbering series through the SDK add on
    [Microsoft][SQL Server Native Client 10.0][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Too many parameters were provided in this RPC request. The maximum is 2100.
    From the above error message I can suspect the following possibilities
    1. The limit for the document numbering must be less or equal to 2100.
    2. There is a problem in the coding in SDK where it does not allow more than 2100 lines in the database.
    We tried to create manually for the same fiscal year and period indicator disconnecting the add on, the same error occured.
    Then we created a seried for a single document with the period indicator for the next fiscal year, it allowed.
    After creating the document numbering for the next fiscal year, we were able to create the numbering for the previous year also.
    Kindly help us on how to solve the same.
    With regards,
    Yeshwanth Prakash

    Hi
    You have, as far as i can determine without seeing the template,defined no Part Appraiser Column (PAPP) in your template. But you have defined a function on the template to automaticly default the part appraisers.
    On the Appraisal document persons (appraiser / appraisee) are getting defaulted as part-appraisers although no part appraisal column excist,and therefor 00 Part Appraisers are allowed. This gives the error. Remove the Part Appraisers default functionality from the template and this problem will be solved.
    FYI: The reason why this doesn't give a business check error is that the functions to default participants are BAdI's and we have no means of determining wether or not a BAdI implentation will create an inconsistency on the appraisal document.
    Also, the reason that it occurs as a S message and not as E or W is because of programming restrictions in combination with messages. All errors on the Appraisal Document will come as 'S' messages.

  • Error while creating delivery with reference to STO

    Hi,
    I am getting the following error while creating the delivery with reference to STO
    Document is incomplete: You cannot save the delivery
    Diagnosis:
    When the system checked whether saving delivery was
    permitted, it determined that the requirements stored in
    Define Incompletion Procedures for this document do not
    allow this subsequent function.
    I have checked the following already:
    1. Maintained shipping data for both the supplying and receiving plants.
    2. Shipping tab exists in the PO
    3. Shipping point determination is checked.
    4. Customer masters created for both supplying plants and receiving plant for the sales area created for STO
    5. Material master is available in both receiving and supplying plants.
    It is working fine in one client. and giving a problem only in the other.not able to figure out where the error is. appreciate your suggestions
    regards
    joe

    Hi Joseph,
                     First go to transaction "VUA4" and see what is the incompletion procedure asigned to your delivery type. Then go to
    "OVA2" and see what are the fileds maintained in incompletion procedure of the delivery type and the status groups assigned to them. Now you go to "OVA0(ZERO) and see whether the status group allows to save the delivery. If it doesn't you can untick that check box. But if this is a live system , i doubt if you would be bale to do that. Any way one of the possible causes is storgae location missing. Kindly pelase let me know If you need any more infromation on this.
    Regards,
    Ram Pedarla

  • Getting Error while creating Document object  after  parsing XML String

    Hi All,
    I have been trying to parse an XML string using the StringReader and InputSource interface but when I am trying to create Document Object using Parse() method getting error like
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    Please find the code below which i have been experimenting with:
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.StringReader;
    import java.util.List;
    import java.util.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import java.io.*;
    public class TestMain {
         public static void main(String[] args) {
              String file = "";
              file = loadFileContent("C:\\Test.xml");
              System.out.println("contents >> "+file);
              parseQuickLinksFileContent(file);
    public static void parseQuickLinksFileContent(String fileContents) {
    PWMQuickLinksModelVO objPWMQuickLinksModelVO = new PWMQuickLinksModelVO();
         try {
    DocumentBuilderFactory factory =           DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         StringReader objRd = new StringReader(fileContents);
         InputSource objIs = new InputSource(objRd);
         Document document = builder.parse(objIs); // HERE I am getting Error.
         System.out.println(document.toString());
    What is happening while I am using builder.parse() method ???
    Thanks,
    Rajendra.

    Getting following error
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.

  • Error while creating Document Templates

    Hi Experts,
    Am getting an ActiveX error while trying to create a document template designer using a webservice I created in the WST. I have consulted note 1018674 and ensured that the following browser settings are activated but still I keep getting the error.
    - Active Scripting
    - Run Active X Controls and plug-ins
    - Initialize and script ActiveX controls not marked as safe
    Also, since I had been trying to create a microsoft word type of template the system does open an instance of the word doc. Can anyone pls advice?
    How can we ensure that the webservice we have created is working. When I try to test the service in the WST tool, I keep getting the message - URL cannot be retrieved. Does it mean that the service has not been created correctly?

    Check if you done all the following settings...
    .NET Framework-reliant components:
    ○     Run components not signed with Authenticode ® Enable
    ○     Run components signed with Authenticode ® Enable
    ActiveX controls and plug-ins:
    ○     Download signed ActiveX controls ® Enable
    ○     Initialize and script ActiveX controls not marked as safe ® Enable
    ○     Run ActiveX controls and plug-ins ® Enable
    ○     Script ActiveX controls marked safe for scripting ® Enable
    Downloads:
    ○     File download ® Enable
    Miscellaneous:
    ○     Installation of desktop items ® Disable
    Scripting:
    ○     Active scripting ® Enable
    ○     Allow paste operations via script ® Enable
    ○     Scripting of Java applets ® Disable
    ●     To enable groupware integration, adjust the browser settings under Tools ® Internet Optionsu2026 ® Security ® Custom Levelu2026 as follows:
    ActiveX controls and plug-ins:
    ○     Download unsigned ActiveX controls ® Prompt.
    ○     Initialize and script ActiveX controls not marked as safe ® Enable
    ○     Run ActiveX controls and plug-ins ® Enable

  • Error while creating BOM with FM CSAP_MAT_BOM_MAINTAIN

    Hi All,
    While creating the bom with the FM "CSAP_MAT_BOM_MAINTAIN" using change number i am getting the below error message.
    " Processing of this object is not supported with change number."
    Please help me out.
    Regards
    Suresh

    call function 'CSAP_MAT_BOM_MAINTAIN'
      exporting
        material                 = material
        plant                    = plant
        bom_usage                = usage
        alternative              = alternat
        valid_from               = y_date
    *   CHANGE_NO                =                   "<----Have u used this field for creating ?
    *   REVISION_LEVEL           =
        i_stko                   = l_stko
    *   FL_NO_CHANGE_DOC         = ' '
        fl_commit_and_wait       = 'X'
        fl_bom_create            = 'X'
        fl_new_item              = ' '
        fl_complete              = ' '
    * IMPORTING
    *   FL_WARNING               =
    *   O_STKO                   =
    CSAP_MAT_BOM_CREATE would be an ideal one for creation and CSAP_MAT_BOM_MAINTAIN for change
    Regards,
    Mithun Shetty.

  • Error while creating Documents in WPC

    Hi All,
    I am trying to create a form using an article template in Web page composer (NW 7.3). When i save the form keying in the required details I get an error saying "Error while saving the document" . This is what i found in Log files and have not been able to find out what is going wrong.
    I have all the required roles but still the form saving doesn't happen.
    Please help.
    #2.0 #2011 12 30 19:44:04:495#+0530#Error#com.sap.nw.pcc.editor.EditorTool$EditorToolDynPage#
    #EP-PIN-WPC-WCM#sap.com/com.sap.nw.pcc.xmleditor#C000AC10D25D11BE0000000100001CE4#1581950000000004#sap.com/com.sap.nw.pcc.xmleditor#com.sap.nw.pcc.editor.EditorTool$EditorToolDynPage#hussain.s#771##2EBA27FD32F011E1A35300000018237E#84d32d4332f011e18d6700000018237e#84d32d4332f011e18d6700000018237e#0#Thread[HTTP Worker [@1002771266],5,Dedicated_Application_Thread]#Plain##
    PCC exception while saving a document: Unable to authenticate request!XSRF token is not valid.
    [EXCEPTION]
    com.sap.nw.pcc.km.service.editor.EditorException: Unable to authenticate request!XSRF token is not valid.
         at com.sap.nw.pcc.editor.EditorBean.saveDocument(EditorBean.java:468)
         at com.sap.nw.pcc.editor.EditorTool$EditorToolDynPage.onSave(EditorTool.java:523)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sapportals.htmlb.page.DynPage.doProcessCurrentEvent(DynPage.java:173)
         at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:106)
         at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
         at com.sap.nw.pcc.editor.EditorTool.doContent(EditorTool.java:131)
         at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:205)
         at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:121)
         at com.sap.portal.prt.core.RequestDispatcherFactory$PortalComponentRequestDispatcher$5.service(RequestDispatcherFactory.java:308)
         at com.sap.engine.services.servlets_jsp.server.deploy.impl.module.IRequestDispatcherImpl.dispatch(IRequestDispatcherImpl.java:270)
         at com.sap.portal.prt.core.RequestDispatcherFactory$PortalComponentRequestDispatcher.service(RequestDispatcherFactory.java:298)
         at com.sap.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:229)
    Thanks
    Hussain

    Hi Andrea,
    Please try below fix and check if this works for you. This solution has worked for us.
    Logon to NWA, and navigate to Configuration->Infrastructure->Java System Properties.
    Open Java System Properties and select the Instance and choose Show advanced properties.
    In the Details Section, switch to services tab and search for web container.
    Select the Web Container and in the properties serach for the string "XSRF".
    choose the property "xsrf.protection.enabled" . This property is set to true by defualt. Change it to false, save and restart portal.
    Then try saving WPC Forms
    Hope this helps.
    Thanks
    Hussain

  • Error while invoking renderPDFForm with attachment

    hi,
    I'm using ES4 renderPDFForm service to render pdf along with attachment.
    This service works if I dont have PDF attachment but doesn't work PDF with attachments.
    I'm sending the PDF attachment like below.
         Map attachments = new Map();
         MapItem item = new MapItem();
         itme.setKey("attachment");
         byte[] pdfAttachment = new byte[10,20,30...]
         com.adobe.idp.Document doc = new com.adobe.idp.Document(pdfAttachment );
         item.setValue(doc);
         attachments .add(item);
    service.renderPDFForm("CORR0040-MiscellaneousMS-8.xdp", inputData, renderSpec, spec, attachments);
    Error I'm getting is:  javax.xml.ws.soap.SOAPFaultException: java.lang.ClassCastException: java.lang.String incompatible with com.adobe.idp.Document
    Please help me how to resolve this...

    hi,
    I'm using ES4 renderPDFForm service to render pdf along with attachment.
    This service works if I dont have PDF attachment but doesn't work PDF with attachments.
    I'm sending the PDF attachment like below.
         Map attachments = new Map();
         MapItem item = new MapItem();
         itme.setKey("attachment");
         byte[] pdfAttachment = new byte[10,20,30...]
         com.adobe.idp.Document doc = new com.adobe.idp.Document(pdfAttachment );
         item.setValue(doc);
         attachments .add(item);
    service.renderPDFForm("CORR0040-MiscellaneousMS-8.xdp", inputData, renderSpec, spec, attachments);
    Error I'm getting is:  javax.xml.ws.soap.SOAPFaultException: java.lang.ClassCastException: java.lang.String incompatible with com.adobe.idp.Document
    Please help me how to resolve this...

  • Error while uploading document with same name in Document library

    Hi,
    Whenever I try to upload document with same name in Document library it throws an error. I know its a default behavior but is there any way so that I can upload documents with same name or can we append some unique id with title of the document?
    Please suggest.
    Thanks

    No, unfortunately this is not possible. SharePoint treats the file name as the primary key identifier for a document so if you try to upload a second document with the same name it will assume this is a new version of the file. If you have versioning enabled
    on the document library, it will add this as a new version. If not, it will overwrite the original file with the new one.
    If you need two documents with the same name, you will have to either place them in different folders within a document library or in different document libraries.
    http://stackoverflow.com/questions/11894968/uploading-documents-with-same-name-to-sharepoint-2010
    Regards,
    Rajendra Singh
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful
    http://sharepointundefind.wordpress.com/

  • Error while creating snapshot with OEL6.5 guest in VMware.

    While creating snapshots we are getting the following kernel messages:
    ------------[ cut here ]------------
    WARNING: at fs/ext4/super.c:341 ext4_journal_start_sb+0x129/0x140 [ext4]()
    Hardware name: VMware Virtual Platform
    Modules linked in: autofs4 ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables ipv6 ppdev vmw_balloon parport_pc parport coretemp hwmon crc32c_intel ghash_clmulni_intel microcode pcspkr sg i2c_piix4 vmw_vmci shpchp ext4 jbd2 mbcache sd_mod crc_t10dif sr_mod cdrom aesni_intel ablk_helper cryptd lrw aes_x86_64 xts gf128mul mptspi mptscsih mptbase scsi_transport_spi vmxnet3 floppy pata_acpi ata_generic ata_piix vmwgfx ttm drm i2c_core dm_mirror dm_region_hash dm_log dm_mod [last unloaded: speedstep_lib]
    Pid: 4123, comm: master Not tainted 3.8.13-44.1.1.el6uek.x86_64 #2
    Call Trace:
    [<ffffffff8105d67f>] warn_slowpath_common+0x7f/0xc0
    [<ffffffffa019abd7>] ? ext4_dirty_inode+0x27/0x60 [ext4]
    [<ffffffff8105d6da>] warn_slowpath_null+0x1a/0x20
    [<ffffffffa01b7f89>] ext4_journal_start_sb+0x129/0x140 [ext4]
    [<ffffffffa019abd7>] ext4_dirty_inode+0x27/0x60 [ext4]
    [<ffffffff811bae4f>] __mark_inode_dirty+0x3f/0x1f0
    [<ffffffff811ab026>] update_time+0xa6/0xe0
    [<ffffffff811ab0f8>] file_update_time+0x98/0xe0
    [<ffffffff8119a90d>] pipe_write+0x34d/0x6b0
    [<ffffffff81191b87>] do_aio_write+0xc7/0xd0
    [<ffffffff8101a719>] ? emulate_vsyscall+0x329/0x3d0
    [<ffffffff81191c37>] do_sync_write+0xa7/0xe0
    [<ffffffff81191fc4>] vfs_write+0xb4/0x130
    [<ffffffff811a47d5>] ? poll_select_set_timeout+0x95/0xb0
    [<ffffffff8119276f>] sys_write+0x5f/0xa0
    [<ffffffff815a0a59>] system_call_fastpath+0x16/0x1b
    ---[ end trace 4525293ca5c40077 ]---
    According to Jan Kara:
    It seems like you are hitting the warning:
    WARN_ON(sb->s_writers.frozen == SB_FREEZE_COMPLETE);
    which means that writing to a named pipe is modifying timestamp of a file while filesystem is frozen. This is not harming the fs such but the fs snapshot you are presumably taking may be slightly inconsistent.
    I see the process which is writing to the named pipe is "postfix". Had anyone else seen this behavure before and meaby have a solution for it?

    kernel/git/torvalds/linux.git - Linux kernel source treehttp://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7e775f46a125f894a1d71e96797c776dbec161f0has it fixed.
    http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7e775f46a125f894a1d71e96797c776dbec161f0

  • Error while creating document in cv01n

    In cv01n while attaching excel,word etc.file,at the time of saving error massege given is document can not change.Please provide me solution

    I have checked the img setting ,img setting is ok,still it gives program error  as below,can you suggest me whether reccomndations can implemented or not.
    Note 964021 -Update Task Fails When New Version Created
    Note Language: English Version: 2 Validity: Valid from 07.11.2006
    Summary
    Symptom
    Update task fails when a new version of an old document info record is
    created using CV02n transaction.The system throws an update terminate
    error.
    More Terms
    UPDATE TERMINATE, MESSAGE 26 178, CV200_DB_DOC_UPDATE, CV02N
    Cause and Prerequisites
    Program Error
    Solution
    Implement the note
    Header Data
    Release Status: Released for Customer
    Released on: 07.11.2006 12:13:26
    Priority: Correction with medium priority
    Category: Program error
    Main Component CA-DMS Document management
    Valid Releases
    Software Component Release From
    Release
    To Release and Following
    SAP_APPL 500 500 500
    SAP_APPL 600 600 600
    Support Packages
    Support Packages Release Package Name
    SAP_APPL 500 SAPKH50016
    SAP_APPL 600 SAPKH60008
    Attributes
    Attribute Value
    SAP objects CV200_DB_DOC_UPDATE
    Transaction codes CV02N,CV03N
    Transaktionscodes - manuell CV02N,CV03N
    SAP-Objekte - manuell CV200_DB_DOC_UPDATE
    DownPort/UpPort-WF UpPort check done, symptom
    repaired
    Correction Instructions
    19.06.2008 Page 1 of 2
    Note 964021 -Update Task Fails When New Version Created
    Correction
    Instructio
    ns
    Valid
    from
    Valid
    to
    Software
    Component
    Typ
    e
    Reference
    Correction
    Last
    Changed
    518092 500 500 SAP_APPL C P6DK093226 07.11.2006 17:30:29
    807328 600 600 SAP_APPL C P7DK042952 13.07.2006 14:50:41
    *) C Correction, B Pre-Implementation, A Post-Implementation, M Undetermined
    19.06.2008 Page 2 of 2

  • Error while creating table with clusters

    Hi
    I tried the following
    CREATE CLUSTER emp_dept (deptno NUMBER(3))Cluster is created
    Then i tried to create the table having the above cluster but giving the errors:
    create table emp10 (ename char(5),deptno number(2) )cluster emp_dept(deptno);The error is:
    ORA-01753 column definition incompatible with clustered column definitionCould you please help me in this

    Your cluster is based on a NUMBER(3) data type while the emp10 table has a deptno column with a data type of NUMBER(2).

  • Error while creating MBO with web service data source

    Hi All,
         I am trying to create MBO by selecting web service as a data source type in SMP 2.3. I am providing sharepoint webservice url of type wsdl with HTTP basic authentication. However, I am getting following error can anyone help me in that. Looking for detail explaination as this is new for me...
    (For "define XSLT manually" I am using sample .xsl file)
    Regards,
    Harshada

    Harshada Karane
    Are you using any proxy in your browser? If yes, please set the proxy in workspace and then trHow to bypass proxy settings in SMP workspace for connecting any public Web Service within corporate Network
    Rgrds
    JK

  • Error while creating PR with account assignment K

    Hello All,
    We have a issue  for one user , he is trying to created PR in ME51N in production system  but cannot and he gets the error message " Field selection PT8B not defined'. Infact the the field selection PT8B itself  is not there in the configuration. But in quality system the user  is able to create PR without any issue.
    Also  his colleague can able to create the PR in production in ME51N without any issues.  Even i am able to create the PR in ME51N in quality system without any problem , i came across the exact issue in the below thread , since the issue is only for that specific user , i am not able to find the cause.
    EROR while saving PR
    Pls provide your inputs/suggestions
    Thanks
    Benny

    Hi Benny,
    There's possibility to assign different screen layouts to different users 8and of course the screen layout for the same users in different systems can be different). It is included in "functional auth. for byers" and can be found in IMG under Purchasing -> Auth. mgmt. Each code here has among other fields a field called "field selection", which presumably contains PT8B for one of the func. auth. codes. This func. auth. code is in turn linked to the user master record by means of the parameter EFB ("own data" or trs SU3 or trs SU01).
    Therefore it is very much possible that the different users are allocated to the different func. auth. codes and the same user in the quality system is allocated to the different func. auth. code than in prod.
    BR
    Raf

  • Error while creating function with record type as return type

    Hi i tried the following code to get the nth highest sal using record type and function.
    CREATE OR REPLACE PACKAGE pack_rec_cur AS
    TYPE rec_type IS RECORD (
    name EMP.ename%TYPE,
    sal EMP.sal%TYPE);
      END;The above package is created
    CREATE OR REPLACE
      FUNCTION fun_rec_cur(n INT) RETURN pack_rec_cur.rec_type AS
       rec pack_rec_cur.rec_type;
        CURSOR cur_rec IS
          SELECT ename,sal
            FROM emp
             WHERE sal is not null
              ORDER BY DESC;
    BEGIN
    OPEN cur_rec;
      FOR i IN 1..n LOOP
       FETCH cur_rec into rec;
       EXIT WHEN cur_rec%NOTFOUND;
      END LOOP;
    CLOSE cur_rec;
    RETURN rec;
    END;   The above function is giving errors
    LINE/COL ERROR
    4/7      PL/SQL: SQL Statement ignored
    7/16     PL/SQL: ORA-00936: missing expression
    SQL> Could you please correct me where i'm doing mistake
    Thanks.

    You are missing the column name in order by clauase. Is it ename desc?
    CREATE OR REPLACE
      FUNCTION fun_rec_cur(n INT) RETURN pack_rec_cur.rec_type AS
       rec pack_rec_cur.rec_type;
        CURSOR cur_rec IS
          SELECT ename,sal
            FROM emp
             WHERE sal is not null
              ORDER BY ENAME DESC; ---added ename
    BEGIN
    OPEN cur_rec;
      FOR i IN 1..n LOOP
       FETCH cur_rec into rec;
       EXIT WHEN cur_rec%NOTFOUND;
      END LOOP;
    CLOSE cur_rec;
    RETURN rec;
    END;  
    -OUTPUT
    SQL> SET SERVEROUT ON
    SQL>
    SQL> DECLARE
      2     rec            pack_rec_cur.rec_type;
      3  BEGIN
      4     rec         := fun_rec_cur (6); --you get the 6th record in order of ename desc
      5     DBMS_OUTPUT.put_line ('ename::' || rec.NAME || '  sal ::' || rec.sal);
      6  END;
      7  /
    ename::MARTIN  sal ::1250
    PL/SQL procedure successfully completed.
    SQL>

Maybe you are looking for

  • Broke FileHistory in Windows 8.1 - how to fix?

    I recently discovered the Windows 8.1 FileHistory feature when I was looking for Backup. I configured it to use an external USB drive and turned it on. I soon observed that it was eating up space way too fast. I realized the was the virtual machines

  • Applications folder won't let me in - must authenticate!

    Strange change. I can't create a new folder in the Applications folder. The menu item is grayed out. If I try to create a folder elsewhere and drag it over then I get a message that the Ap folder cannot be modified and I must authenticate. I checked

  • Automatically open movies in Quicktime Full Screen

    I know that if I open a movie file in Quicktime I can go to to: window/show movie properties/presentation/enter full screen mode when opened & then the movie will start on full screen when i play it. But how can i avoid this step if i want all movies

  • Grid has appeared updating from CS5.5 to CS6

    Just updated a project to CS6, it was created on CS5.5 on a mac. Three clips now have a wide purple grid over them in the Program window and on my external monitor. All three of these clips have linked audio (recorded on location) and also some motio

  • IPhone 5 unable to verify account information

    I use iCal for my calendar.  I have an iMac and Ipad2 which both connect to the server just fine.   My new iPhone 5 (which has the same user name, server information and password) as my iPad2 will not verify account information.  I have added the opt