Generating itab- xml and xml- pdf

i am generating a report program, content of a table is store in itab and i want my report program to generate xml file for the content of itab first and after that, by using that xml file i want to generate pdf file

hi
try this  ...
tables:
  tsp01.
*-- STRUCTURES
data:
  mstr_print_parms like pri_params,
  mc_valid(1)      type c,
  mi_bytecount     type i,
  mi_length        type i,
  mi_rqident       like tsp01-rqident.
*-- INTERNAL TABLES
data:
  mtab_pdf    like tline occurs 0 with header line,
  mc_filename like rlgrap-filename.
*-- SELECTION SCREEN
data :
  p_repid like sy-repid value '<i><b>ur prg name havin the itab to b displayed</b></i>', " Report to execute
  p_linsz like sy-linsz value 132, " Line size
  p_paart like sy-paart value 'X_65_132'.  " Paper Format
If user want use this as common program for all PDF Conversion
then use the parameter option, which will get the report name
Line size & Paper Format as input
*parameters:
p_repid like sy-repid, " Report to execute
p_linsz like sy-linsz default 132, " Line size
p_paart like sy-paart default 'X_65_132'.  " Paper Format
start-of-selection.
concatenate 'c:\'
            p_repid
            '.pdf'
  into mc_filename.
*-- Setup the Print Parmaters
CALL FUNCTION 'GET_PRINT_PARAMETERS'
exporting
     no_dialog = 'X'
  IMPORTING
    out_parameters       = mstr_print_parms
    valid                = mc_valid
  EXCEPTIONS
    invalid_print_params = 2
    OTHERS               = 4.
*-- Make sure that a printer destination has been set up
*-- If this is not done the PDF function module ABENDS
  if mstr_print_parms-pdest = space.
    mstr_print_parms-pdest = 'LOCL'.
  endif.
*-- Explicitly set line width, and output format so that
*-- the PDF conversion comes out OK
  mstr_print_parms-linsz = p_linsz.
  mstr_print_parms-paart = p_paart.
  submit (p_repid) to sap-spool without spool dynpro
                   spool parameters mstr_print_parms
                   via selection-screen
                   and return.
*-- Find out what the spool number is that was just created
  perform get_spool_number using sy-repid
             sy-uname
    changing mi_rqident.
*-- Convert Spool to PDF
  call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
    exporting
      src_spoolid = mi_rqident
      no_dialog  = space
      dst_device = mstr_print_parms-pdest
    importing
      pdf_bytecount                  = mi_bytecount
    tables
      pdf        = mtab_pdf
    exceptions
      err_no_abap_spooljob           = 1
      err_no_spooljob                = 2
      err_no_permission              = 3
      err_conv_not_possible          = 4
      err_bad_destdevice             = 5
      user_cancelled                 = 6
      err_spoolerror                 = 7
      err_temseerror                 = 8
      err_btcjob_open_failed         = 9
      err_btcjob_submit_failed       = 10
      err_btcjob_close_failed        = 11
      others     = 12.
call function 'DOWNLOAD'
     exporting
          bin_filesize            = mi_bytecount
          filename                = mc_filename
          filetype                = 'BIN'
     importing
          act_filename            = mc_filename
     tables
          data_tab                = mtab_pdf.
      FORM get_spool_number *
      Get the most recent spool created by user/report              *
-->  F_REPID               *
-->  F_UNAME               *
-->  F_RQIDENT             *
form get_spool_number using f_repid
     f_uname
                changing f_rqident.
  data:
    lc_rq2name like tsp01-rq2name.
  concatenate f_repid+0(9)
              f_uname+0(3)
    into lc_rq2name.  " separated by '_'.
  select * from tsp01 where  rq2name = lc_rq2name
  order by rqcretime descending.
    f_rqident = tsp01-rqident.
    exit.
  endselect.
  if sy-subrc ne 0.
    clear f_rqident.
  endif.
endform." get_spool_number
*reward if useful.
Message was edited by:
        neha gupta

