Hwo to get the spool number from report output

Hi,
I am displaying some output in the report using write statements and within my program I need to collect the output written by write statements and send it as an email.So for that I need to generate the spool number and I am using the below code to do that
CONSTANTS:
    l_linsz TYPE sy-linsz VALUE 201, " Line size
    l_paart TYPE sy-paart VALUE 'X_65_132'.  " Paper Format
  l_uname = sy-uname .
  l_repid = sy-repid .
*-- Setup the Print Parmaters
  CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
      authority              = space
      copies                 = '1'
      cover_page             = space
      data_set               = space
      department             = space
      destination            = space
      expiration             = '1'
      immediately            = space
      new_list_id            = k_x
      no_dialog              = k_x
      user                   = l_uname
    IMPORTING
      out_parameters         = l_mstr_print_parms
      valid                  = l_mc_valid
    EXCEPTIONS
      archive_info_not_found = 1
      invalid_print_params   = 2
      invalid_archive_params = 3
      OTHERS                 = 4.
*-- Make sure that a printer destination has been set up
*-- If this is not done the PDF function module ABENDS
  IF l_mstr_print_parms-pdest = space.
    l_mstr_print_parms-pdest = k_lp01.
  ENDIF.
*-- Explicitly set line width, and output format so that
*-- the PDF conversion comes out OK
  l_mstr_print_parms-linsz = l_linsz.
  l_mstr_print_parms-paart = l_paart.
  l_variante = sy-slset.
* submitting the spool request
  *SUBMIT (l_repid) TO SAP-SPOOL*
                   *SPOOL PARAMETERS l_mstr_print_parms*
                   *WITHOUT SPOOL DYNPRO*
                   *AND RETURN.*
*Calculating the lenth of report name
  lv_len = STRLEN( l_repid ) .
*consutrucing the database variable  rq2name to search the spool
*request
  IF lv_len >= 9 .
    CONCATENATE l_repid+0(9)
                l_uname+0(3) INTO lc_rq2name .
  ELSE.
    lv_len = 9 - lv_len .
    DO lv_len TIMES .
      CONCATENATE lv_temp '_' INTO lv_temp .
    ENDDO.
    CONCATENATE l_repid lv_temp
                l_uname INTO lc_rq2name .
  ENDIF.
*selecting the spool request using the above consructed varibale
  SELECT   * FROM tsp01 INTO TABLE lt_tsp01
          WHERE rq2name = lc_rq2name .
*sorting the interbla table
  SORT  lt_tsp01 BY rqcretime DESCENDING .
*reading the first spool request
  READ TABLE lt_tsp01 INTO ls_tsp01 INDEX 1.
but the problem with the above code is I am using variants to execute the report but when the above piece of code is getting executed it is clearing all the variant values on the selection screen and it is defaulting the values on the selection screen.
Is there any way i can execute the above code without any problem in the selection screen.
Thanks
Bala Duvvuri

Hello Bala,
I wouldn't SUBMIT the same program to get the Spool number. You can achieve the same by [NEW-PAGE PRINT ON|http://help.sap.com/abapdocu_702/en/abapnew-page_print.htm#!ABAP_ADDITION_1@1@] command.
Check the code snippet i've provided below:
DATA: spfli_wa         TYPE spfli,
      print_parameters TYPE pri_params,
      valid_flag       TYPE c LENGTH 1.
START-OF-SELECTION.
  CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
      no_dialog            = 'X'
    IMPORTING
      out_parameters       = print_parameters
      valid                = valid_flag
    EXCEPTIONS
      invalid_print_params = 2
      OTHERS               = 4.
  IF valid_flag = 'X' AND sy-subrc = 0.
*   1. Write the output to the output list(no spool is generated)
    SELECT carrid connid
           FROM spfli
           INTO CORRESPONDING FIELDS OF spfli_wa.
      WRITE: / spfli_wa-carrid, spfli_wa-connid.
    ENDSELECT.
