Spool read data (sapscript output value)

Hi Gurus,
I need to read spool data. I tried following program ;
DATA : mem_tab LIKE abaplist OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF itab OCCURS 0,
  data(2000),
END OF itab.
SUBMIT rspolst2 EXPORTING LIST TO MEMORY AND RETURN
  WITH rqident = '158593'
  WITH first = '1'.
CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
    listobject = mem_tab."( TABLE LIKE TABLE OF abaplist ).
break xkbahar.
IF NOT mem_tab[] IS INITIAL.
  CALL FUNCTION 'LIST_TO_ASCI'
    EXPORTING
      list_index = -1
    TABLES
      listasci   = itab
      listobject = mem_tab." (LIKE TABLE OF abaplist)
ENDIF.
and   [converting spool contents into internal table;
but doesn't help me. Because i want to read sapscript output value in spool. 
anybody have idea ? how do i read my sapscript output data in spool?  Any function any program?
Please help me with the solution.
Regards
Emre.

Hi,
By selecting print icon of your form output ur able to generate spool of the document.
Ex: va03->provide orden no ->frm menu -> Sales Document -> issue output to-> select output type-> click on print icon(ctrl+p).
Spool of the form will be creatted for u, Check the same in SPO1 transaction.
For further details you can debug the same after selecting print icon.
If you need further details, Provide me the exact business requirement.
Regards,
Bysani.

Similar Messages

  • How to read  data from a value attribute

    I  have a context node which has some value attributes.the value to these attributes have been set in their setter/getter methods . How do i read data in the do_prepare_output ,because this attribute does not get recognised when i do get_property_as_string( iv_attr_name = 'XYZ' ). Please let me know how this can be done .

    Hi Shakuntala,
    Value attributes are only for display purpose.
    Check where is the value for the Value Attribute you are trying to read getting stored in SET method.
    For example, Employee Responsible has a value attribute RESPONSIBLE_NAME_UI on the screen
    but in turn the value gets stored in the 'RESPONSIBLE_NAME' and 'RESPONSIBLE_TEXT'.
    You can get these fields in SET method.
    Now when you want to read, use the logic available in GET method for the value attribute like this
      value = me->get_responsible_text( attribute_path = '//TRADE/RESPONSIBLE_TEXT' ).
      IF value IS INITIAL.
        value = me->get_responsible_name( attribute_path = '//TRADE/RESPONSIBLE_NAME' ).
      ENDIF.
    Regards,
    Masood Imrani S.

  • Read Data (ASCII) and send to analog output

    Hello
    I have the following MAX configuration:
    Analog input task, continous, 2 samples, rate 100Hz (PCI-6024E)
    Analog output task, continous, 64 samples, rate 100Hz (PCI-6723)
    The cards are synchronized by the RTSI bus.
    With Dasylab I display signals from load cells by the input task. A "Read Data" module sends values to the output task. The "Read Data" module has the following settings: Output in realtime, synchronisation with analog input task, file is an ASCII, block size 4 values, no ascii time channel.
    Additional settings for DAQmx are done by DasyLab:
    Analog input: Driver buffer 30
    Analog output: Driver buffer 30, output start after 2
    When I start DasyLab I get a DAQmx failure (after a couple hours): DAQmxReadAnalogF64, Attempted to read samples that are no longer available. The requested sample was previously available, but has since been overwritten.
    Could anyone please explain, how to configure analog input/output task and the DasyLab settings (Read Data)? - Attached the DasyLab diagram.
    Additional information: The application should read and display signals from a test bench (load cells). The output shall feed external controllers. The input and output signals shall be displayed on the same chart (as realtime as possible).
    Thank you
    Regards Samuel
    Attachments:
    DasyLabDiagram.png ‏67 KB

    Thanks for the prompt reply! - I have changed the settings to the following:
    Analog input task, continous, 16 samples, rate 100Hz, driver buffer 32
    Analog output task, continous, 16 samples, rate 100Hz, driver buffer 32, output start after 32
    In the "Data read" module the block size is now 16 at 100Hz
    With this setting, DasyLab runs, but only for around 12 hours.
    The following error occurs:
    "Read date module name" / The data flow is blocked by one of the following modules.
    Followed by:
    Attempted to read samples that are no longer available. The requested sample was previously available, but has since been overwritten.
    Is there something else I have to care? Could it be problematic to send signals from different modules to the same Chart Recorder module? I use DasyLab version 11.
    Samuel

  • Reading the output values after each step executes in LabVIEW User Interface

    Hello all,
    Development environment: TestStand 2010 SP1 and LabVIEW 2010 SP1
    Problem: is there a way to execute the subsequent steps programatically and get the output values from each of them?
    I have already extended a little bit a Full OI interface for TestStand to load up any sequence, choose some of the steps and run them step by step (something like option to Run Selected steps). What I am trying to do is to add some actions between each step and do that in User Interface (I can't modify the sequence!), so I am starting the NewExecution with some previously configured InteractiveArgsParam and set an option breakAtFirstStep to True. Afterwards I am just doing something like Step Over when debugging the sequence and this works good, but I didn't fine a way yet to read the output values from the steps...
    Then, if I wait until the execution finishes I can read my Results by processing the ResultObject, but this works only after finalizing of the test sequence. Since I wanted to stop after each step, read the values, do some actions and continue to the next step I tried to register an event callback for Trace of Execution View Manager. I can see that after each executed step this event is triggered, but when I try to read a ResultObject returned in Event Data it is not filled with values (ResultList seems to be empty?). Is it a proper behaviour or maybe I am doing the readout in wrong way? (It is the same VI as for reading ResultObjects after sequence finishes and there it works fine for arrays, containers and other data types).
    Like I mentioned I can't modify the Test sequences, I can't add a UImessages.
    What are my options? Should the trace event returns all output values from each steps or is it just used for status checking? Or maybe there is completely different approach to that matter?
    Thanks in advance for any suggestions,
    Best Regards.
    CLA, CTD, CLED @ Test & Measurements Solutions Poland
    Solved!
    Go to Solution.

    Thanks for your replay, I have tried to build it in my LabView Block Diagramm, es seems like this image.
    But the variable GetNumSubProperties ist always 0. Why?
    PS: I need only the variable "Step.Result.PassFail" from the last step, do you know, how can I get it? I think, it is maybe easier than read all the "Result".
    Attachments:
    ReadStepResultInLabview.JPG ‏39 KB

  • Read lines from more than 1 file of different file extensions, extract the data and output to screen

    Hi,
    I am trying to read data from more than one file at once. The files are different types e.g. one is a text file one is an xml file like so, StudentInformation.txt, CollegeInformation.xml. The files are all stored in one place, in this case on the D drive of
    a local computer. I am trying to locate any files in the D drive with a file extension of .txt or of .xml (there may be more than two of these files in the future, so I'm trying to allow for that). Then I want to open all of these files, extract the information
    and output all the information in one display window. I want all the information from these two or more files to be displayed together in the display window.
    Here is the code so far. It is throwing up errors.
            //Load from txt or xml files
            private void btnLoad_Click(object sender, RoutedEventArgs e)
                    IEnumerable<string> fileContents = Directory.EnumerateFiles("D:\\", "*.*", SearchOption.TopDirectoryOnly)
                    .Select(x => new FileInfo(x))
                    .Where(x => x.Extension == ".xml" || x.Extension == ".txt")
                    .Select(file => ParseFile(file));}
                    private string ParseFile(FileInfo file)
                        try
                            using (StreamReader sr = new StreamReader(file.FullName))
                                string line;
                                while ((line = sr.ReadLine()) != null)
                                    //Logic here to determine if this is the correct file and append accordingly
                                    lbDisplay.Items.Add(line);
                                return line;
                        catch (Exception ex)
                            // Let the user know what went wrong
                            MessageBox.Show("The file could not be read: ");
                            MessageBox.Show(ex.Message);
    The error it throws up is:
    Error 1
    'BookList.MainWindow.ParseFile(System.IO.FileInfo)': not all code paths return a value

    This is the Small Basic programming language so moving to a C# forum.
    But you need all paths to return a value, including if an exception is called and it jumps to the catch, perhaps just:
    // Let the user know what went wrong
    MessageBox.Show("The file could not be read: ");
    MessageBox.Show(ex.Message);
    return "";

  • Reading data from Lookup [qualified flat] (multi-valued) table

    I have a main table u2019ABCu2019 which has a Lookup [qualified flat] (multi-valued) field u2018XYZu2019 along with some other text fields. I am able to read data from table ABC including lookup field data, but I do not see the relation
    For Ex: If for a contract in table u2018ABCu2019, there are multiple line items in look up table. I have a contract with 2 line items in u2018ABCu2019, but 4 line items in look up table (2 records each for each line item with item number).  Now, when I read the data from table u2018ABCu2019 for that contract, I get all the 4 lines in result table; but item no is blank even though there is item no field in table u2018XYZu2019.
    Below is the sample code:
    wa_query-parameter_code = Contract ID Field.
      wa_query-operator = 'EQ'.
      wa_query-dimension_type = 1. "mdmif_search_dim_field.
      wa_query-constraint_type =8. " mdmif_search_constr_text.
      wa_string =  Contract Number.
      GET REFERENCE OF wa_string INTO wa_query-value_low.
      APPEND wa_query TO lt_query.
      CLEAR wa_query.
    CALL METHOD lcl_api->mo_core_service->query
            EXPORTING
              iv_object_type_code      = 'ABCu2019
            it_query                 = lt_query
            IMPORTING
              et_result_set            = lt_result_set_key.
    LOOP AT lt_result_set_key INTO ls_result_set_key.
        lt_keys = ls_result_set_key-record_ids.
      ENDLOOP.
    Contract Price for lower bound
      ls_result_set_definition-field_name = XYZ'.
      APPEND ls_result_set_definition TO lt_result_set_definition.
    CALL METHOD lcl_api->mo_core_service->retrieve
        EXPORTING
          iv_object_type_code      = 'ABCu2019
          it_result_set_definition = lt_result_set_definition
          it_keys                  = lt_keys
        IMPORTING
          et_result_set            = lt_result_set.
    In table lt_result_set, I see 4 records, but I do not know which 2 records belong to item 1 of the contract and other 2 records for item2.
    Can anyone help me in resolving this. Any kind of help is appreciated.
    Thanks,
    Shekar

    i do not quite understand ur problem statement ..
    but if u have items in the main table to which QLUT entries are linked ..
    then when you read the main table record (u get LinkIds at the record level) that gives u the relation to the Qlookup values
    i mean for ur case - u would get only 2 values in the QLUT values for the "selected" record in the main table
    am not sure if you say correctly - that you get "unlinked" values in the QLUts
    so u should 2 values in lt_result_set and not 4  .. see if u are using the LinkIds properly
    hth
    thanks
    -Adrivit

  • Read data from ODS table using value mapping

    hi all;
    can anyone help on how to read data from ODS table using value mapping

    Mudit,
    Take a look at this blog,
    <a href="/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler">DB Lookup in Mapping</a>
    Regards,
    Bhavesh

  • Read data driver not giving exact values

    I am trying to get the data from an OSA usinf the Labview read data
    instrument driver. It most of  the time shows the spectrum similar
    to the OSA in the Labview waveform grapf but the values, meaning the
    x-axis and y-axis values do not at all correspond. I tried changing the
    range using min,max and increment but did not work.Please advise. Here
    is the snapshot of the graph obtained and the little program is also
    attached.
    Attachments:
    readdata.vi ‏26 KB
    Screen01.JPG ‏105 KB

    ok i didnt really know what i was writing about then
    but still i know from my own experience that the 2 types of graphs behave in different way when user tries to format x-axis
    i had a program where 1 frame (have multiple frames in while function to control an instrument) was devoted to reading from the instrument and displaying a graph
    i read not only data but also start/stop points on x axis
    before i displayed data i used this additional info to format the graph using property nodes and it worked but then i pased data to the graph and x-axis was forced back to display number of points (i also set labels in the same way and it worked perfectly well for labels)
    it also resulted in graph flickering
    that was when i was using waveform graph, changing it simply to xy graph (and casting data to proper format)  fixed the bug
    this hint and the explanation: 'Waveform graphs plot data as a function of time, you can't directly define the data on the X Plot. To do this you need to use an XY graph.' i got from one NI engineer:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=231199&jump=true

  • Spool no. data to PDF and then to mail

    Hi all ,
    My requirement is i have to display all the spool request no.'s for the particular user and from that user will select the particular spool no. . and that particular data has to convert into PDF and that PDF should go to mail id specified in selection screen.
    now my prob. is when i am downloading the PDF on desktop it is opening with right data and when i am sending to mail id with the same internal table with PDF format , the file is corrupted and giving some error.
    for ur reference here i am sending my code , please check and let me know .
    thanks & regards,
    Anil kumar .
    TABLES: tsp01,
            soextreci1.
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-020.
    SELECT-OPTIONS : so_date1     FOR sy-datum OBLIGATORY,
                     so_time1     FOR sy-uzeit,
                     so_name1     FOR sy-uname,
                     so_splno     FOR tsp01-rqident.
                    so_email     FOR soextreci1-receiver OBLIGATORY.
    PARAMETER : so_email TYPE soextreci1-receiver OBLIGATORY.
    SELECTION-SCREEN : END OF BLOCK b1.
    DATA : l_addrnumber TYPE adr7-addrnumber,
           l_persnumber TYPE adr7-persnumber,
           l_mail       TYPE adr6-smtp_addr.
    DATA : BEGIN OF it_tsp01 OCCURS 0,
            rqident   TYPE tsp01-rqident,
            rqowner   TYPE tsp01-rqowner,
            rqcretime TYPE tsp01-rqcretime,
            rqclient  TYPE tsp01-rqclient,
            rqo1name  TYPE tsp01-rqo1name,
           END OF it_tsp01.
    DATA : l_date_low   TYPE char8,
           l_date_high  TYPE char8,
           l_time_low   TYPE char8,
           l_time_high  TYPE char8,
           l_final_low  TYPE char16,
           l_final_high TYPE char16,
           markfield VALUE ' '.
    DATA : BEGIN OF l_final OCCURS 0,
           sig  TYPE c,
           opt  TYPE char2,
           low  TYPE char16,
           high TYPE char16,
           END OF l_final.
    *PARAMETERS:
    spoolno LIKE tsp01-rqident,
    download AS CHECKBOX DEFAULT 'X',
    DATA : p_file TYPE rlgrap-filename VALUE 'C:\temp\file.pdf'."#EC NOTEXT
    DATA otf LIKE itcoo OCCURS 100 WITH HEADER LINE.
    DATA cancel.
    DATA pdf LIKE tline OCCURS 100 WITH HEADER LINE.
    DATA it_pdf LIKE pdf OCCURS 0 WITH HEADER LINE.
    DATA doctab LIKE docs OCCURS 1 WITH HEADER LINE.
    DATA: numbytes TYPE i,
          arc_idx LIKE toa_dara,
          pdfspoolid LIKE tsp01-rqident,
          jobname LIKE tbtcjob-jobname,
          jobcount LIKE tbtcjob-jobcount,
          is_otf.
    DATA: client LIKE tst01-dclient,
          name LIKE tst01-dname,
          objtype LIKE rststype-type,
          type LIKE rststype-type.
    AT SELECTION-SCREEN OUTPUT.
      SELECT SINGLE addrnumber
                   persnumber
            FROM   adr7
            INTO  (l_addrnumber,l_persnumber)
            WHERE  uname = sy-uname.
      SELECT SINGLE smtp_addr
            FROM   adr6
            INTO   l_mail
            WHERE  addrnumber = l_addrnumber
            AND    persnumber = l_persnumber.
      so_date1-sign   = so_name1-sign   = 'I'.  "so_email-sign   = 'I'.
      so_date1-option = so_name1-option = 'BT'. "so_email-option = 'BT'.
      so_date1-low = so_date1-high = sy-datum.
      so_name1-low = so_name1-high = sy-uname.
    so_email-low = so_email-high = l_mail.
      APPEND : so_date1,so_name1.",so_email.
    START-OF-SELECTION.
      IF so_date1-low IS NOT INITIAL.
        l_date_low  = so_date1-low.
      ENDIF.
      IF so_date1-high IS NOT INITIAL.
        l_date_high = so_date1-high.
      ENDIF.
      IF so_time1-low IS NOT INITIAL.
        l_time_low  = so_time1-low.
        l_time_low+6(2)  = '00'.
      ENDIF.
      IF so_time1-high IS NOT INITIAL.
        l_time_high = so_time1-high.
        l_time_high+6(2) = '00'.
      ENDIF.
      IF l_time_low IS NOT INITIAL.
        CONCATENATE l_date_low  l_time_low  INTO l_final_low.
      ELSE.
        CONCATENATE l_date_low  '00000000' INTO l_final_low.
      ENDIF.
      IF l_time_high IS NOT INITIAL .
        IF so_date1-high IS NOT INITIAL.
          CONCATENATE l_date_high l_time_high INTO l_final_high.
        ENDIF.
      ELSE.
        CONCATENATE l_date_low '23595959' INTO l_final_high.
      ENDIF.
      l_final-sig  = so_date1-sign.
      l_final-opt  = so_date1-option.
      l_final-low  = l_final_low.
      l_final-high = l_final_high.
      APPEND l_final.
      CLEAR l_final.
      SELECT rqident
             rqowner
             rqcretime
             rqclient
             rqo1name
             FROM tsp01 INTO TABLE it_tsp01
               WHERE rqcretime IN l_final
               AND   rqowner   IN so_name1.
      IF sy-subrc NE 0.
        MESSAGE 'No data for the entered values' TYPE 'E'.
        EXIT.
      ENDIF.
      CLEAR : so_name1,so_name1[],it_tsp01.
      SORT it_tsp01 BY rqident.
      LOOP AT it_tsp01.
        WRITE : /1 sy-vline,
                 3  markfield AS CHECKBOX,
                 5(16)  it_tsp01-rqident,   22 sy-vline,
                 23(10) it_tsp01-rqowner,   34 sy-vline,
                 35(16) it_tsp01-rqcretime, 52 sy-vline.
        HIDE it_tsp01-rqident.
        AT LAST.
          WRITE : /1(52) sy-uline.
        ENDAT.
      ENDLOOP.
    TOP-OF-PAGE.
      WRITE: /1(52) sy-uline.
      WRITE: /1 sy-vline,
              5(16)   'Spool No.' COLOR COL_POSITIVE CENTERED , 22 sy-vline,
              23(10)   'User'     COLOR COL_POSITIVE CENTERED , 34 sy-vline,
              35(16)   'Date'     COLOR COL_POSITIVE CENTERED , 52 sy-vline.
      WRITE: /1(52) sy-uline.
    END-OF-SELECTION.
      SET PF-STATUS '/BAY4/PDF'.
      DATA : l_rqident TYPE tsp01-rqident,
             l_count   TYPE i VALUE '0'.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'PDF'.
          CLEAR l_count.
          DO.
            CLEAR : markfield.
            READ LINE sy-index FIELD VALUE markfield.
            IF sy-subrc NE 0.
              EXIT.
            ENDIF.
            CHECK markfield NE space.
            IF l_count GT 0.
              MESSAGE 'Please select only one check box' TYPE 'E'.
              EXIT.
            ENDIF.
            l_rqident = it_tsp01-rqident.
            l_count = l_count + 1.
          ENDDO.
          PERFORM get_pdf.
        WHEN 'MAIL'.
          CLEAR l_count.
          DO.
            CLEAR : markfield.
            READ LINE sy-index FIELD VALUE markfield.
            IF sy-subrc NE 0.
              EXIT.
            ENDIF.
            CHECK markfield NE space.
            IF l_count GT 0.
              MESSAGE 'Please select only one check box' TYPE 'E'.
              EXIT.
            ENDIF.
            l_rqident = it_tsp01-rqident.
            l_count = l_count + 1.
          ENDDO.
          PERFORM get_pdf.
          PERFORM send_mail.
      ENDCASE.
    *&      Form  get_pdf
          text
    -->  p1        text
    <--  p2        text
    FORM get_pdf .
      READ TABLE it_tsp01 WITH KEY rqident = l_rqident.
    LOOP AT it_tsp01.
      client = it_tsp01-rqclient.
      name   = it_tsp01-rqo1name.
      CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
             EXPORTING
                  authority     = 'SP01'
                  client        = client
                  name          = name
                  part          = 1
             IMPORTING
              CHARCO        =
              CREATER       =
              CREDATE       =
              DELDATE       =
              MAX_CREDATE   =
              MAX_DELDATE   =
              NON_UNIQ      =
              NOOF_PARTS    =
              RECTYP        =
              SIZE          =
              STOTYP        =
                  type          = type
                  objtype       = objtype
             EXCEPTIONS
                  fb_error      = 1
                  fb_rsts_other = 2
                  no_object     = 3
                  no_permission = 4.
      IF objtype(3) = 'OTF'.
        is_otf = 'X'.
      ELSE.
        is_otf = space.
      ENDIF.
      IF is_otf = 'X'.
        CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
            EXPORTING
              src_spoolid                    = l_rqident
              no_dialog                      = ' '
          DST_DEVICE                     =
          PDF_DESTINATION                =
            IMPORTING
              pdf_bytecount                  = numbytes
              pdf_spoolid                    = pdfspoolid
          OTF_PAGECOUNT                  =
              btc_jobname                    = jobname
              btc_jobcount                   = jobcount
            TABLES
              pdf                            = pdf
            EXCEPTIONS
              err_no_otf_spooljob            = 1
              err_no_spooljob                = 2
              err_no_permission              = 3
              err_conv_not_possible          = 4
              err_bad_dstdevice              = 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.
      ELSE.
        CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
            EXPORTING
              src_spoolid                    = l_rqident
              no_dialog                      = ' '
          DST_DEVICE                     =
          PDF_DESTINATION                =
            IMPORTING
              pdf_bytecount                  = numbytes
              pdf_spoolid                    = pdfspoolid
          LIST_PAGECOUNT                 =
              btc_jobname                    = jobname
              btc_jobcount                   = jobcount
            TABLES
              pdf                            = 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.
      ENDIF.
    PERFORM download_w_ext(rstxpdft) TABLES pdf
                                       USING p_file
                                             '.pdf'
                                             'BIN'
                                             numbytes
                                             cancel.
    ENDFORM.                    " get_pdf
    *&      Form  send_mail
          text
    -->  p1        text
    <--  p2        text
    FORM send_mail .
      DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0 WITH HEADER LINE.
      DATA: it_attach  TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0 WITH HEADER LINE.
    *DATA: PIT_ATTACH LIKE table of IT_ATTACH.
      DATA: t_packing_list  LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            t_contents      LIKE solisti1   OCCURS 0 WITH HEADER LINE,
            t_receivers     LIKE somlreci1  OCCURS 0 WITH HEADER LINE,
            t_attachment    LIKE solisti1   OCCURS 0 WITH HEADER LINE,
            t_object_header LIKE solisti1   OCCURS 0 WITH HEADER LINE.
      DATA :  w_cnt         TYPE i,
              w_sent_all(1) TYPE c,
              w_doc_data    LIKE sodocchgi1,
              gd_error      TYPE sy-subrc,
              gd_reciever   TYPE sy-subrc.
      DATA: a TYPE string,
            t TYPE string.
      a = 'FILE.PDF'.
      t_object_header = a .
      APPEND t_object_header.
      DATA: p_email TYPE string.
      CONSTANTS:
         con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
         con_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
      LOOP AT pdf.
        TRANSLATE pdf USING ' ~'.
        CONCATENATE pdf-tdformat pdf-tdline INTO it_attach SEPARATED BY space.
        APPEND it_attach.
        CLEAR : it_attach,pdf.
      ENDLOOP.
      DATA: ld_error               TYPE sy-subrc,
            ld_reciever            TYPE sy-subrc,
            ld_mtitle              LIKE sodocchgi1-obj_descr,
            ld_email               LIKE somlreci1-receiver,
            ld_format              TYPE so_obj_tp ,
            ld_attdescription      TYPE so_obj_nam,
            p_attdescription       LIKE ld_attdescription,
            ld_attfilename         TYPE so_obj_des ,
            ld_sender_address      LIKE soextreci1-receiver,
            p_sender_address       LIKE ld_sender_address,
            ld_sender_address_type LIKE soextreci1-adr_typ,
            p_sender_addres_type   LIKE ld_sender_address_type,
            ld_receiver            LIKE sy-subrc.
    RANGES : ld_email FOR somlreci1-receiver OCCURS 0.
    ld_email[]       = so_email[].
    append ld_email.
      ld_email       = so_email.
      ld_mtitle      = 'PDF file for the Spool no'.
      ld_format      = 'pdf'.
      ld_attfilename = 'filename'.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
      ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type = ld_format.
      t_packing_list-obj_descr = ld_attdescription.
      t_packing_list-obj_name = ld_attfilename.
      t_packing_list-doc_size = t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = w_doc_data
          put_in_outbox              = 'X'
          sender_address             = ld_sender_address
          sender_address_type        = ld_sender_address_type
          commit_work                = 'X'
        IMPORTING
          sent_to_all                = w_sent_all
        TABLES
          object_header              = t_object_header
          packing_list               = t_packing_list
          contents_bin               = t_attachment
          contents_txt               = it_message
          receivers                  = t_receivers
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
      SUBMIT rsconn01
    WITH mode = 'INT'
      WITH output = 'X'
      AND
      RETURN.
      IF sy-subrc EQ 0.
        MESSAGE 'PDF sent to specified mail id' TYPE 'I'.
        LEAVE SCREEN.
      ENDIF.

    Hi,
    Try this program, it works for me perfectly:
    REPORT  Z_SENDFAX line-size 46 no standard page heading message-id so.
    data g_list_content type solix_tab.
    data g_text_content type soli_tab.
    parameters:spool like sy-spono.
    parameters:rec_fax type sadrfd-rec_fax.
    parameters:title like sadrfd-rec_title.
    parameters:name1 like sadrfd-rec_name1.
    parameters:cover type c.
    PARAMETERS: Zvbeln LIKE likp-vbeln.
    start-of-selection.
      perform create_text_content changing g_text_content.
      perform create_list_content changing g_list_content.
      perform send using g_text_content
                         g_list_content.
    *&      Form  create_list_content
    form create_list_content changing list_content type solix_tab.
      perform get_list_from_spool changing list_content.
    endform."create_list_content''
    *&      Form  create_text_content''
    form create_text_content changing text_content type soli_tab.
      data:z_lin(200) type c.
    append 'To,'  to text_content.
      concatenate 'To:' name1 into z_lin separated by space.
      append z_lin to text_content.
      concatenate 'End of delivery Notice for ' Zvbeln
        into z_lin separated by space.
      append z_lin to text_content.
    convert the content from RAW to TXT''
      CALL FUNCTION 'SO_RAW_TO_RTF'
        TABLES
          objcont_old = text_content
          objcont_new = text_content
        EXCEPTIONS
          others      = 0.
    endform."create_text_content''
    *&      Form  SEND''
          Create the list-document and send it via FAX, Mail and RML''
    form send using text_content type soli_tab
                     list_content type solix_tab.
      data:z_lin(200) type c.
    structures and internal tables for the send data''
      data document_data    type sodocchgi1.
      data packing_list     type table of sopcklsti1.
      data receivers        type table of somlreci1.
      data contents_txt     type soli_tab.
      data contents_hex     type solix_tab.
      data packlist_wa      type sopcklsti1.
      data receiver_wa      type somlreci1.
      data packlist_counter type i.
      data sent_to_all      type sonv-flag.
      data msg_ex(200) type c.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
    main document''
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
    document data contains information for the whole message''
      document_data-obj_descr = 'Miscellaneous Delivery Notice'.
    some text for the main document''
      append 'Hi,' name1 to contents_txt.
      concatenate 'To:' name1 into z_lin separated by space.
      append z_lin to contents_txt.
      concatenate 'Attached you will find the Delivery Notice for ' Zvbeln
        into msg_ex separated by space.
      append  msg_ex to contents_txt.
    append 'Attached you will find the Delivery Notice for ' Zvbeln to contents_txt.
      packlist_counter = 1.
      perform create_packlist_entry using contents_txt
                                          'RAW'
                                 changing packlist_wa
                                          packlist_counter.
    append packlist_wa to packing_list.
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
    add a text attachment of type TXT''
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
      perform create_packlist_entry using text_content
                                          'TXT'
                                 changing packlist_wa
                                          packlist_counter.
    append packlist_wa to packing_list.
    append lines of text_content to contents_txt.
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
    add the list attachment of type ALI''
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
      packlist_counter = 1."because we will fill the hex table now''
      perform create_packlist_entry using list_content
                                          'ALI'
                                 changing packlist_wa
                                          packlist_counter.
      append packlist_wa to packing_list.
      append lines of list_content to contents_hex.
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
    fill recipients tables''
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
      perform create_fax_recipient changing receiver_wa.
      append receiver_wa to receivers.
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
    Send the document by calling the API1''
    as of 6.10 either the flag 'commit_work' has to be set''
    or a commit work statement has to be set somewhere after the call''
    Sending won't work without this!''
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = document_data
          put_in_outbox              = 'X'
          commit_work                = 'X'
        IMPORTING
          sent_to_all                = sent_to_all
        TABLES
          packing_list               = packing_list
          contents_txt               = contents_txt
          contents_hex               = contents_hex
          receivers                  = receivers
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          others                     = 8.
      case sy-subrc.
        when 0.
          if sent_to_all is initial.
            read table receivers index 1 into receiver_wa.
            message i865 with receiver_wa-retrn_code.
          else.
            message s022.
          endif.
        when 1.
          message i552.
        when 2.
          message i023 with document_data-obj_descr.
        when 4.
          message i471.
        when others.
          message i619.
      endcase.
    endform." SEND''
    *&      Form  USE_SUBMIT''
    <nowiki>*   Use "submit <report> exporting list to memory"
    form use_submit changing contents_hex type solix_tab.
      data listobject type table of abaplist.
    get the list object by calling the list in another report
    F1 on submit gives more information
      submit balvsd03 exporting list to memory and return.
    import the list from memory and store it in table listobject
      CALL FUNCTION 'LIST_FROM_MEMORY'
        TABLES
          listobject = listobject
        EXCEPTIONS
          not_found  = 1
          others     = 2.
      if sy-subrc <> 0.
        message e105 with 'LIST_FROM_MEMORY'.
      endif.
    free memory
      CALL FUNCTION 'LIST_FREE_MEMORY'
        TABLES
          listobject = listobject
        EXCEPTIONS
          others     = 1.
      if sy-subrc <> 0.
        message e105 with 'LIST_FREE_MEMORY'.
      endif.
    it's always necessary to compress the table.
    SAPconnect will decompress it
      CALL FUNCTION 'TABLE_COMPRESS'
        TABLES
          in             = listobject
          out            = contents_hex
        EXCEPTIONS
          compress_error = 1
          others         = 2.
      if sy-subrc <> 0.
        message e105 with 'TABLE_COMPRESS'.
      endif.
    endform." USE_SUBMIT
    *&      Form  WRITE_A_LIST
          Create a new list within this report.
    form write_a_list changing contents_hex type solix_tab.
      data listobject type table of abaplist.
      perform write_list.
    Save the list and store table listobject
      CALL FUNCTION 'SAVE_LIST'
        EXPORTING
          list_index         = sy-lsind
        TABLES
          listobject         = listobject
        EXCEPTIONS
          list_index_invalid = 1.
      if sy-subrc = 1.
        message e105 with 'SAVE_LIST'.
      endif.
    It's always necessary to compress the table
    SAPconnect will decompress it
      CALL FUNCTION 'TABLE_COMPRESS'
        TABLES
          in             = listobject
          out            = contents_hex
        EXCEPTIONS
          compress_error = 1
          others         = 2.
      if sy-subrc <> 0.
        message e105 with 'TABLE_COMPRESS'.
      endif.
    endform." WRITE_A_LIST
    *&      Form  GET_LIST_FROM_SPOOL
          Get list from spool
    form get_list_from_spool changing contents_hex type solix_tab.
      data spool_number     type rspoid.
      data contents_bin     type soli_tab.
      data print_parameters type pri_params.
      data valid            type c.
    write a list into spool
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
       IMPORTING
         out_parameters         = print_parameters
         valid                  = valid
       EXCEPTIONS
         archive_info_not_found = 1
         invalid_print_params   = 2
         invalid_archive_params = 3
         others                 = 4.
    if sy-subrc <> 0.
       message e105 with 'GET_PRINT_PARAMETERS'.
    elseif valid is initial.
       return.
    endif.
    new-page print on parameters print_parameters no dialog.
    perform write_list.
    new-page print off.
      spool_number = spool.
      DATA:REAL_TYPE     LIKE     SOODK-OBJTP.
      DATA:BUFFER_PDF     LIKE     TLINE OCCURS 0 WITH HEADER LINE.
    you can also send OTF documents from spool with this function
    module. The importing parameter real_type gives you the doc type
    that you have to give to the send interface. The parameter is not
    used here
      CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
        EXPORTING
          rqident              = spool_number
         desired_type         = 'RAW'
        IMPORTING
           REAL_TYPE           = REAL_TYPE
        TABLES
          buffer               = contents_bin
         BUFFER_PDF           = BUFFER_PDF
        EXCEPTIONS
          no_such_job          = 1
          job_contains_no_data = 2
          selection_empty      = 3
          no_permission        = 4
          can_not_access       = 5
          read_error           = 6
          type_no_match        = 7
          others               = 8.
    *clear contents_bin[].
      if sy-subrc <> 0.
        message e105 with 'RSPO_RETURN_SPOOLJOB'.
      endif.
      CALL FUNCTION 'SO_RAW_TO_RTF'
        TABLES
          objcont_old = contents_bin
          objcont_new = contents_bin
        EXCEPTIONS
          others      = 0.
      data:TRANSFER_BIN        TYPE      SX_BOOLEAN."   occurs 0.
      data:CONTENT_BIN         TYPE      SOLIX_TAB."   occurs 0.
      data:OBJHEAD             TYPE      SOLI_TAB.
      data:LEN     TYPE     SO_OBJ_LEN.
    *len = '255'.
    CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PRT'
       EXPORTING
         FORMAT_SRC   = 'OTF'
         FORMAT_DST   = 'PRT'
         devtype = 'POSTSCPT'
       CHANGING
         TRANSFER_BIN = TRANSFER_BIN
         CONTENT_TXT  = contents_bin
         CONTENT_BIN  = contents_hex
         OBJHEAD      = OBJHEAD
         LEN          = len.
      CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
        EXPORTING
          FORMAT_SRC   = 'OTF'
          FORMAT_DST   = 'PDF'
          devtype = 'PRINTER'
        CHANGING
          TRANSFER_BIN = TRANSFER_BIN
          CONTENT_TXT  = contents_bin
          CONTENT_BIN  = contents_hex
          OBJHEAD      = OBJHEAD
          LEN          = len.
    convert to hex table
    CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
       EXPORTING
         ip_solitab  = CONTENT_BIN
       IMPORTING
         ep_solixtab = contents_hex.
    endform." GET_LIST_FROM_SPOOL
    *&      Form  WRITE_LIST
          Write a list of SAPconnect conversion rules
    form write_list.
      data lt_scarr type table of scarr.
      data carr type scarr.
      select * from scarr into table lt_scarr.
      format color = 1.
      uline at /1(46).
      write: / sy-vline,
             'CARRID',   10 sy-vline,
             'CARRNAME', 35 sy-vline,
             'CURRCODE', 46 sy-vline.
      format color = 2.
      uline at /1(46).
      loop at lt_scarr into carr.
        write: / sy-vline,
               carr-carrid,   10 sy-vline,
               carr-carrname, 35 sy-vline,
               carr-currcode, 46 sy-vline.
      endloop.
      uline at /1(46).
      new-line.
    endform." WRITE_LIST
    *&      Form  create_packlist_entry
          text
    form create_packlist_entry  using  contents type standard table
                                       format type so_obj_tp
                             changing  packlist_wa type sopcklsti1
                                       packlist_counter type i.
      data tab_lines type i.
      clear packlist_wa.
      DATA FORM2 TYPE so_obj_tp.
    get the table length of the attachment
      describe table contents lines tab_lines.
    set binary flag for binary content to mark that this packlist entry
    is meant for table contents_hex and not for contents_bin
      FORM2 = FORMAT.
      if format = 'ALI'.
      FORM2 = 'PRT'.
        FORM2 = 'PDF'.
        packlist_wa-transf_bin = 'X'.
      endif.
    attchment's description and format
      concatenate form2 'Document' into
         packlist_wa-obj_descr separated by space.
      packlist_wa-doc_type   = form2.
    describe start and length in contents_txt or contents_hex
    which table is meant is decided by the transf_bin flag set above
      packlist_wa-body_start = packlist_counter.
      packlist_wa-body_num   = tab_lines.
    increase counter to have the starting line for the next attachment
      packlist_counter = packlist_counter + tab_lines.
    endform." create_packlist_entry
    *&      Form  create_int_recipient
          text
    *form create_int_recipient changing receiver type somlreci1.
    field-symbols <receiver> type c.
    data recipient_int type sadrud.
    clear receiver.
    fill address type specific recipient structure
    cast structure to generic receiver field
    assign recipient_int to <receiver> casting.
    receiver-receiver = <receiver>.
    set address type for INT
    receiver-rec_type = 'U'.
    *endform."create_int_recipient
    *&      Form  create_fax_recipient
          text
    form create_fax_recipient changing receiver type somlreci1.
      field-symbols <receiver> type c.
      data recipient_fax type sadrfd.
      data name type soud3.
      clear receiver.
      name-sapnam = sy-uname.
      CALL FUNCTION 'SO_NAME_CONVERT'
        EXPORTING
          name_in  = name
        IMPORTING
          name_out = name
        EXCEPTIONS
          others   = 1.
      if sy-subrc <> 0.
        name-adrname = sy-uname.
      endif.
    fill address type specific recipient structure
      recipient_fax-rec_fax    = rec_fax."'7152414031'.
      recipient_fax-rec_state  = 'US'.
      recipient_fax-rec_title  = title."'Mr.'.
      recipient_fax-rec_name1  = name1."'Ytamar Fondeur'.
      recipient_fax-send_nam   = name-adrname.
      recipient_fax-send_cover = cover.
      recipient_fax-FORM_LANGU = sy-langu.
    cast structure to generic receiver field
      assign recipient_fax to <receiver> casting.
      receiver-receiver = <receiver>.
    set address type for FAX
      receiver-rec_type = 'F'.
    endform."create_fax_recipient
    *&      Form  create_rml_recipient
          text
    form create_rml_recipient changing receiver type somlreci1.
      field-symbols <receiver> type c.
      data recipient_rml type sadr7d.
      clear receiver.
    fill address type specific recipient structure
      recipient_rml-sdest = 'C11'.
      recipient_rml-umand = '001'.
      recipient_rml-uname = 'MYUSER'.
    cast structure to generic receiver field
      assign recipient_rml to <receiver> casting.
      receiver-receiver = <receiver>.
    set address type for RML
      receiver-rec_type = 'R'.
    endform."create_rml_recipient

  • - Sapscript output convert to XML -

    Hi Gurus,
    I need to convert sapscript output with values - not template - to an XML File or txt.
    i tried RSTXSCRP program and FB_CONVERT_FORM_TO_XML function module but doesn't help me.
    Please help me with the solution.
    Regards
    Emre.
    Edited by: emre karakurum on May 21, 2010 11:38 AM

    In my opinion, SAPScript form is something quite unstructured - the layout of it can be very complicated and as well containing graphic and so on. XML is, on the other side, something pretty structured. I don't think that you can find something standard for simple conversion SAPScript to XML. SAPScript is simply not like IDOC - it's human readable layout rather than strucutre of data. You will have to write your own print-program which will create your own XML file instead of printing SAPScript form. The logic how to structure the XML file (which tags will be there and which values) will be coded in this print-program.

  • Without loops how can i read data from associative Array??

    Hi all,
    I am facing scenario like...
    i need to read data from associative array  without using loops is it possible,
    CREATE OR REPLACE PACKAGE BODY test_pkg IS
        TYPE t1 IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
       -- in array we can expect more than one row or sometimes no data also.
      FUNCTION test1(vt1 T1 DEFAULT CAST(NULL AS t1)) RETURN NUMBER IS
      BEGIN
        -- basically in array we'll get data of column2
        -- this loop should satisfies table1.colum2 = nvl(NULL, table2.colum2 )if array is null.
        -- if array is not null then only compare with array values
        FOR i IN (SELECT t1.colum1,t1.column2
                         FROM table1 t1, table1 t2
                              WHERE t1.colum1 = t2.column1
                                AND t1.colum2 = nvl(vt1, t2.colum2)
          LOOP
            generateTEXT(i.colum1, i.colum2);
         END LOOP;
      END test1;
    END test_pkg;
    in table1 we have date like...
    colum1          column2
    Jan                  1
    Feb                  2
    Mar                  3
    if i call select test_pkg.test1(1) from dual then output should
    be Jan..
    and
    select test_pkg.test1(null) from dual then it should display all elements from table1.
    Jan                  1
    Feb                  2
    Mar                  3,
    Thanks for your quick replay..

    i need to read data from associative array  without using loops is it possible,
    No - you would need to create a SQL type and then use the TABLE operator to unnest the collection.
    create or replace TYPE my_nums IS TABLE OF INTEGER;
    DECLARE
    --  TYPE my_nums IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;
      v_nums my_nums := my_nums(1, 2, 3);
      v_total number;
    BEGIN
      select sum(column_value) into v_total from table(v_nums);
      DBMS_OUTPUT.PUT_LINE
        ('Sum of the numbers is ' || TO_CHAR(v_total));
    END;
    Sum of the numbers is 6

  • Reading Data from a SQL table to a Logical file on R/3 appl. Server

    Hi All,
    We would like to create Master Data using LSMW (direct Input) with source files from R/3 Application Server.
    I have created files in the'/ tmp/' directory however I do not know how to read data from the SQL table and insert it into the logical file on the R/3 application server.
    I am new to ABAP , please let me know the steps to be done to acheive this .
    Regards
    - Ajay

    Hi,
    You can find lot of information about Datasets in SCN just SEARCH once.
    You can check the code snippet for understanding
    DATA:
    BEGIN OF fs,
      carrid TYPE s_carr_id,
      connid TYPE s_conn_id,
    END OF fs.
    DATA:
      itab    LIKE
              TABLE OF fs,
      w_file  TYPE char255 VALUE 'FILE',
      w_file2 TYPE char255 VALUE 'FILE2'.
    SELECT carrid connid FROM spfli INTO TABLE itab.
    OPEN DATASET w_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT. "Opening a file in Application
                                                            " Server to write data
    LOOP AT itab INTO fs.
      TRANSFER fs TO w_file. "" Writing the data into the Application server file
    ENDLOOP.
    CLOSE DATASET w_file.
    OPEN DATASET w_file FOR INPUT IN TEXT MODE ENCODING DEFAULT. "Opening a file in Application
                                                          " server to read data
    FREE itab.
    DO.
      READ DATASET w_file INTO fs.
      IF sy-subrc EQ 0.
        APPEND fs TO itab.
        OPEN DATASET w_file2 FOR APPENDING IN TEXT MODE ENCODING DEFAULT. "Appending more data to the file in the
                                                           " application server
        TRANSFER fs TO w_file2.
        CLOSE DATASET w_file2.
      ELSE.
        EXIT.
      ENDIF.
    ENDDO.
    Regards
    Sarves

  • LPX-00601: Invalid token in: err while trying to read data from xml

    Hey ,
    While trying to read data from xml i got err:
    LPX-00601: Invalid token in: 'path'
    the proc. i'm using to read data from the xml is:
    procedure read_xml_file_test (in_filename in varchar2)
    is
    my_dir  varchar2(20) := 'XML_DIR;
      cur_emp2 number:=0;
      l_bfile   BFILE;
      l_clob    CLOB;
      l_parser  dbms_xmlparser.Parser;
      l_doc     dbms_xmldom.DOMDocument;
      l_nl      dbms_xmldom.DOMNodeList;
      l_nl2    dbms_xmldom.DOMNodeList;
      l_n       dbms_xmldom.DOMNode; 
      l_n2     dbms_xmldom.DOMNode;
      l_temp    VARCHAR2(1000);
    v_errors        internet_clients.errors%type; 
    src_csid       NUMBER := NLS_CHARSET_ID('UTF8'); 
    dest_offset    INTEGER := 1;
    src_offset     INTEGER := 1;
    lang_context   INTEGER := dbms_lob.default_lang_ctx;
    warning        INTEGER;
    v_count       number := 0;   --total records
    v_count_s      number := 0;   -- sucsess record
    v_count_f      number := 0;   -- failed record
    v_flag varchar2(1);
    v_char2 varchar2(1);
    v_l1 VARCHAR2(255);
    v_l2 VARCHAR2(255);
    v_l3 VARCHAR2(255);
    v_l4 VARCHAR2(255);
    v_l6 VARCHAR2(255);
    BEGIN
      l_bfile := BFileName(my_dir, in_filename);
      dbms_lob.createtemporary(l_clob, cache=>FALSE);
      dbms_lob.open(l_bfile, dbms_lob.lob_readonly);
      dbms_lob.loadclobfromfile(l_clob, l_bfile, dbms_lob.getlength(l_bfile), dest_offset,src_offset, src_csid, lang_context, warning);                        
      dbms_lob.close(l_bfile);
      -- make sure implicit date conversions are performed correctly
      dbms_session.set_nls('NLS_DATE_FORMAT','''DD/MM/RR HH24:MI:SS''');   
      -- Create a parser.
      l_parser := dbms_xmlparser.newParser;
      -- Parse the document and create a new DOM document.
        dbms_xmlparser.parseClob(l_parser, l_clob);
        l_doc := dbms_xmlparser.getDocument(l_parser);
      -- Free resources associated with the CLOB and Parser now they are no longer needed.
      dbms_lob.freetemporary(l_clob);
      dbms_xmlparser.freeParser(l_parser);  
      -- Get a list of all the  nodes in the document using the XPATH syntax.
      l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'soap:Envelope/soap:Body/GetFieldsNameResponse/GetFieldsNameResult/diffgr:diffgram/DataSet_FRM_GANERIC_PROP/FRM_GANERIC_PROP');
      -- Loop through the list and create a new record in a tble collection
      -- for each  record.
      FOR cur_emp IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
       l_n := dbms_xmldom.item(l_nl, cur_emp);
       cur_emp2:=0;
       loop
         v_count := v_count + 1;
         begin
        -- Use XPATH syntax to assign values to he elements of the collection.
        dbms_xslprocessor.valueOf(l_n,'L1/text()',v_l1);
        dbms_xslprocessor.valueOf(l_n,'L2/text()',v_l2);
        dbms_xslprocessor.valueOf(l_n,'L3/text()',v_l3);
        dbms_xslprocessor.valueOf(l_n,'L4/text()',v_l4);
        dbms_xslprocessor.valueOf(l_n,'L6/text()',v_l6);
            exception
      when others then 
      null;
      end;
    exit when cur_emp2=dbms_xmldom.getLength(l_nl2);
      END LOOP;
      end loop;
      -- Free any resources associated with the document now it
      -- is no longer needed.
      dbms_xmldom.freeDocument(l_doc);
      --remove file to another directory   
          --COMMIT;  -- do not use the commit if you want to run this proc. from within the search_dir_list proc , because it execute a select from tmp table dir_list which contain a "on commit delete rows"  clause.    
      /*EXCEPTION
      /*WHEN OTHERS THEN
       dbms_lob.freetemporary(l_clob);
        dbms_xmlparser.freeParser(l_parser);
       dbms_xmldom.freeDocument(l_doc);
        null;
        ROLLBACK; */
    END;While trying to execute this i got:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00601: Invalid token in: 'soap:Envelope/soap:Body/GetFieldsNameResponse/GetFieldsNameResult/diffgr:diffgram/DataSet_FRM_GANERIC_PROP/FRM_GANERIC_PROP'
    ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line 939
    ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line 967
    ORA-06512: at "MARKET.READ_XML_FILE_TEST", line 51
    ORA-06512: at line 1
    i guess i mised somthing at the line
    l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'soap:Envelope/soap:Body/GetFieldsNameResponse/GetFieldsNameResult/diffgr:diffgram/DataSet_FRM_GANERIC_PROP/FRM_GANERIC_PROP');i attached here part of my xml:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    - <soap:Body>
    - <GetFieldsNameResponse xmlns="http://tempuri.org/">
    - <GetFieldsNameResult>
    - <xs:schema id="DataSet_FRM_GANERIC_PROP" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    - <xs:element name="DataSet_FRM_GANERIC_PROP" msdata:IsDataSet="true" msdata:Locale="he-IL">
    - <xs:complexType>
    - <xs:choice minOccurs="0" maxOccurs="unbounded">
    - <xs:element name="FRM_GANERIC_PROP">
    - <xs:complexType>
    - <xs:sequence>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:choice>
      </xs:complexType>
      </xs:element>
      </xs:schema>
    - <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
    - <DataSet_FRM_GANERIC_PROP xmlns="">
    - <FRM_GANERIC_PROP diffgr:id="FRM_GANERIC_PROP1" msdata:rowOrder="0">
      <L1>val1</L1>
      <L2>val2</L2>
      <L3>val3</L3>
      <L4>val4</L4>
      <L6>val6</L6>
      </FRM_GANERIC_PROP>
      </DataSet_FRM_GANERIC_PROP>
      </diffgr:diffgram>
      </GetFieldsNameResult>
      </GetFieldsNameResponse>
      </soap:Body>
      </soap:Envelope>I Guess it somthing that have to do with node definition ,
    but i have tried so many combinations and none ot those worked for me.
    i'm deeply stuck here.
    What do i miss here?
    THANKS yair
    Edited by: yair_k on 02:30 14/10/2010

    Hey , after got a lot of success with the xml reading part , i wonder if you
    can help me with a problem while trying to reading that xml from a web service.
    i use a procedure as followes:
    FUNCTION read_from_web_service(in_username in varchar2 , in_password in varchar2)
      RETURN CHAR
    AS
      l_service          UTL_DBWS.service;
      l_call             UTL_DBWS.call;
      l_a_ns                     VARCHAR2(32767);
      l_wsdl_url         VARCHAR2(32767);
      l_namespace        VARCHAR2(32767);
      l_service_qname    UTL_DBWS.qname;
      l_port_qname       UTL_DBWS.qname;
      l_operation_qname  UTL_DBWS.qname;
      l_xmltype_in       SYS.XMLTYPE;
      l_xmltype_out      SYS.XMLTYPE;
      l_return           VARCHAR2(32767);
    BEGIN
      l_wsdl_url        := 'http://www.company.com/publisherService/ServiceGetpublisherTable.asmx?wsdl';
      l_namespace       := 'http://tempuri.org/';
      l_service_qname   := UTL_DBWS.to_qname(l_namespace, 'ServiceGetpublisherTable');
      l_port_qname      := UTL_DBWS.to_qname(l_namespace, 'ServiceGetpublisherTableSoap');
      l_operation_qname := UTL_DBWS.to_qname(l_namespace, 'GetFieldsName');
      l_service := UTL_DBWS.create_service (
        wsdl_document_location => URIFACTORY.getURI(l_wsdl_url),
        service_name           => l_service_qname);
      l_call := UTL_DBWS.create_call (
        service_handle => l_service,
        port_name      => l_port_qname,
        operation_name => l_operation_qname);
      l_xmltype_in := SYS.XMLTYPE('<?xml version="1.0" encoding="utf-8"?>
        <GetFieldsName xmlns="' || l_namespace || '">
        <user>' || in_username || '</user>
        <password>'|| in_password || '</password>
        </GetFieldsName>');
      l_xmltype_out := UTL_DBWS.invoke(call_Handle => l_call,
                                       request     => l_xmltype_in);
      UTL_DBWS.release_call (call_handle => l_call);
      UTL_DBWS.release_service (service_handle => l_service);
      l_return := l_xmltype_out.extract('//GetFieldsName/text()').getstringVal();
       dbms_output.put_line(l_return);     
      RETURN l_return;
    END;but when i run it i got message:
    ORA-29532: Java call terminated by uncaught Java exception: javax.xml.rpc.soap.SOAPFaultException: Server did not recognize the value of HTTP Header SOAPAction: .
    regarding the line:
    l_xmltype_out := UTL_DBWS.invoke(call_Handle => l_call,
    request => l_xmltype_in);
    So , i deeply stuck here!
    my web service description is:
      <?xml version="1.0" encoding="utf-8" ?>
    - <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    - <wsdl:types>
    - <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
    - <s:element name="GetFieldsName">
    - <s:complexType>
    - <s:sequence>
      <s:element minOccurs="0" maxOccurs="1" name="user" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" />
      </s:sequence>
      </s:complexType>
      </s:element>
    - <s:element name="GetFieldsNameResponse">
    - <s:complexType>
    - <s:sequence>
    - <s:element minOccurs="0" maxOccurs="1" name="GetFieldsNameResult">
    - <s:complexType>
    - <s:sequence>
      <s:element ref="s:schema" />
      <s:any />
      </s:sequence>
      </s:complexType>
      </s:element>
      </s:sequence>
      </s:complexType>
      </s:element>
    - <s:element name="GetMSG_ByUser_Not_Readed">
    - <s:complexType>
    - <s:sequence>
      <s:element minOccurs="0" maxOccurs="1" name="user" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" />
      </s:sequence>
      </s:complexType>
      </s:element>
    - <s:element name="GetMSG_ByUser_Not_ReadedResponse">
    - <s:complexType>
    - <s:sequence>
    - <s:element minOccurs="0" maxOccurs="1" name="GetMSG_ByUser_Not_ReadedResult">
    - <s:complexType>
    - <s:sequence>
      <s:element ref="s:schema" />
      <s:any />
      </s:sequence>
      </s:complexType>
      </s:element>
      </s:sequence>
      </s:complexType>
      </s:element>
    - <s:element name="SetMSG_ByUser_Not_Readed_As_Readed">
    - <s:complexType>
    - <s:sequence>
      <s:element minOccurs="0" maxOccurs="1" name="user" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="Rec_Id" type="s:string" />
      </s:sequence>
      </s:complexType>
      </s:element>
    - <s:element name="SetMSG_ByUser_Not_Readed_As_ReadedResponse">
    - <s:complexType>
    - <s:sequence>
      <s:element minOccurs="1" maxOccurs="1" name="SetMSG_ByUser_Not_Readed_As_ReadedResult" type="s:boolean" />
      </s:sequence>
      </s:complexType>
      </s:element>
      </s:schema>
      </wsdl:types>
    - <wsdl:message name="GetFieldsNameSoapIn">
      <wsdl:part name="parameters" element="tns:GetFieldsName" />
      </wsdl:message>
    - <wsdl:message name="GetFieldsNameSoapOut">
      <wsdl:part name="parameters" element="tns:GetFieldsNameResponse" />
      </wsdl:message>
    - <wsdl:message name="GetMSG_ByUser_Not_ReadedSoapIn">
      <wsdl:part name="parameters" element="tns:GetMSG_ByUser_Not_Readed" />
      </wsdl:message>
    - <wsdl:message name="GetMSG_ByUser_Not_ReadedSoapOut">
      <wsdl:part name="parameters" element="tns:GetMSG_ByUser_Not_ReadedResponse" />
      </wsdl:message>
    - <wsdl:message name="SetMSG_ByUser_Not_Readed_As_ReadedSoapIn">
      <wsdl:part name="parameters" element="tns:SetMSG_ByUser_Not_Readed_As_Readed" />
      </wsdl:message>
    - <wsdl:message name="SetMSG_ByUser_Not_Readed_As_ReadedSoapOut">
      <wsdl:part name="parameters" element="tns:SetMSG_ByUser_Not_Readed_As_ReadedResponse" />
      </wsdl:message>
    - <wsdl:portType name="ServiceGetpublisherTableSoap">
    - <wsdl:operation name="GetFieldsName">
      <wsdl:input message="tns:GetFieldsNameSoapIn" />
      <wsdl:output message="tns:GetFieldsNameSoapOut" />
      </wsdl:operation>
    - <wsdl:operation name="GetMSG_ByUser_Not_Readed">
      <wsdl:input message="tns:GetMSG_ByUser_Not_ReadedSoapIn" />
      <wsdl:output message="tns:GetMSG_ByUser_Not_ReadedSoapOut" />
      </wsdl:operation>
    - <wsdl:operation name="SetMSG_ByUser_Not_Readed_As_Readed">
      <wsdl:input message="tns:SetMSG_ByUser_Not_Readed_As_ReadedSoapIn" />
      <wsdl:output message="tns:SetMSG_ByUser_Not_Readed_As_ReadedSoapOut" />
      </wsdl:operation>
      </wsdl:portType>
    - <wsdl:binding name="ServiceGetpublisherTableSoap" type="tns:ServiceGetpublisherTableSoap">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    - <wsdl:operation name="GetFieldsName">
      <soap:operation soapAction="http://tempuri.org/GetFieldsName" style="document" />
    - <wsdl:input>
      <soap:body use="literal" />
      </wsdl:input>
    - <wsdl:output>
      <soap:body use="literal" />
      </wsdl:output>
      </wsdl:operation>
    - <wsdl:operation name="GetMSG_ByUser_Not_Readed">
      <soap:operation soapAction="http://tempuri.org/GetMSG_ByUser_Not_Readed" style="document" />
    - <wsdl:input>
      <soap:body use="literal" />
      </wsdl:input>
    - <wsdl:output>
      <soap:body use="literal" />
      </wsdl:output>
      </wsdl:operation>
    - <wsdl:operation name="SetMSG_ByUser_Not_Readed_As_Readed">
      <soap:operation soapAction="http://tempuri.org/SetMSG_ByUser_Not_Readed_As_Readed" style="document" />
    - <wsdl:input>
      <soap:body use="literal" />
      </wsdl:input>
    - <wsdl:output>
      <soap:body use="literal" />
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
    - <wsdl:binding name="ServiceGetpublisherTableSoap12" type="tns:ServiceGetpublisherTableSoap">
      <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
    - <wsdl:operation name="GetFieldsName">
      <soap12:operation soapAction="http://tempuri.org/GetFieldsName" style="document" />
    - <wsdl:input>
      <soap12:body use="literal" />
      </wsdl:input>
    - <wsdl:output>
      <soap12:body use="literal" />
      </wsdl:output>
      </wsdl:operation>
    - <wsdl:operation name="GetMSG_ByUser_Not_Readed">
      <soap12:operation soapAction="http://tempuri.org/GetMSG_ByUser_Not_Readed" style="document" />
    - <wsdl:input>
      <soap12:body use="literal" />
      </wsdl:input>
    - <wsdl:output>
      <soap12:body use="literal" />
      </wsdl:output>
      </wsdl:operation>
    - <wsdl:operation name="SetMSG_ByUser_Not_Readed_As_Readed">
      <soap12:operation soapAction="http://tempuri.org/SetMSG_ByUser_Not_Readed_As_Readed" style="document" />
    - <wsdl:input>
      <soap12:body use="literal" />
      </wsdl:input>
    - <wsdl:output>
      <soap12:body use="literal" />
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
    - <wsdl:service name="ServiceGetpublisherTable">
    - <wsdl:port name="ServiceGetpublisherTableSoap" binding="tns:ServiceGetpublisherTableSoap">
      <soap:address location="http://www.company.com/publisherService/ServiceGetpublisherTable.asmx" />
      </wsdl:port>
    - <wsdl:port name="ServiceGetpublisherTableSoap12" binding="tns:ServiceGetpublisherTableSoap12">
      <soap12:address location="http://www.company.com/publisherService/ServiceGetpublisherTable.asmx" />
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>also i have to mention that i have changed publisher references inside the code , and i also canot
    supply username and password , so i guess you canot test it. still i not shure if my definitions (namespace est.) inside my code defined correctly.
    hope you can help me with this.
    regards
    yair

  • Reading Data into a PDF form with cfpdfform and cfpdfformparam

    I have been trying to read data from a query into a PDF form. I have the application setup to generate a new pdf file for every record in the database table which is working perfectly, but when I try to have the application pre-populate the form fields in the pdf form they remain empty. I have included a snippet of the code that creates the PDF documents. I am using Adobe LiveCycle Designer 8.0 to create the PDF form.
    Snippet Example:
    <cfoutput query="renewals">
    <cfset new_file = "#reportnumber#.pdf" />
    <cfpdfform action = "populate" source = "beta.pdf" destination = "#new_file#">
      <cfpdfformparam name="Legal_Contact_Name" value="#LegalContactName#">
    </cfpdfform>
    <cfpdf action = "write" source = "#new_file#" destination = "#new_file#" flatten = "yes" overwrite  = "yes" />
    </cfoutput>
    All help is greatly appreciated...

    I'm just glad I might be of any help.
    First, make sure the image is embeded as a base64 encoded string in the xml structure you're working with on your form you've built in LiveCycle Designer.
    I do this by reading the image file and outputing its content as a base64 string:
    <cffile action="read" file="#expandPath('Path/to/your/image/file/BC.TIF')#" variable="imgObj" />
    <img>#toBase64(imgObj)#</img>
    Your PDF form should be bound to this 'img' field from your xml structure in LiveCycle Designer.
    This works perfectly and the image from the xml is indeed displayed in the PDF form generated with cfpdf.
    BUT, from the moment you convert the pdf form to static pdf document, the image will be gone - the dynamic text remains.
    Note:  I never further investigated why the image disapears once the pdf form is converted to 'static' pdf.  Thinking about it now, it might have been an incoding issue.  The toBase64() function in ColdFusion has an optional "Encoding" argument, may be by playing with the encoding the image might finally 'survive' the conversion to static pdf.
    Good luck.
    note: this will populate the pdf form from your xml structure in ColdFusion.
    <cfpdfform action="populate" source="/path/to/LiveCycle_generated_templateForm.pdf" xmldata="#your_xml_structure#" destination="/path/to/result.pdf" overwrite="yes" />

  • How to read data from external memory

    Hi all,
    I am using MB5B report in my program to get Current stock. So, I have submitted MB5B report in background and i have exported the result to SAP memory. Now i want to read some of the values of exported output. I don want to use complete MB5B output. Only soem fields from MB5B report.
    How can I do it ?
    Thx & regards,
    Ravi

    Hi,
    SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens
    SAP Memmory - use to acess memmory area between session
    eg:- when u call a transaction or report ( within ur program) want the value of the prticular field should have value define by you.
    Then you use GET and SET parameter command field you set or get should have parameter ID
    Set
    http://www.geocities.com/SiliconValley/Campus/6345/set_para.htm
    GET
    http://www.geocities.com/SiliconValley/Campus/6345/get_para.htm
    EXPORT
    http://www.geocities.com/SiliconValley/Campus/6345/export01.htm
    Award points if found helpfull....
    Cheers,
    Chandra Sekhar.

Maybe you are looking for