Similar Messages

  • Outlook Quirk With E-Mail Submission of XML and/or PDF

    Hello all.
    I am running into an annoying little Outlook quirk when testing e-mail submissions of PDF forms. When the submit button is clicked, Outlook will open a new message window as it should, but the
    Send button will not trigger when clicked. The new message window doesn't react, it just sits there normally. Also,
    Ctrl+Enter doesn't work either. But...if I save the message as a draft, and then send from Outlook's drafts folder, the e-mail miraculously goes its merry way.
    I have tried this out with submitting the XML data by e-mail and with sending the completed PDF via e-mail (both by revising the
    Submit By E-mail button's submit node to "PDF" in the XML and by using a regular button and changing the field's control type and submit info).
    Does anyone have any ideas as to why Outlook is being finicky with this? I am running Office Outlook 2003 on Windows XP Pro and I use LiveCycle Designer 7.0 to create and edit the forms and Acrobat Pro 8.0 to test. My testers also use Outlook 2003/WinXP Pro and use Acrobat Pro 7.0 to fill in the forms.
    Thanks for the time and any help.
    M.L. Stone
    [ a g d g ]

    Try: Edit > Preferences > General > Reset All Warnings

  • How to Convert internal table data into xml and xml data into internal tab

    Hi Guys,
          I have a requirement  that  i have to convert the internal table data into xml format and viceversa . for my requirement  i came to know that i have to use Transformations concept.  i done the converting the data from internal table into xml data by using standard Tranformations. My Question is 
    1) Can i use same Transformation to convert the xml data into abap internal table. if it is possible then how ???
    2) Is it possible using the standard Transformation  or I have to go for XSLT approach
    Please help me out from this guys,
    Thanks and Regards
    Koti

    Hi Koti,
    This is possible. There is a link. With the help of this link you can convert ABAP data to XML and vice versa.
    Link: http://www.heidoc.net/joomla/index.php?option=com_content&view=article&id=15:sapxslt&catid=22:sap-xslt&Itemid=31

  • Defining XSLT from Abap to XML and XML to Abap (Internal Table)

    Hi Experts, I need help with this XSLT for call transformation. I have defined an internal table and intend to use it as a source for Call Tranformation. But I have a Problem defining its XSLT and help would be greatly appreciated! I also wonder if this XSLT can be used for XML to internal table? Or do I have to define another XSLT again.... Hope to hear from any of u soon!
    CODES->>>
    TYPES: BEGIN OF CONTENT,
             CONTENT1(20),
             CONTENT2(20),
           END OF CONTENT.
    TYPES: T_CONTENT TYPE TABLE OF CONTENT.
    DATA: BEGIN OF I_DATA OCCURS 0,
            KEY1(10),
            KEY2(10),
            CONT TYPE T_CONTENT,
          END OF I_DATA.
    DATA: WA_TBL TYPE CONTENT.
    DATA: LI_TBL TYPE T_CONTENT.
    START-OF-SELECTION.
    populate data 1
      CLEAR I_DATA.
      I_DATA-KEY1 = 'AMI'.
      I_DATA-KEY2 = 'LEE'.
      CLEAR WA_TBL.
      REFRESH LI_TBL.
      WA_TBL-CONTENT1 = 'PENHAS ROAD'.
      WA_TBL-CONTENT2 = 'SG'.
      APPEND WA_TBL TO LI_TBL.
      WA_TBL-CONTENT1 = 'GILLMAN ROAD'.
      WA_TBL-CONTENT2 = 'SG'.
      APPEND WA_TBL TO LI_TBL.
      I_DATA-CONT = LI_TBL.
      APPEND I_DATA.
    populate data 1
      CLEAR I_DATA.
      I_DATA-KEY1 = 'KAI'.
      I_DATA-KEY2 = 'LEE'.
      CLEAR WA_TBL.
      REFRESH LI_TBL.
      WA_TBL-CONTENT1 = 'SUNSET WAY'.
      WA_TBL-CONTENT2 = 'SG'.
      APPEND WA_TBL TO LI_TBL.
      WA_TBL-CONTENT1 = 'BEDOK NORTH'.
      WA_TBL-CONTENT2 = 'SG'.
      APPEND WA_TBL TO LI_TBL.
      I_DATA-CONT = LI_TBL.
      APPEND I_DATA.
    call transformation (xslt)
        source i_data = i_data
        result xml xmlstr.

    here is the code sample using ixml library .
    just create a report program and copy paste the following code.
    if time permits, later on i will post the xslt program which you can use it call transformation.
    REPORT  y_test_xml.
    DATA: l_ixml                                 TYPE REF TO if_ixml,
            l_ixml_sf                              TYPE REF TO if_ixml_stream_factory,
            l_istream                              TYPE REF TO if_ixml_istream,
            l_ostream                              TYPE REF TO if_ixml_ostream,
            l_booklist                   TYPE REF TO if_ixml_element,
            l_document                             TYPE REF TO if_ixml_document,
            l_parser                               TYPE REF TO if_ixml_parser,
            l_root_element                         TYPE REF TO if_ixml_element,
            l_book_record                            TYPE REF TO if_ixml_element,
            l_date TYPE REF TO if_ixml_element ,
                    l_time TYPE REF TO if_ixml_element ,
            l_book_group                            TYPE REF TO if_ixml_element,
            l_book_cat                            TYPE REF TO if_ixml_element ,
            others                                  TYPE REF TO if_ixml_element ,
            link                                    TYPE REF TO if_ixml_element ,
            description                            TYPE REF TO if_ixml_element ,
            xml                                    TYPE xstring ,
            size TYPE  i ,
             l_xml  TYPE REF TO cl_xml_document  .
    DATA: xml_out TYPE string ,
          temp_string TYPE string .
    TYPES: BEGIN OF add_category,
    category_id(10),
    category_desc(40),
    END OF add_category,
    add_t_category TYPE add_category OCCURS 0 .
    TYPES: BEGIN OF add_book_grp,
    book_category TYPE add_t_category,
    END OF add_book_grp,
    add_t_book_grp TYPE add_book_grp OCCURS 0.
    TYPES: BEGIN OF add_book,
    book_num(10) TYPE c,
    short_desc(40) TYPE c,
    book_group TYPE add_t_book_grp,
    END OF add_book,
    add_t_book TYPE add_book OCCURS 0.
    TYPES: BEGIN OF type_data,
    date TYPE sy-datum,
    time TYPE sy-uzeit,
    book_record TYPE add_t_book,
    END OF type_data.
    DATA: i_data TYPE type_data OCCURS 0 WITH HEADER LINE.
    DATA: itab LIKE soli OCCURS 0 WITH HEADER LINE.
    DATA: cat_wa TYPE add_category ,
          bk_gp_wa TYPE add_book_grp ,
          bk_rec_wa TYPE add_book ,
          bk_wa LIKE LINE OF i_data .
    DATA: cat_tab TYPE STANDARD TABLE OF add_category ,
          bk_gp_tab TYPE STANDARD TABLE OF add_book_grp ,
          bk_rec_tab TYPE STANDARD TABLE OF add_book .
    MOVE: '03' TO cat_wa-category_id  ,
          ' BK GP 3' TO cat_wa-category_desc .
    APPEND cat_wa TO cat_tab .
    MOVE: '02' TO cat_wa-category_id  ,
          ' BK GP 2' TO cat_wa-category_desc .
    APPEND cat_wa TO cat_tab .
    bk_gp_wa-book_category  = cat_tab.
    APPEND bk_gp_wa TO bk_gp_tab .
    MOVE: '0012345678' TO bk_rec_wa-book_num ,
          'OMS book' TO bk_rec_wa-short_desc .
    bk_rec_wa-book_group = bk_gp_tab .
    APPEND bk_rec_wa TO bk_rec_tab .
    CLEAR:bk_gp_tab, cat_tab .
    REFRESH :bk_gp_tab, cat_tab .
    MOVE: '01' TO cat_wa-category_id  ,
          ' BK GP 1' TO cat_wa-category_desc .
    APPEND cat_wa TO cat_tab .
    MOVE: '09' TO cat_wa-category_id  ,
          ' BK GP 9' TO cat_wa-category_desc .
    APPEND cat_wa TO cat_tab .
    bk_gp_wa-book_category  = cat_tab.
    APPEND bk_gp_wa TO bk_gp_tab .
    MOVE: '00123456789' TO bk_rec_wa-book_num ,
          'SAP book' TO bk_rec_wa-short_desc .
    bk_rec_wa-book_group = bk_gp_tab .
    APPEND bk_rec_wa TO bk_rec_tab .
    MOVE: sy-datum TO bk_wa-date ,
          sy-uzeit TO bk_wa-time .
    bk_wa-book_record = bk_rec_tab .
    APPEND bk_wa TO i_data .
    CLEAR: cat_wa , bk_gp_wa ,bk_rec_wa , bk_wa .
    l_ixml = cl_ixml=>create( ).
    l_ixml_sf = l_ixml->create_stream_factory( ).
    l_document = l_ixml->create_document( ).
    l_root_element = l_document->create_element( name = 'asx:abap' ).
    l_root_element->set_attribute( name = 'xmlns:asx' value = 'http://www.sap.com/abapxml' ) .
    l_root_element->set_attribute( name = 'version' value = '1.0' ).
    l_document->append_child( new_child = l_root_element ).
    others = l_document->create_simple_element( parent = l_root_element name = 'asx:values' ).
    l_booklist = l_document->create_simple_element( parent = others name = 'BOOKLIST' ).
    LOOP AT i_data INTO bk_wa .
      CLEAR temp_string .
      MOVE: bk_wa-date TO temp_string .
      l_date = l_document->create_simple_element( parent = l_booklist name = 'DATE' value = temp_string  ).
      CLEAR temp_string .
      MOVE: bk_wa-time TO temp_string .
      l_time = l_document->create_simple_element( parent = l_booklist name = 'TIME' value = temp_string ).
      LOOP AT bk_wa-book_record INTO bk_rec_wa .
        l_book_record = l_document->create_simple_element( parent = l_booklist name = 'BOOK_RECORD' ) .
        CLEAR temp_string .
        MOVE: bk_rec_wa-book_num TO temp_string .
        l_date = l_document->create_simple_element( parent = l_book_record name = 'BOOK_NUM' value = temp_string ).
        CLEAR temp_string .
        MOVE: bk_rec_wa-short_desc TO temp_string .
        l_time = l_document->create_simple_element( parent = l_book_record name = 'SHORT_DESC' value = temp_string ).
        l_book_group = l_document->create_simple_element( parent = l_book_record name = 'BOOK_GROUP' ).
        LOOP AT bk_rec_wa-book_group INTO bk_gp_wa .
          LOOP AT bk_gp_wa-book_category INTO cat_wa .
            l_book_cat = l_document->create_simple_element( parent = l_book_group name = 'BOOK_CATEGORY' ).
            CLEAR temp_string .
            MOVE: cat_wa-category_id TO temp_string .
            l_date = l_document->create_simple_element( parent = l_book_cat name = 'CATEGORY_ID' value = temp_string ).
            CLEAR temp_string .
            MOVE: cat_wa-category_desc TO temp_string .
            l_time = l_document->create_simple_element( parent = l_book_cat name = 'CATEGORY_DESC' value = temp_string ).
          ENDLOOP .
        ENDLOOP .
      ENDLOOP .
    ENDLOOP .
    l_ostream = l_ixml_sf->create_ostream_xstring( xml ).
    l_document->render( ostream = l_ostream ).
    CREATE OBJECT l_xml.
    CALL METHOD l_xml->parse_xstring
      EXPORTING
        stream = xml.
    l_xml->render_2_string(
      EXPORTING
        pretty_print = 'X'
      IMPORTING
    *    RETCODE      = RETCODE
        stream       = xml_out
        size         = size
    CALL METHOD l_xml->display.
    Hope this is helpful.
    do let us know how it goes.
    Regards
    Raja

  • Using JCo : IDoc to XML and XML to IDoc

    Hey guys,
    I need some guidance on Creating an xml file out of an IDoc using JCo and vice versa.
    Can anybody please provide with the code samples or any kind of documentation on this topic.
    Points will be rewarded
    +| Eleana West

    Hi,
    what you are looking for is the sapidocjco.jar. You can get if from the service marketplace and it comes with a couple of example Java code which shows how to implement it. You will also need the normal JCo jar to use the sapidocjco.jar.
    Bye,
    Sameer

  • Conversion of ABAP struct to XML and XML back to ABAP structure in ECC

    We would like to convert many ABAP structure and internal tables into an XML string and later on convert these XML strings back to ABAP structures and internal tables. Can someone let us know if there are any function modules in ECC which can import the structures or internal tables and export the XML. Also if there are any function modules which can do the reverse i.e. import the XML string and convert it back to Structure or internal table.
    We found the some method called "Call transformation" but it gives an error such as version not active. CRM has FMs which do these functionalities.
    Any guidance would be appreciated.
    Thanks.

    If you look into the FM's BANK_API_PP_UT_DATA_TO_XML and BANK_API_PP_UT_XML_TO_DATA they again use CALL TRANSFORMATION, so probably u might have to figure how to eliminate the errors ur getting using CALL TRANSFORMATION.

  • Correlate XML and PDF file/mail

    Following ugly requirement: PI receives XMLfiles and mails with PDF attachment. The XML contains the plain invoice data, the PDF is the signed invoice. PI sends both types as files to the customer. But the customer wants that files which belong together (see below) are sent within a time interval of max. 6 hours.
    Problem is, the PDF is signed by an external partner which may need longer than those 6 hours. And the supplier is not able to hold back the corresposing XML files.
    I fear the only way to solve it is by integration process (?)
    The XML has a file reference tag, which corresponds to the mail attachment name, so in theory, we know what fits together. But the PDF is a binary message, so how to definine a correlation definition on it ? Do I need to map the PDF into an own XML structure, e.g. some header tag which contains the attachment name, and a base64 tag which contains the PDF ? But then I would later have to recreate the binary PDF, after the 2 messages are correlated. Is that possible in the process ? Can I map message 2 again when it leaves the process ?
    We are on PI 7.0, soon 7.1
    CSY

    Additional info: I just implemented the solution with 2 receiver interfaces. And write both messages with file reveiver channels, one of them uses the PayloadSwapBean. Works great. The solution is better than the zip option, because now I can even set the filename as I want:
    1. for the XML file, I can just use the adapter specific attribute filename (= use the name of the original XMLfile)
    2. for the PDF file, this does not work without additional change because it was read as attachment with the XML file, and so gives the name of the XML file, and the original PDF filename is not in the PI message anymore. But I just add a Java mapping in the routing of the PDF file, and set the needed filename value in dynamic configuration (read the value, remove .xml and append .pdf)
    CSY

  • Check Writer XML - Check count different between XML and PDF

    Hello all, Check writer XML ends in a warning. Hence the user can't see the output. I go to the server and grab both the .XML and the .PDF files. The PDF file as 93 checks but the actual .XML file has 112 checks. Hence the warning. Did anyone experience the same problem? Any help is highly appreciated.
    Thanks, Naveen G.

    Hi,
    We just figured it out. From SYS Admin> Profile> System, we increased the values of Concurrent: OPP Process Timeout and Concurrent: OPP Response Timeout from 300 to 900. Now Check Writer XML CompleteS without any warnings. I appreciate your response.
    Thank You, Naveen G.

  • JCo Calling BAPI and generate htm and xml page in output

    Friends,
            I am developing an Application in Java using JCO. The requirement there is a list of BAPI's are available for the selection, once the user select the BAPI , it will dynamically generates the screen of input parameters and than result will be stored in .htm and .xml file. It works for many BAPI's, but for few of that it won't work. Will you help me out why its gng to create problem for other BAPI's.
    e.g.
    BAPI_SALESORDER_GETLIST
    BAPI_PO_GETITEMS
    BAPI_MATERIAL_GET_DETAIL and few more...
    It doesn't generate the proper output of these BAPI's.
    Thanks.
    HItesh Shah

    Tanveer,
    There are many files so i wont be able to put the codes but let me tell u how i m doing.
    1) Giving the options to user in which server they want to connect.
    2) After connection has been established there is a plain text file available which consists the list of BAPI's which will be displayed in the list box.
    3) After user select any BAPI and press a button named 'DETAILS' it will display the Import/Export/Tables list.
    4) After clicking on Next , i m generating a dynamic screen for input parameters.
    5)Here is this step also one problem is that i have to write all the zeros, can u tell me if i want to pad the zeroes automatically what i will do.Becz every time the input parameters of each BAPI would be different.
    6) After getting input parameters i will generate the .htm and .xml file using writeXML and writeHTML function.
    7) I want to show them generated xml and html file in iexplore using clicking button...Can u tell me how to achieve that.
    Here is the code through which my xml and htm file will be generated.
    import com.sap.mw.jco.*;
    import java.io.*;
    import java.util.*;
    import java.math.*;
    import java.util.Iterator;
    // Quick imports
    import com.jxml.quick.QDoc;
    import com.jxml.quick.Quick;
      class RFCG {
          static final String SID = "R3";
          String conDetails []=new String[6];
          String ErrorMsg;
          int i=0;
          String LogonDetail;
          int Rows;
          IRepository repository;
          String InputName[]=new String[200];
          String InputType[]=new String[200];
          String OutputName[]=new String[200];
          String OutputType[]=new String[200];
          String OutputINTTYPE[]=new String[200];
          String OutputField[]=new String[200];
          String TableName[]=new String[500];
          String TableType[]=new String[500];
          String TableINTTYPE[]=new String[500];
          String FIELDNAME[]=new String[500];
          //String FIELDNAME[]=new String[20];
          String FIELDINTTYPE[]=new String[500];
          String OutputFieldType[]=new String[200];
          String OutputFieldINTTYPE[]=new String[200];
          String InputParFieldName[][]=new String[200][200];
          String InputParFieldDatatype[]=new String[200];
          String InputParFieldIntType[]=new String[200];
          int l,j,k,m,n,o,t,q;
           /** public static void main(String [] args){
                  new RFCG("SAPR3.txt");
             public RFCG(String LogonDetail,String BAPI)
                      this.LogonDetail=LogonDetail;
                      cleanUp();
                      try {
                                 /* for xml */
                                 // Initialize Quick
                                  QDoc schema = PersonSchema.createSchema();
                              // Convert input XML to Java
                                  QDoc doc = Quick.parse(schema, "input.xml");
                             // Get the result
                                  Person person = (Person)Quick.getRoot(doc);
                               for (Iterator i = person.getClientList().iterator(); i.hasNext(); ) {
                                            Client number = (Client)i.next();
                                           // String type=number.getType();
                                            //System.out.println(type);
                                           // System.out.println(LogonDetail+"LOGO");
                                            if(LogonDetail.equals(number.getType())){
                                                   //conDetails[0]=number.getType();
                                                   conDetails[0]=number.getSapclient();
                                                   conDetails[1]=number.getUserid();
                                                   conDetails[2]=number.getPassword();
                                                   conDetails[3]=number.getLanguage();
                                                   conDetails[4]=number.getHostname();
                                                   conDetails[5]=number.getSystemnumber();
                                            //System.out.println("  Client Type(" + number.getType() + "):");
                                          //System.out.println("  Sapclient " + number.getSapclient());
                                          //System.out.println("  Userid  " + number.getUserid());
                                          //System.out.println("  Password " + number.getPassword());
                                          //System.out.println("  Language " + number.getLanguage());
                                          //System.out.println("  Hostname  " + number.getHostname());
                                          //System.out.println("  Systemnumber  " + number.getSystemnumber());
                                          //System.out.println("   \n  ");
                               } catch (Exception e) {
                                     e.printStackTrace();
                      Connect(LogonDetail);
                      zbapi(BAPI);
                      new BapiParameters1(InputName,InputType,OutputName,OutputType,TableName,TableType,BAPI,repository,OutputINTTYPE,FIELDNAME,FIELDINTTYPE,OutputField,OutputFieldType,OutputFieldINTTYPE,LogonDetail,InputParFieldName,InputParFieldDatatype,InputParFieldIntType);
                      for (int i = 0; i < 10; i++) {
                               //System.out.println("STRING***RFCG*******"InputName<i>'\t'+InputType<i>);
         public void Connect(String LogonDetail){
         //CustName=CustName;
      /** try{
           File myFile = new File(LogonDetail);
           FileReader fr= new FileReader(myFile);
           BufferedReader reader=new BufferedReader(fr);
           String line=null;
           while ((line=reader.readLine())!=null){
                     String[] result=line.split(":");
                     conDetails<i>=result[1];
                     System.out.println(conDetails<i>);
                     ++i;
                reader.close();
           }catch(Exception ex){
                ex.printStackTrace();
               try {
                 JCO.addClientPool( SID,           // Alias for this pool
                                    10,            // Max. number of connections
                                    conDetails[0], // SAP client
                                    conDetails[1], // userid
                                            conDetails[2], // password
                                    conDetails[3], // language
                                    conDetails[4], // host name
                                    conDetails[5] );
                 this.repository = JCO.createRepository("MYRepository", SID);
                 //System.out.println("Connected"+ repository);
               catch (JCO.Exception ex) {
                 //System.out.println("Caught an exception: \n" + ex);
                 ErrorMsg=ex.toString();
                 //new Error(ex);
                 if (ErrorMsg!=null){
                      new Error(ErrorMsg);
             protected void cleanUp() {
                           JCO.removeClientPool(SID);
    public void zbapi(String BAPI)
        JCO.Client client = null;
        JCO.Table codes = null;
        try {
          // Get a function template from the repository
          //FunctionTemplate ftemplate = repository.getFunctionTemplate(person.getRFCName());
             IFunctionTemplate ftemplate = repository.getFunctionTemplate("FUNCTION_GET");
          // if the function definition was found in backend system
          if(ftemplate != null) {
          // Create a function from the template
            JCO.Function function = ftemplate.getFunction();
            // Get a client from the pool
            client = JCO.getClient(SID);
            // Fill in input parameters
            JCO.ParameterList input = function.getImportParameterList();
            input.setValue(BAPI, "FUNCNAME");
            client.execute(function);
            // Print return message
            //JCO.Structure ret = function.getExportParameterList().getString("NAME1");
              codes = function.getTableParameterList().getTable("PRMTAB");
                 //System.out.println("ROWS:"+codes.getNumRows());
                 this.Rows=codes.getNumRows();
                 //System.out.println(this.Rows);
              //System.out.println("PTYPE" + '\t' + "PNAME" + '\t' + "FIELDNAME" + '\t' + "DATATYPE");
         for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow()) {
                                  //System.out.println(codes.getString("PARAMTYPE")+ '\t' +
                                  //codes.getString("NAME") + '\t'codes.getString("FIELDNAME")
                                  //'t' +codes.getString("DATATYPE"));
                                  if (codes.getString("PARAMTYPE").equals("1")){
                                        InputName[j]=codes.getString("NAME");
                                        InputType[j]=codes.getString("INTTYPE");
                                        //InputINTTYPE[j]=codes.getString("INTTYPE");
                                        ++j;
                                  else if(codes.getString("PARAMTYPE").equals("2")){
                                             OutputName[k]=codes.getString("NAME");
                                             OutputType[k]=codes.getString("DATATYPE");
                                             OutputINTTYPE[k]=codes.getString("INTTYPE");
                                             ++k;
                                  else if(codes.getString("PARAMTYPE").equals("3")){
                                             TableName[l]=codes.getString("NAME");
                                             TableType[l]=codes.getString("DATATYPE");
                                             TableINTTYPE[l]=codes.getString("INTTYPE");
                                             ++l;
                                       /**else if(codes.getString("PARAMTYPE").equals("5")){
                                            //System.out.println("RFCGGGGG"+InputParFieldName[o]);
                                             InputParFieldName[q][o]=codes.getString("FIELDNAME");
                                             if(t==0){
                                                  t=1;
                                                  //System.out.println("RFCGGGGG"InputParFieldName[o]"           "+t);
                                                        InputParFieldDatatype[o]=codes.getString("NAME");
                                              else{
                                                   int w=o-1;
                                                   System.out.println("OoOoOooo"w"\t"+o);
                                                   if(InputParFieldDatatype[w].equals(InputParFieldDatatype[o])){
                                                  //System.out.println("RFCGGGGG"InputParFieldName[o]"           "+t);
                                                  System.out.println("yes");
                                                 else{
                                                   InputParFieldDatatype[o]=codes.getString("NAME");
                                                   ++q;
                                             InputParFieldIntType[o]=codes.getString("INTTYPE");
                                                                                ++o;
                                  else if(codes.getString("PARAMTYPE").equals("6")){
                                            if(!codes.getString("NAME").equals("RETURN")){
                                                  //if(codes.getString("NAME").equals(TableName[]))
                                                  OutputField[n]=codes.getString("FIELDNAME");
                                                  //OutputFieldType[n]=codes.getString("DATATYPE");
                                                  OutputFieldINTTYPE[n]=codes.getString("INTTYPE");
                                                  ++n;}
                                  else if(codes.getString("PARAMTYPE").equals("7")){
                                             FIELDNAME[m]=codes.getString("FIELDNAME");
                                             FIELDNAME[m]=codes.getString("DATATYPE");
                                             //System.out.println("TABLEFIELD"+FIELDNAME[m]);
                                             FIELDINTTYPE[m]=codes.getString("INTTYPE");
                                             ++m;
          else {
                //System.out.println("Function not found"  );
                   //new Error("Function not Found");
            //System.out.println("Function BAPI_SALESORDER_GETLIST not found in backend system.");
          }//if
        catch (Exception ex) {
         System.out.println("Caught an exception: \n" + ex);
         ErrorMsg=ex.toString();
              //System.out.println("2222Caught an exception: \n" + ErrorMsg);
                   if (ErrorMsg!=null)
                               new Error(ErrorMsg);
         //        new Error(ex);
        finally {
          // Release the client to the pool
                    //System.out.println("2222Caught an exception: \n" + ErrorMsg);
          JCO.releaseClient(client);
    /**protected void cleanUp() {
                  JCO.removeClientPool(SID);
    Thanks,
    Hitesh

  • UTF-8, Unicode, XML and windows problems

    Hi there,
    I'm developing an application which uses a lot of russian text.
    This russian text is stored in XML and can be sent to a server remotly
    I use the standard javax.xml libaries to parse the xml files and DBunits XMLWriter to write generate XML strings.
    The XML returned by the DBunit stuff is UTF-8, but its inside a UTF-16 string.
    So when I generate xml and print it out I get something that looks like the following:
    ��������� ������������ ���������?����Thats ok, beacause I can stick that streight into a file when writing files and it works.
    But the problem comes when sending the XML over the server.
    The sending implentation I use must be able to send java generated utf-16 and xml read utf-8.
    So I convert the XML from utf-8 to utf-16, using the following:
    byte[] stringBytesISO = isoString.getBytes("ISO-8859-1");
    utf8String = new String(stringBytesISO, "UTF-8");And that works perfectly on my linux system.
    However when I run it on windows, it only seems to convert some of the characters
    &#1055;&#1088;&#1080;&#1074;&#1099;&#1095;&#1085;&#1099;&#1084; &#65533;?&#1085;&#1086;&#1084; &#1079;&#1072;&#65533;?&#1085;&#1091;&#1090; &#1076;&#1086;&#1088;&#1086;&#1075;&#1080; &#1076;&#1086; &#1074;&#1077;&#65533;?&#1085;&#1099;,Does anyone know whats going wrong here?

    jammers1987 wrote:
    I use the standard javax.xml libaries to parse the xml files and DBunits XMLWriter to write generate XML strings.DbUnit is a testing tool; are you saying you're using it in a production system? Ideally, you should use the same library to write the XML as you do to read it, but you definitely shouldn't be using DbUnit in this context.
    The XML returned by the DBunit stuff is UTF-8, but its inside a UTF-16 string. That should never happen. XML is just text, and text can either be in the form of a Java string, or it can be stored externally using a text encoding like UTF-8. Never mind that Java strings use the UTF-16 encoding; you don't need to know or mention that. Encodings only come into play when you're communicating with something outside your program, like a file system or a database.
    When you generate the XML, you specify that the encoding is UTF-8. When you read the XML, you specify that the encoding is UTF-8. That's all.

  • Generating PDF with XML and XSL

    Hi, quick basic question...
    I'm trying to generate pdf doc from xml with xsl.
    I'm using following sample code from xml.apache.org
    response.setContentType("application/pdf");
    Driver driver =new Driver();
    driver.setOutputStream(response.getOutputStream());
    driver.setRenderer(Driver.RENDER_PDF);
    Transformer transformer=TransformerFactory.newInstance()
    .newTransformer(new StreamSource("foo.xsl"));
    transformer.transform(xmlsource, new SAXResult(driver.getContentHandler()));
    xmlSource is my regular xml that wants to be pdf.
    is foo.xsl any regular xsl that I use to coonvert xml into html?
    or is it some special xsl that is tailored for pdf.
    Is this what is called xsl-fo?
    Thanks
    IL

    Hi IL,
    XSLT can translate XML to something else. It is most suited to transforming to another tree-like format (XML, HTML, etc.) but can be 'asked' to produce other kinds of output, flat text for example.
    It is driven by an XSL file which is a series of patterns to match and output to produce.
    This XSL file can be used to generate another XML document in which the nodes come from the Formatting Object namespace. These describe, in generic terms the format of an output document based upon the contents of the original XML.
    The formatting object XML document can then be used as input to a formatting object XML processor which can generate PDF output from it.
    You may want to check out:
    www.w3c.org
    for all the stuff on XML, XSL, XSLT, Formatting Objects, etc., and:
    xml.apache.org
    for imformation on Xalan, which is an XSL processor and FOP, which is a formatting object processor.
    Hope that helps,
    Peter.

  • Cannot view PDF created by passing xml and XSL-FO using UTL_HTTP

    Hi,
    Using UTL_HTTP Iam trying to contact a servlet which uses the input XML and XSL/FO to produce a PDF.However, when I run the procedure , I get the following error 'File does not begin with -%PDF' ? I checked the output on the console and the blob values does not start with %PDF . Below is the sample from my code , please let me know if Iam commiting a mistake somewhere. I confirmed that the servlet itself is working fine by confirming with test webpage that takes xml and stylesheet input and generates a PDF when 'submitted' to servlet on the click of a button.
    INSERT INTO TESTPDF ( PDF_REPORT ) VALUES ( Empty_Blob() ) RETURNING PDF_REPORT INTO vBlobRef;
    vReportURL :='/rufop/fop?xml='||xmldoc||'&xsltRPath=../../test/PAXSL.xsl';
    req := UTL_HTTP.BEGIN_REQUEST (url=>vReportURL, method=>'POST');
    resp := utl_http.get_response(req);
    loop
    begin
    Utl_Http.read_raw(resp, vData);
    Dbms_Lob.writeAppend ( lob_loc => vBlobRef , amount => Utl_Raw.length(vData) , buffer => vData );
    exception
    when utl_http.end_of_body then
    exit;
    end;
    end loop;
    Utl_Http.end_response(resp);
    owa_util.mime_header('application/pdf',false);
    htp.p('Content-Disposition: inline; filename="test.pdf"');
    htp.p('Content-Length: '|| dbms_lob.getlength(vBlobRef));
    owa_util.http_header_close;
    wpg_docload.download_file(vBlobRef);
    Thanks in advance,
    Jen

    Hello guys! I have been assigned the same task,i.e to generate pdf through xml using xsl stylesheet.
    I have a procedure which is creating the xml and the stylesheet. But I have no idea how to write the procedure which passes this xml to fo engine. I am very new to this. Can anyone please share your thoughts with me so as how to accomplish this? By reading blogs on internet I figured I would have to use UTIL_HTTP but don't know how.
    Sunny
    Edited by: 887252 on May 29, 2012 1:24 AM

  • Problem in IAS Server with generation of PDF with FOP and XML parsing

    Dear co.forumers :
    We are developing an application that generates a pdf document with FOP Apache utilities, and this PDf is stored in a folder of the server. Firts of all, a DDBB data is retrieved using java ( jdbc) middleware classes ( servlets ), and with these data, the pdf is generated using FOP. In these process, he data retrieved from the DDBB is converted in a XML file , and the with the XSL FOP utility, the pdf is generated.
    In the other hand, we have another application that consults data from a java beans, using a JSP, generates a XML with the data of the beans, and with this XML, and with a XSL file generates and html , with the data and fixed text.
    Both applications have been deployed as a separated WebApp in the IAS. Both use Xalan as XML parser amb Xerces is used aswell.
    So, the problem is , after generating a pdf with the firts application, every html generated via JSP-XML-XSL transformation in the second application is shown completelly bad formated. All fixed text are wrongly composed, and the text that should appear in textFields and ComboBoxes is also bad formated. The XML with the data is well generated, so the problem is in the parsing of these XML and the conversion in html through XSL. We have to re-initiate the server and then everything goes well again. If no pdf is launched, no problem occurs with the other application.
    How an a WEB APP pplication can affect to another, installed both in different folders of the IAS ? We tried to change Xalan version and FOP version, but no result.
    Is this a Poltergeist ?? and X file , maybe ?
    Has anyone had the same problem ?
    Pleae, any help will be very wellcomed.

    A PDF document may be generated in the JDeveloper OC4J server.
    http://www.oracle.com/technology/pub/notes/technote_vohra_fop.html

  • PO output with XML and PDF format

    Hi All,
    I need PO output with XML and PDF format. when I give print it shld go to vendor with xml and pdf format through mail. please kindly guide me on this .
    Thanks in advance
    JK

    hi,
    try this code to get in pdf form
    REPORT zsuresh_test.
    Variable declarations
    DATA:
    w_form_name TYPE tdsfname VALUE 'ZSURESH_TEST',
    w_fmodule TYPE rs38l_fnam,
    w_cparam TYPE ssfctrlop,
    w_outoptions TYPE ssfcompop,
    W_bin_filesize TYPE i, " Binary File Size
    w_FILE_NAME type string,
    w_File_path type string,
    w_FULL_PATH type string.
    Internal tables declaration
    Internal table to hold the OTF data
    DATA:
    t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
    Internal table to hold OTF data recd from the SMARTFORM
    t_otf_from_fm TYPE ssfcrescl,
    Internal table to hold the data from the FM CONVERT_OTF
    T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
    This function module call is used to retrieve the name of the Function
    module generated when the SMARTFORM is activated
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = w_form_name
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    fm_name = w_fmodule
    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.
    ENDIF.
    Calling the SMARTFORM using the function module retrieved above
    GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
    format of the output
    w_cparam-no_dialog = 'X'.
    w_cparam-preview = space. " Suppressing the dialog box
                                                        " for print preview
    w_cparam-getotf = 'X'.
    Printer name to be used is provided in the export parameter
    OUTPUT_OPTIONS
    w_outoptions-tddest = 'LP01'.
    CALL FUNCTION w_fmodule
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    control_parameters = w_cparam
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    output_options = w_outoptions
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    job_output_info = t_otf_from_fm
    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.
    t_otf[] = t_otf_from_fm-otfdata[].
    Function Module CONVERT_OTF is used to convert the OTF format to PDF
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    FORMAT = 'PDF'
    MAX_LINEWIDTH = 132
    ARCHIVE_INDEX = ' '
    COPYNUMBER = 0
    ASCII_BIDI_VIS2LOG = ' '
    PDF_DELETE_OTFTAB = ' '
    IMPORTING
    BIN_FILESIZE = W_bin_filesize
    BIN_FILE =
    TABLES
    otf = T_OTF
    lines = T_pdf_tab
    EXCEPTIONS
    ERR_MAX_LINEWIDTH = 1
    ERR_FORMAT = 2
    ERR_CONV_NOT_POSSIBLE = 3
    ERR_BAD_OTF = 4
    OTHERS = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    To display File SAVE dialog window
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
    WINDOW_TITLE =
    DEFAULT_EXTENSION =
    DEFAULT_FILE_NAME =
    FILE_FILTER =
    INITIAL_DIRECTORY =
    WITH_ENCODING =
    PROMPT_ON_OVERWRITE = 'X'
    CHANGING
    filename = w_FILE_NAME
    path = w_FILE_PATH
    fullpath = w_FULL_PATH
    USER_ACTION =
    FILE_ENCODING =
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    others = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
    presentation server
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = W_bin_filesize
    filename = w_FULL_PATH
    FILETYPE = 'BIN'
    APPEND = ' '
    WRITE_FIELD_SEPARATOR = ' '
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = ' '
    WRITE_LF = 'X'
    COL_SELECT = ' '
    COL_SELECT_MASK = ' '
    DAT_MODE = ' '
    CONFIRM_OVERWRITE = ' '
    NO_AUTH_CHECK = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    WRITE_BOM = ' '
    TRUNC_TRAILING_BLANKS_EOL = 'X'
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    IMPORTING
    FILELENGTH =
    tables
    data_tab = T_pdf_tab
    FIELDNAMES =
    EXCEPTIONS
    FILE_WRITE_ERROR = 1
    NO_BATCH = 2
    GUI_REFUSE_FILETRANSFER = 3
    INVALID_TYPE = 4
    NO_AUTHORITY = 5
    UNKNOWN_ERROR = 6
    HEADER_NOT_ALLOWED = 7
    SEPARATOR_NOT_ALLOWED = 8
    FILESIZE_NOT_ALLOWED = 9
    HEADER_TOO_LONG = 10
    DP_ERROR_CREATE = 11
    DP_ERROR_SEND = 12
    DP_ERROR_WRITE = 13
    UNKNOWN_DP_ERROR = 14
    ACCESS_DENIED = 15
    DP_OUT_OF_MEMORY = 16
    DISK_FULL = 17
    DP_TIMEOUT = 18
    FILE_NOT_FOUND = 19
    DATAPROVIDER_EXCEPTION = 20
    CONTROL_FLUSH_ERROR = 21
    OTHERS = 22
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    reward points if useful,
    siri

  • Call from Java to combine PDF and XML

    What adobe software do I need to combine PDF form template and XML data to produce PDF with XML data embedded.
    Also is there any samples/references available to make a call to the above from a Java program ?
    Any help is deeply appreciated.
    Thanks!
    Priya

    Hi Priya,
    Just curious if you figured out how to generate a PDF out of a template? I've a similar requirement where I transform XML schemas into templates, convert the template into a PDF document, and at run time bind the PDF with the form data.
    To sort of answer your question of how to bind an XML instance file to a form, if that form is an XML-FORM, then all you'd need to do is open that document as a PDF document using the PDFFactory, and invoke the importFormData() method on it, passing the XML instance as the input stream.
    The harder part though is getting the PDF out of the template in the first place, without using any adobe user interface period.
    Karthick

Maybe you are looking for

  • Why can't I access airplay on my phone?

    I have read everything in the support page for it but no help. Does anyone know why I can't access airplay

  • Short dump with decimal issue

    Now I want to get total weight of the material as weight * quantity. When I doing this process the program short dump. If my user setting in su01 is 1,234,567.89 it will work normally, but if I changed my user setting to 1.234.567,89 it will get weig

  • Drop Command taking considerable time!!!

    Hi guys, In the morning i had asked u alll about Truncate command taking time. I used "Truncate <table> reuse storage" for truncating the table. It worked fine. Now, when i'am dropping that same table due to some change in our plan, this is also taki

  • "Word Art" in appleworks 6

    Im running Appleworks 6 on an emac...doing some Hw for a Computer class that requires to do tasks in Word on windows. Yet up to this point Ive been able to do everything I need within my Document but cant seem to find the word art feature? Does apple

  • Compiling a frequently accessed Stored Procedure

    RDBMS version :10.2.0.4.0 in a 2 node RAC Our Production DB is 24x7 . Our development team has made a change in a frequently accessed Procedure's code. At any given time this Stored proc is accessed by at least 5 sessions. I have been asked to compil