*   2. Write the output to SAP spool(no list is displayed)
    NEW-PAGE PRINT ON PARAMETERS print_parameters NO DIALOG.
    SELECT carrid connid
           FROM spfli
           INTO CORRESPONDING FIELDS OF spfli_wa.
      WRITE: / spfli_wa-carrid, spfli_wa-connid.
    ENDSELECT.
    NEW-PAGE PRINT OFF.
    MESSAGE i000(zibi027) WITH 'Spool' sy-spono 'is generated!!!'.
    "You can use the spool number (SY-SPONO) to email the list output
  ENDIF.
Hope this helps.
BR,
Suhas

Similar Messages

  • My iPod touch was stolen. Can you tell me how I can get the serial number from my iTunes account?, My iPod touch was stolen. Can you tell me how I can get the serial number from my iTunes account?

    My iPod touch was stolen. Can I get the serial number from my iTunes account?

    See the end of:
    - If you previously turned on FIndMyiPod on the iPod in Settings>iCloud and wifi is on and connected go to iCloud: Find My iPhone, sign in and go to FIndMyiPhone. If the iPod has been restored it will never show up.
    - You can also wipe/erase the iPod and have the iPod play a sound via iCloud.
    - If not shown, then you will have to use the old fashioned way, like if you lost a wallet or purse.
    - Change the passwords for all accounts used on the iPod and report to police
    - There is no way to prevent someone from restoring the iPod (it erases it) using it.
    - Apple will do nothing without a court order                                                
    Reporting a lost or stolen Apple product                                        
    - iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number

  • To get the spool Number

    How to get the spool number when i trigger a print from smartform .

    You will get the spool no. in the parameter <b>JOB_OUTPUT_INFO</b> after calling the Smartforms function module in print program.
    Field is <b>JOB_OUTPUT_INFO-SPOOLIDS</b>
    CALL FUNCTION fm_name
    EXPORTING
    * ARCHIVE_INDEX =
    * ARCHIVE_PARAMETERS =
    * CONTROL_PARAMETERS =
    * MAIL_APPL_OBJ =
    * MAIL_RECIPIENT =
    * MAIL_SENDER =
    * OUTPUT_OPTIONS =
    * USER_SETTINGS = 'X'
    * your parameters
    IMPORTING
    * DOCUMENT_OUTPUT_INFO =
      JOB_OUTPUT_INFO = JOB_OUTPUT_INFO
    * JOB_OUTPUT_OPTIONS =
      TABLES
    * your tables
      EXCEPTIONS
        FORMATTING_ERROR = 1
        INTERNAL_ERROR = 2
        SEND_ERROR = 3
        USER_CANCELED = 4
        OTHERS = 5.
    IF SY-SUBRC <> 0.
      <error handling>
    ENDIF.
    Regards

  • HT1349 My Ipad was stolen, How can I get the serial Number from Apple. It was registered with them

    I had  2 Ipads, a mac book pro and a Mac Air stolen 2 weeks ago
    I am trying to locate one of the serial numbers, but cant find the last box.  Can I get the serial number from Apple. It was registered and now it is not showing up as one of my products.
    Thanks

    The easiest way to find your serial number is this Open Itunes...click help... run diagnostics.....(tick or untick as necessary) so that you just have ticked the last two,  device connectivity and device sync.  run these tests. it will say no ipod/ipad found but will give results of test....scroll down to bottom of results... here you will find the serial number of your last attached devices.

  • Is There Anyway I Can Get The Serial Number From My iPod Without Actually Having The iPod?

    Is There Anyway I Can Get The Serial Number From My iPod Without Actually Having The iPod?

    - Sign in hee and look:
    My Support Profile
    - On your syncing computer go to iTunes>Preferences>Devices and hover the mouse pointer over the iPod backup and the SN will pop up in a box.

  • Where do I get the serial number from for Photoshop Elements

    Where do I get the serial number from for Photoshop Elements?  I need to use on a new computer as my old computer crashed.  Orignally the program was loaded with a download application online.

    If you registered PSE, go to the main page of adobe.com and look for My Adobe, then work through the links there and you will find a list of your adobe products and their serial numbers.

  • Enable to get the aligned XML Publisher Report output

    Hi All,
    In BI Publisher report there is a column called short_text which have data like
    i) Price Basis : Free Delivery to Tata Power SED
    (ii) Delivery time : Within 6 weeks from the date of PO
    (iii) Payment : After acceptance within 7 Days
    (iv) Freight : Nil
    (v) Insurance : Nil
    (vi) Packing & Forwarding :Nil
    (vii) CST/VAT : @ 5% VAT
    (viii) Excise Duty : @ 10.3%
    (ix) Service Tax : Nil
    (x) Entry Tax : Nil
    (xi) Warranty : Nil
    But the data in the output is not coming in the aligned manner like above.
    Could anyone please help on this??
    Regards,
    Swapna.

    Hello Bala,
    I wouldn't SUBMIT the same program to get the Spool number. You can achieve the same by [NEW-PAGE PRINT ON|http://help.sap.com/abapdocu_702/en/abapnew-page_print.htm#!ABAP_ADDITION_1@1@] command.
    Check the code snippet i've provided below:
    DATA: spfli_wa         TYPE spfli,
          print_parameters TYPE pri_params,
          valid_flag       TYPE c LENGTH 1.
    START-OF-SELECTION.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          no_dialog            = 'X'
        IMPORTING
          out_parameters       = print_parameters
          valid                = valid_flag
        EXCEPTIONS
          invalid_print_params = 2
          OTHERS               = 4.
      IF valid_flag = 'X' AND sy-subrc = 0.
    *   1. Write the output to the output list(no spool is generated)
        SELECT carrid connid
               FROM spfli
               INTO CORRESPONDING FIELDS OF spfli_wa.
          WRITE: / spfli_wa-carrid, spfli_wa-connid.
        ENDSELECT.
    *   2. Write the output to SAP spool(no list is displayed)
        NEW-PAGE PRINT ON PARAMETERS print_parameters NO DIALOG.
        SELECT carrid connid
               FROM spfli
               INTO CORRESPONDING FIELDS OF spfli_wa.
          WRITE: / spfli_wa-carrid, spfli_wa-connid.
        ENDSELECT.
        NEW-PAGE PRINT OFF.
        MESSAGE i000(zibi027) WITH 'Spool' sy-spono 'is generated!!!'.
        "You can use the spool number (SY-SPONO) to email the list output
      ENDIF.
    Hope this helps.
    BR,
    Suhas

  • OracleSOA - File Adapter - Correct mechanism to get the line number from the file

    We are using Oracle SOA process to read data from a file, process the data and write it to the database. SOA process is created using Oracle File Adapter to read the data, Oracle BPEL to transform & process the data and Oracle DB Adapter to write the data into the database.
    Oracle File Adapter uses native schema to process the fixed length data in the file. The number of rows in the file may exceed more than 500,000, to support processing of large files we use chunk size in the file adapter as 4000 rows. In each read operation, file adapter reads the data that matches to the schema, there might be few rejected rows as well.
    Oracle File Adapter property - jca.file.LineNumber gives me only the line number till what line the data is read. Is there any way to get the line number in the xml message, which exactly matches to the line number in the file.?
    Flat File Format: (Every file has one header, trailer and multiple data lines),
    HEADER02 -
    L01
    L01
    L01
    TRAILER02
    Line number is one of the crucial requirement in the development of the SOA service, this is used to back trace the information from which source and line the data has come.

    Hi Anshul,
    Thanks for sharing your thoughts.
    I am using DB adapter to insert the data into db.
    While doing the xsl transformation I can get the index of the message using position(), but that is not the correct way as there can be rejected lines by the file adapter.
    Even if I maintain a local counter variable, it will not consider rejected lines and increment that, which is not correct.
    Thanks,
    Ravindra

  • How to get the Personal Number from Address Number

    Hi,
    I have one requirement which is as follows.
    I have one Customer. I am fetching Address Number(ADRNR) of this customer number from table KNA1.
    I want to find the Personal number linked to this Address number and Customer.
    Is there is any table or FM from where i will get the Personal number of the Customer using Customer number and Address number?
    Kindly Help

    Hi Sachin,
    Check this FM BUP_PARTNER_PERSNUMBER_GET
    " Check KNB1 and the Field name is PERNR, Most of the times this is not maintianed.
    " This refers to the Employees who are assigned as Customers
    " In XD03 go to the Company Code Data there you can find this Value
    " For more info contact your Functional Consultant
    " This is to the Best of my knowledge
    Also Check KNB1 but000 Tables
    Cheerz
    Ram

  • Need Functional help to get the MIRO  Number from deferent seanario.

    Hai All
    I developed One report to get the Accounting document number by using PO number.
    CASE 1. In My Case One single PO is having Multiple GRN each GRN amy Have Single MIRO number or Multiple MIRO Number.
    I ll get this By Using PO with Line Item Number this is not an Issue.
    CASE2.  In One PO Multiple GRN is there and One Single ITEM is having Two GRN Number, Each GRN is having single Accounting Number (MIRO) number.
    Tell me how can i do this
    actually I am using RSEG and BKPF table to get accounting Number.
    Which table i have to use to get the Accounting number by using GRN number.
    Please Help me.
    Jagadish.

    iText. PdfReader.getNumberOfPages()

  • How to get the BP number from OBJECT ID or ID rel.Object taken from HRP1001

    Hi Gurus
    I am trying to find the BP number from the OBJECT ID or ID rel.Object which i got from the table HRP1001 in CRM  but i am not able to find the link straightaway to get that details
    Kindly help me to find out the table where i can simply put the OBJECT ID or ID rel.Object to get the BP number for ROLE EMPLOYEE
    Thanks a lot
    Regards
    Soni

    Hi Soni,
    I found this in a different thread:
    first you get the all connected partners to a position by selecting SOBID from hrp1001 (with OTYPE / OBJID of position, RELAT = 008, SCLAS = CP).
    With this SOBID go again to HRP1001 and fill the SOBID into OBJID (with OTYPE = CP, SCLAS = BP) and the SOBID of the result is the connected partner number.
    You can also use FM 'CRM_CENTRALPERSON_GET' instead of the last SELECT-Statement. Here IV_PERSON_ID = SOBID (of first select). You get the partner guid and can get data of the partner from but000.
    In this thread:
    Help needed...Infotype HRP1001--Getting details OF Position Users...
    Hope it helps.
    regards,
    Wim

  • Function to get the employee number from the username

    Hi,
    Does anyone know the standard function in CRM to get the employee number (related to the user) giving the username?
    Thanks,
    TPT

    Hello TPT,
    BP_CENTRALPERSON_GET is the FM you need.
    Provide the username and you'll get the person_id (of the organizational mgmt), business partner guid and the employee ID.
    Hope this helps,
    Regards,
    Joost

  • HT4061 How will i get the IMEI number from phone  programmatically?

    I have a requirement in which i need to get the IMEI number of the device through my application.
    Is it possible to get it programatically?
    This information will be used only for identification purpose only.
    Any pointers would be be more helpful.

    You would have better luck with responses by posting to the developers forums.

  • Where do I get the serial number from for the free download?

    Where do I get the serial number for the free download?

    There are no serials for trials. They run without one for 30 days and that's it. If they time out prematurely, there's nothing anyone can do.
    Adobe trial software expired early
    Mylenium

  • Had my ipod stolen from me was wondering if there is some way i could get the serial number to report it to the police

    anyone know a way i can get the information for my ipod off itunes or online or somewhere so i can have the info for the police

    Your Support Profile for Registered Purchases
    How to find the serial number of your Apple hardware product
    iOS- How to find the serial number, IMEI, MEID, CDN, and ICCID number

Maybe you are looking for