Creating Spool from function module

Hi friends,
I want to create a spool from my function module. I dont knw it is possible or not. Currently I am creating spool by submitting another report from my function module and exporting the values calculated in memory ID and importing in report which is not  a good practise, kindly suggest some other way.
Thanks,
Brijesh

No. Spool is not possible from Function Module. You have to use that FM from one report/program.
Thanks
Subhankar

Similar Messages

  • How to create webservice from function module

    Hello,
    I'm trying to create webservice from function module from. I choose Utilities/More Utilities/Create Webservice/..From function Module. What data should I enter in section "Enter Package/Request" ?
    When I check "Local object" checkbox I get a message "Test objects cannot be created in foreign namespaces"
    Is there any doc about this procedure (web service creation) with description of all sections ?
    thanks for any reply,
    Lukasz Ferenc

    Hi,
    Which SAP product of wich release of which SP are you using ?
    The procedure is documented in help.sap.com and in blogs and SDN forum messages.
    It means that the use of the SEARCH button should give plenty of answers...
    >When I check "Local object" checkbox I get a message "Test objects cannot be created in foreign >namespaces"
    As usual, begin your choosen name with an "Z".
    Regards,
    Olivier

  • How to create IDOC from Function module or RFC

    Hi all,
            I have tested one inbound IDOC for Time Upload to CAT2 using basic type "CATS_INSERT01"  in WE19 through function module BAPI_IDOC_INPUT1 .It works well.
    Now i need to create this IDOC once the sale order gets created thru BAPI.
    For creation of Sale order i wrote one RFC in which i will call the Standard Sale Order Bapi.My question is once the Sale order gets created in that RFC How do i trigger the IDOC for CATS upload.

    Hi,
    Which SAP product of wich release of which SP are you using ?
    The procedure is documented in help.sap.com and in blogs and SDN forum messages.
    It means that the use of the SEARCH button should give plenty of answers...
    >When I check "Local object" checkbox I get a message "Test objects cannot be created in foreign >namespaces"
    As usual, begin your choosen name with an "Z".
    Regards,
    Olivier

  • Error while creating webservice from function module in ECC

    Hi
    while creating a web service out of a function module in ECC, in the configure service section we get a message saying ' Remember that the service does not have any runtime configuration and therefore cannot be used. Create the Web service configuration in the NetWeaver Admninistrator (transaction WSADMIN2).'
    instead of check box 'release for runtime'.
    Our ECC at release 7 patch level 22.
    Checked in SCICM, SICF teh service and the folder are active.
    Please suggest if we are missing on anything
    Regards
    Kumar

    In new version on ECC, the runtime configurations needs to be performed in transaction SOAMANGER.
    On executing the transaction, it opens a browser. The important configurations to be performed are:
    1. Configure J2EE server and host. You can choose to provide the ECC server and host
    2. Administration of the service in "Single Service Administration". The navigation path may differ depending of the ECC versions. But it is related to administration of the services.
    Once done, check the WSDL generated.
    Use this WSDL in the NWDS.
    Regards,
    Sharath

  • Issue with the Package/request while creating service from function module

    Hi
    I'm creating a service form a function module. After the web service creator starts, There is a last step that asks for package and transport request. If i choose local objects, showing error as "Test Objects cannot be created in foriegn namespaces. If i give the package as it is in the attributes of the function module and transport request, showing error as " No tasks exists under the request. What is transport request??
    please if anyone has recently done such a process with NetWeaver PI 7.1. help me..
    Thanks
    Vijay

    You have to create a package for your objectsin SE80 transaction.
    How?
    http://www.sap-img.com/basis/steps-for-creating-package.htm
    Then assign this package name in your webservice creation.
    When asked for a transaport request, create one(You will find a create transport request inthe pop up which prompts you for creation of transport request).
    Regards,
    ravi kanth talagana

  • How to create a generic datasource from function module?

    Dear experts,
    I have created a generic datasource from function module. For this extrator, I created a function module and a structure.
    I have now some difficulties to continue:
    In this function module, i get data from different transparent tables. Then i put these data into an internal table.
    I just don't know what is the relatioin between the structure i defined and this internal table.
    I should make "iTab structure AA" in the source code?
    Thanks

    Hi..
    check this
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
    Generic Extraction via Function Module
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    1. Create s structure with the fields that you need from the 4 tables . Activate.
    2. Goto SE 80 Select The Function Group , Copy , Select the Function module
    " RSAX_BIW_GET_DATA_SIMPLE " and Give a New name starting With
    Y or Z .
    3. SE37 ->Your Function module name -> Change , In table tab give your structure
    name by deleting the associated type given in " XXXX " .
    4. Now select source code and Do the coding . Give Data source name in Coding .
    In your case you have to take data from more that 1 table .
    5. Activate the Function Group .
    6. In RSO2 Create the Data source , Give the Function Module Name , And Save.
    7. RSA3 -> Give data source name and Check for the Records .
    Creation of custom datasource. (Using function module)
    .Create a function group .
    . Structure ZTXXXX
    Create function module (i.e. ZTESTXXX) .
    . Create the data source using transaction (RSO2).
    . If structure exists for the table parameter of your function module then ok else create a structure for the table parameter ‘        ’.
    Test the datasource in R/3 using transaction RSA3.
    Transfer the data source to BW –System and replicate it in the BW-System.
    Message was edited by:
            shiv

  • Can we change WSDL file created from Function Module wizard??

    Hi everybody!
    I have created a web service from function module using SAP wizard.
    Now the consumer side want me to change <wsp:UsingPolicy wsdl:required="true"/>
    Is this possible???
    If so how?????
    Thank u in advance!!

    Hi Muhammad!
    As soon as you open WSDL for selected binding in the URL are of you explorer change the ws_policy with "standard" . Then simply save the wsdl and send it to the other party.
    Hope this helps!

  • How to Send Internal table to SAP Spool using Function Modules or Methods?

    Hi Experts,
    How to Send Internal table to SAP Spool using Function Modules or Methods?
    Thanks ,
    Kiran

    This is my code.
    I still get the no ABAP list data for the spool, even tho I can see it sp01?
    REPORT  Z_MAIL_PAYSLIP.
    * Declaration Part *
    tables: PERNR, PV000, T549Q, V_T514D, HRPY_RGDIR.
    infotypes: 0000, 0001, 0105, 0655.
    data: begin of ITAB occurs 0,
      MTEXT(25) type C,
      PERNR like PA0001-PERNR,
      ABKRS like PA0001-ABKRS,
      ENAME like PA0001-ENAME,
      USRID_LONG like PA0105-USRID_LONG,
    end of ITAB.
    data: W_BEGDA like HRPY_RGDIR-FPBEG,
          W_ENDDA like HRPY_RGDIR-FPEND.
    data: RETURN like BAPIRETURN1 occurs 0 with header line.
    data: P_INFO like PC407,
          P_FORM like PC408 occurs 0 with header line.
    data: P_IDX type I,
          MY_MONTH type T549Q-PABRP,
          STR_MY_MONTH(2) type C,
          MY_YEAR type T549Q-PABRJ,
          STR_MY_YEAR(4) type C,
          CRLF(2) type x value '0D0A'.
    data: W_CMONTH(10) type C.
    data: TAB_LINES type I,
          ATT_TYPE like SOODK-OBJTP.
    data: begin of P_INDEX occurs 0,
            INDEX type I,
    end of P_INDEX.
    constants: begin of F__LTYPE, "type of line
       CMD like PC408-LTYPE value '/:',  "command
       TXT like PC408-LTYPE value 's',   "textline
    end of F__LTYPE.
    constants: begin of F__CMD, "commands
      NEWPAGE like PC408-LINDA value '',
    end of F__CMD.
    data: P_LIST like ABAPLIST occurs 1 with header line.
    *data: OBJBIN like SOLISTI1 occurs 10 with header line,
    data: OBJBIN like  LVC_S_1022 occurs 10 with header line,
          DOCDATA like SODOCCHGI1,
          OBJTXT like SOLISTI1 occurs 10 with header line,
          OBJPACK like SOPCKLSTI1 occurs 1 with header line,
          RECLIST like SOMLRECI1 occurs 1 with header line,
          OBJHEAD like SOLISTI1 occurs 1 with header line,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_buffer type string,
          l_no_of_bytes TYPE i,
          l_pdf_spoolid LIKE tsp01-rqident,
          l_jobname     LIKE tbtcjob-jobname.
    data: file_length  type int4,
          spool_id     type rspoid,
          line_cnt     type i.
    *-------------------------------------------------------------------* * INITIALIZATION *
    OBJBIN = ' | '.
    append OBJBIN.
    OBJPACK-HEAD_START = 1.
    data: S_ABKRS like PV000-ABKRS.
    data: S_PABRP like T549Q-PABRP.
    data: S_PABRJ like T549Q-PABRJ.
    * SELECTION SCREEN                                                  *
    selection-screen begin of block BL1.
    parameters: PAY_VAR like BAPI7004-PAYSLIP_VARIANT default 'ESS_PAYSLIPS' obligatory.
    selection-screen end of block BL1.
    START-OF-SELECTION.
      s_ABKRS = PNPXABKR.
      S_PABRP = PNPPABRP.
      s_pabrj = PNPPABRJ.
      w_begda = PN-BEGDA.
      w_endda = PN-ENDDA.
    get pernr.
    *                                 "Check active employees
      rp-provide-from-last p0000 space pn-begda  pn-endda.
      CHECK P0000-STAT2 IN PNPSTAT2.
    *                                 "Check Payslip Mail flag
      rp-provide-from-last p0655 space pn-begda  pn-endda.
      CHECK P0655-ESSONLY = 'X'.
      rp-provide-from-last p0001 space pn-begda  pn-endda.
    *                                 "Find email address
      RP-PROVIDE-FROM-LAST P0105 '0030' PN-BEGDA PN-ENDDA.
      if p0105-usrid_LONG ne ''.
        ITAB-PERNR      = P0001-PERNR.
        ITAB-ABKRS      = P0001-ABKRS.
        ITAB-ENAME      = P0001-ENAME.
        ITAB-USRID_LONG = P0105-USRID_LONG.
        append itab.
        clear itab.
      endif.
      "SY-UCOMM ='ONLI'
    END-OF-SELECTION.
    *------------------------------------------------------------------* start-of-selection.
      write : / 'Payroll Area        : ', S_ABKRS.
      write : / 'Payroll Period/Year : ',STR_MY_MONTH,'-',STR_MY_YEAR. write : / 'System Date : ', SY-DATUM.
      write : / 'System Time         : ', SY-UZEIT.
      write : / 'User Name           : ', SY-UNAME.
      write : / SY-ULINE.
      sort ITAB by PERNR.
      loop at ITAB.
        clear : P_INFO, P_FORM, P_INDEX, P_LIST, OBJBIN, DOCDATA, OBJTXT, OBJPACK, RECLIST, TAB_LINES.
        refresh : P_FORM, P_INDEX, P_LIST, OBJBIN, OBJTXT, OBJPACK, RECLIST.
    *                                                  Retrieve Payroll results sequence number for this run
        select single * from HRPY_RGDIR where PERNR eq ITAB-PERNR
                                        and FPBEG ge W_BEGDA
                                        and FPEND le W_ENDDA
                                        and SRTZA eq 'A'.
    *                                                  Produce payslip for those payroll results
        if SY-SUBRC = 0.
          call function 'GET_PAYSLIP'
            EXPORTING
              EMPLOYEE_NUMBER = ITAB-PERNR
              SEQUENCE_NUMBER = HRPY_RGDIR-SEQNR
              PAYSLIP_VARIANT = PAY_VAR
            IMPORTING
              RETURN          = RETURN
              P_INFO          = P_INFO
            TABLES
              P_FORM          = P_FORM.
          check RETURN is initial.
    *                                                 remove linetype from generated payslip
          loop at p_form.
            objbin = p_form-linda.
            append objbin.
            line_cnt = line_cnt + 1.
          endloop.
          file_length = line_cnt * 1022.
    *                                                 create spool file of paylsip
          CALL FUNCTION 'SLVC_TABLE_PS_TO_SPOOL'
            EXPORTING
              i_file_length = file_length
            IMPORTING
              e_spoolid     = spool_id
            TABLES
              it_textdata   = objbin.
          IF sy-subrc EQ 0.
            WRITE spool_id.
          ENDIF.
          DESCRIBE table objbin.
          DATA PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
          CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
            EXPORTING
              SRC_SPOOLID                    = spool_id
              NO_DIALOG                      = ' '
              DST_DEVICE                     = 'MAIL'
    *      PDF_DESTINATION                =
    *    IMPORTING
    *      PDF_BYTECOUNT                  = l_no_of_bytes
    *      PDF_SPOOLID                    = l_pdf_spoolid
    *      LIST_PAGECOUNT                 =
    *      BTC_JOBNAME                    =
    *      BTC_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
              OTHERS                         = 12
          IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    *Download PDF file C Drive
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename = 'C:\itab_to_pdf.pdf'
          filetype = 'BIN'
        TABLES
          data_tab = pdf.
    * Transfer the 132-long strings to 255-long strings
    *  LOOP AT pdf.
    *    TRANSLATE pdf USING ' ~'.
    *    CONCATENATE gd_buffer pdf INTO gd_buffer.
    *  ENDLOOP.
    *  TRANSLATE gd_buffer USING '~ '.
    *  DO.
    *    it_mess_att = gd_buffer.
    *    APPEND it_mess_att.
    *    SHIFT gd_buffer LEFT BY 255 PLACES.
    *    IF gd_buffer IS INITIAL.
    *      EXIT.
    *    ENDIF.
    *  ENDDO.
          OBJHEAD = 'Objhead'.
          append OBJHEAD.
    * preparing email subject
          concatenate W_ENDDA(6)
                    ' Payslip-'
                    ITAB-ENAME+0(28)
                    ITAB-PERNR+4(4) ')'
                 into DOCDATA-OBJ_DESCR.
          DOCDATA-OBJ_NAME = 'Pay Slip'.
          DOCDATA-OBJ_LANGU = SY-LANGU.
          OBJTXT = 'Pay Slip.'.
          append OBJTXT.
    *prepare email lines
          OBJTXT = DOCDATA-OBJ_DESCR.
          append OBJTXT.
          OBJTXT = 'Please find enclosed your current payslip.'.
          append OBJTXT.
    * Write Attachment(Main)
    * 3 has been fixed because OBJTXT has fix three lines
          read table OBJTXT index 3.
    *    DOCDATA-DOC_SIZE = ( 3 - 1 ) * 255 + strlen( OBJTXT ).
          clear OBJPACK-TRANSF_BIN.
          OBJPACK-HEAD_START = 1.
          OBJPACK-HEAD_NUM = 0.
          OBJPACK-BODY_START = 1.
          OBJPACK-BODY_NUM = 3.
          OBJPACK-DOC_TYPE = 'RAW'.
          append OBJPACK.
    * Create Message Attachment
          ATT_TYPE = 'PDF'.
          describe table OBJBIN lines TAB_LINES.
          read table OBJBIN index TAB_LINES.
    *    OBJPACK-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + strlen( OBJBIN ).
          OBJPACK-TRANSF_BIN = 'X'.
          OBJPACK-HEAD_START = 1.
          OBJPACK-HEAD_NUM = 0.
          OBJPACK-BODY_START = 1.
          OBJPACK-BODY_NUM = TAB_LINES.
          OBJPACK-DOC_TYPE = ATT_TYPE.
          OBJPACK-OBJ_NAME = 'ATTACHMENT'.
          OBJPACK-OBJ_DESCR = 'Payslip'.
          append OBJPACK.
    * Create receiver list refresh RECLIST.
          clear RECLIST.
          RECLIST-RECEIVER = itab-USRID_long.
          translate RECLIST-RECEIVER to lower case.
          RECLIST-REC_TYPE = 'U'.
          append RECLIST.
    * Send the document
    *SO_NEW_DOCUMENT_ATT_SEND_API1
          call function 'SO_DOCUMENT_SEND_API1'
            exporting
              DOCUMENT_DATA = DOCDATA
              PUT_IN_OUTBOX = 'X'
              COMMIT_WORK = 'X'
    * IMPORTING
    *   SENT_TO_ALL =
    *   NEW_OBJECT_ID =
            tables
              PACKING_LIST  = OBJPACK
              OBJECT_HEADER = OBJHEAD
              CONTENTS_BIN  = pdf
              CONTENTS_TXT  = OBJTXT
    *   CONTENTS_HEX =
    *   OBJECT_PARA =
    *   OBJECT_PARB =
              RECEIVERS = RECLIST
            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.
          if SY-SUBRC NE 0.
            ITAB-MTEXT = 'Message Not Sent to : '.
          else.
            ITAB-MTEXT = 'Message Sent to : '.
          endif.
    *    else.
    *      ITAB-MTEXT = 'Message Not Sent to : '.
    *    endif.
        else.
          "SY-SUBRC Not = 0
          ITAB-MTEXT = 'Payroll data not found : '.
        endif.
        "end of SY-SUBRC = 0.
        modify ITAB.
      endloop. "end loop at ITAB
      sort ITAB by MTEXT PERNR.
      loop at ITAB.
        at new MTEXT.
          uline.
          write : / ITAB-MTEXT color 4 intensified on.
          write : / 'Emp. Code' color 2 intensified on,
                 12 'Emp. Name' color 2 intensified on,
                 54 'Email ID' color 2 intensified on.
        endat.
        write : / ITAB-PERNR, 12 ITAB-ENAME, 54 ITAB-USRID_LONG.
      endloop.

  • How to create the INBOUND Function Module for INBOUND IDOCs

    Hi Friends,
    Can any Suggest me How to proceed to Create an INBOUND Function Module for Processing the INBOUND IDOCS
    which are recieved from XI Server ?
    I am working in SAP-ISU
    Here i will recieve the INBOUND IDOCs for the Meter Reading Orders.
    We have a Standard INBOUND FUNCTION MODULE
    IDOC_INPUT_ISU_MR_UPLOAD
    which Uploads the Meter Reading Results.
    I copied the Same function Module into ZIDOC_INPUT_
    and working on it.
    Can any one suggest me, whether i am going in correct way or not.
    In IDOC_INPUT_ISU_MR_UPLOAD Inbound fun module,
    BAPI_MTRREADDOC_UPLOAD is used to Update or Insert the Meter Reading Results,
    My requirment is to Insert and Update the Meter Reading Orders which are Inbounded from XI.
    Can I Use the Same BAPI
    BAPI_MTRREADDOC_UPLOAD
    to Update the below fields,
    EABL-SERNR
    EABL-ZWNUMMER
    EABLG-ABLESGR
    EABL-V_ZWSTAND
    EABL-N_ZWSTAND
    EABL-ABLHINW
    EABL-ZSKIPC
    EABL-ADAT
    EABL-ATIMTATS
    EABL-ADATTATS
    EABL-ATIM
    EABL-ZMESSAGE
    EABL-ABLESER(Meter reader number)
    Kindly Suggest me,
    Thanks in Advance,
    Ganesh

    Hello Ganesh
    I think you are going completely astray with you z-function module for IDoc processing.
    If you look at TABLES parameter METERREADINGRESULTS (type BAPIEABLU ) of BAPI_MTRREADDOC_UPLOAD you will find many of the requested fields already:
    EABL-SERNR => BAPIEABLU-SERIALNO
    EABL-ZWNUMMER =>REGISTER
    EABLG-ABLESGR
    EABL-V_ZWSTAND
    EABL-N_ZWSTAND
    EABL-ABLHINW
    EABL-ZSKIPC
    EABL-ADAT
    EABL-ATIMTATS => ACTUALMRTIME
    EABL-ADATTATS => ACTUALMRDATE
    EABL-ATIM
    EABL-ZMESSAGE
    EABL-ABLESER(Meter reader number)
    Field EABL-ZMESSAGE appears to be custom field (at least I cannot find it on ECC 6.0). If this field was added using include CI_EABL then you probably can get these values into the BAPI using the EXTENSIONIN parameter.
    Check routine CHECK_UPLOADRECORDS in the BAPI which allows two extension structures:
    - BAPI_TE_EABL
    - BAPI_TE_EOSB
    Not surprisingly BAPI_TE_EABL contains the include CI_EABL.
    Regards
      Uwe

  • Calling a report from function module

    Hi Friends,
    I have requirement for Function Module i.e. we will add the button to the standard T-code and ( Function added in config ) then
    Function to be called from Customizing
    Program A called from customizing function
    CalculationPDFFunction  is called from program A.
    So can any one help me the logic for "calling a report from function module  ".
    Thanks in Advance.
    Regards,
    OSReddy.
    Edited by: OSReddy on Sep 23, 2011 7:31 AM

    Hi Jaya,
    Yes. It is possible to call ur custom program using SUBMIT statement.
    1. If u have data to pass then build table type RSPARAMS and use below statement.
    data:
          rspar_tab  TYPE TABLE OF rsparams,
          rspar_line LIKE LINE OF rspar_tab,
    SUBMIT report1 WITH SELECTION-TABLE rspar_tab
                   AND RETURN.
    1. If u want to create variant to the program and use that. use the below statement .
    SUBMIT report1 USING SELECTION-SET 'VAR1' "variant
                   AND RETURN.
    Regards,
    Venkat.O

  • Create Spool from Internal table & converrt the spool to PDF

    Hi All,
    My requirement is take data from a table and find amount specific to each Vendors . So I took all the data into ITAB and do all the calculation. Later after calculation I have to create a spool from this ITAB and this spool have to convert to PDF. Later this PDF have to seend via email.
    To convert the internal table to Spool , I used
    LOOP AT t_summ INTO wa_summ.
        w-amount = wa_summ-remittanceamount.
        CONCATENATE wa_summ-vendorcode
                    wa_summ-controlnum
                    w-amount INTO wa_textdata SEPARATED BY space.
        APPEND wa_textdata TO t_textdata.
      ENDLOOP.
      DESCRIBE TABLE t_textdata .
      w-file_length = syst-tfill * 1022.
      l_doctype = 'LIST'.
      l_layout = 'X_POSTSCRIPT'.
      CONCATENATE ' Listbill Summary Report for' syst-datum INTO
                          l_title SEPARATED BY space.
      l_receiver = syst-uname.
    * Create Spool
      CALL FUNCTION 'RSPO_SR_OPEN'
       EXPORTING
          dest                   = 'LOCL'
    *   LDEST                  =
          layout                 = l_layout
          name                   = 'SUMREP'
    *   SUFFIX1                =
    *   SUFFIX2                =
       copies                 = '1'
    *   PRIO                   =
    *      immediate_print        = ' '
    *   AUTO_DELETE            =
          titleline              = l_title
          receiver               = syst-uname           "
    *      division               = l_pri_params-prabt " abteilung
    *      authority              = l_pri_params-prber           "
    *   POSNAME                =
    *   ACTTIME                =
    *   LIFETIME               = '8'
    *   APPEND                 =
    *   COVERPAGE              =
    *   CODEPAGE               =
          doctype                = l_doctype
    *   ARCHMODE               =
    *   ARCHPARAMS             =
    *   TELELAND               =
    *   TELENUM                =
    *   TELENUME               =
         IMPORTING
          handle                 = l_spool_handle
          spoolid                = w-spoolid
    EXCEPTIONS
       device_missing         = 1
       name_twice             = 2
       no_such_device         = 3
       operation_failed       = 4
       OTHERS                 = 5
                .                                            "#EC DOM_EQUAL
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CALL FUNCTION 'SLVC_C1022_TO_C255'
        EXPORTING
          i_file_length = w-file_length
        TABLES
          it_c1022      = t_textdata
          et_c255       = lt_spool.
      l_length = w-file_length.
      LOOP AT lt_spool INTO ls_spool.
        l_length = l_length - 255.
        IF ( l_length > 0 ).
          l_line_length = 255.
        ELSE.
          l_line_length = l_length + 255.
        ENDIF.
    *   Write contents to spool
        CALL FUNCTION 'RSPO_SR_WRITE'
          EXPORTING
            handle = l_spool_handle
            text   = ls_spool
            length = l_line_length.
      ENDLOOP.
    * Close Spool
      CALL FUNCTION 'RSPO_SR_CLOSE'
        EXPORTING
          handle                 = l_spool_handle
         pages                  = 1
      FINAL                  = 'X'
       EXCEPTIONS
         handle_not_valid       = 1
         operation_failed       = 2
         OTHERS                 = 3
    By this I can see the spool with data in SP02.
    Then to conver to PDF, I used
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid                    = w-spoolid
          no_dialog                      = 'X'
          DST_DEVICE                     = 'LOCL'
    *      PDF_DESTINATION                =
        IMPORTING
    *      PDF_BYTECOUNT                  =
    *      PDF_SPOOLID                    =
          list_pagecount                 = list_pagecount
    *      BTC_JOBNAME                    =
    *      BTC_JOBCOUNT                   =
       TABLES
         pdf                            = t_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
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
        CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
    *   BIN_FILESIZE                    =
          filename                        = 'D:\t\t.pdf'
         filetype                        = 'BIN'
        TABLES
          data_tab                        = t_pdf
    *   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
    But later when I go and open the PDF, I am getting an error saying'Page cannot be open because it dont have any pages'
    Please help me
    Regards,
    Nikhil

    Hi Nikhil,
    <li>If you are still not able to find out the problem. You can an alternative way , which is used for the same purpose.
    <li>Try this way. It creates spool and and same CONVERT_ABAPSPOOLJOB_2_PDF fm is used to convert spool to PDF. It works. Test this test program.
       REPORT ztest_notepad.
       DATA:g_val         TYPE c,
            w_pripar      TYPE pri_params,
            w_arcpar      TYPE arc_params,
            i_pdf         TYPE TABLE OF tline,
            spoolid       LIKE tsp01-rqident,
            l_no_of_bytes TYPE i,
            l_pdf_spoolid LIKE tsp01-rqident,
            l_jobname     LIKE tbtcjob-jobname,
            l_jobcount    LIKE tbtcjob-jobcount.
       DATA:it_t001 TYPE TABLE OF t001 WITH HEADER LINE.
       START-OF-SELECTION.
         SELECT * FROM t001 INTO TABLE it_t001.
         "Read, determine, change spool print parameters and archive parameters
         CALL FUNCTION 'GET_PRINT_PARAMETERS'
           EXPORTING
             in_archive_parameters  = w_arcpar
             in_parameters          = w_pripar
             layout                 = 'X_65_132'
             line_count             = 65
             line_size              = 132
             no_dialog              = 'X'
           IMPORTING
             out_archive_parameters = w_arcpar
             out_parameters         = w_pripar
             valid                  = g_val.
         IF g_val  NE space AND sy-subrc = 0.
           w_pripar-prrel = space.
           w_pripar-primm = space.
           NEW-PAGE PRINT ON  NEW-SECTION PARAMETERS w_pripar ARCHIVE PARAMETERS w_arcpar NO DIALOG.
         ENDIF.
         LOOP AT it_t001.
           WRITE:/ it_t001.
         ENDLOOP.
         NEW-PAGE PRINT OFF.
         CALL FUNCTION 'ABAP4_COMMIT_WORK'.
         spoolid = sy-spono.
         CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
             src_spoolid   = spoolid
             no_dialog     = ' '
           IMPORTING
             pdf_bytecount = l_no_of_bytes
             pdf_spoolid   = l_pdf_spoolid
             btc_jobname   = l_jobname
             btc_jobcount  = l_jobcount
           TABLES
             pdf           = i_pdf.
         CALL FUNCTION 'GUI_DOWNLOAD'
           EXPORTING
             filename = 'C:\temp\test.pdf'
             filetype = 'BIN'
           TABLES
             data_tab = i_pdf.
    Thanks
    Venkat.

  • Urgent: Web Service from Function Module

    Hi guys, I am new to this area so please help to achieve following:
    I want to show a demo to load data from a web service to BI. I have performed the following steps and don’t know how to process further. Please help me in the sense where do I put the logic to show fields on the web service and ….
    1. I have created a web service data source in BI with four fields (Cal dat, material, amount and currency)
    2. This created a Web Service /RFC FM automatically.
    3. From this FM I created a web service (Utilities – create web service – from function module)
    4. I followed the web service creation wizard.
    Thanks,
    sam

    releasing and related steps are fine,
    what i want to know is, BW/BI datasource will create a FM, from this FM inturn I will create a webservice.
    Lets say BW/BI datasource has 4 fields account, company, amount & currency.
    I want to enter these 4 values from the webservice which will bring these values to BW delta queue and eventually get loaded in BW.
    For this process do I need to code anything in the FM or any other part of the system

  • Return to ALV from function module

    Hi to all,
    I'm new in this forum. My name is Guido and I'm working with Abap from 6 months ago and I whish to greet all of you. Now I have a problem that I try to explain simply. I have created a report with 2 screens: the first one is a selction screen and the second one is an ALV.
    In the ALV I have added a button "Details" and on pressing it a new screen is opened. This screen is "created" in a function module developed by me.
    All works fine but there is a problem: I'm not able to return from the screen of the function module to the ALV(second screen of my report). I try to use "Leave to transaction" or "Submit" calls but in all cases the screen displayed is the selection screen(first screen of my report).
    Note also that the selction screen has some obligatory fields so I can't use the "Leave to tansaction..AND SKIP FIRST SCREEN" or "Call tansaction..AND SKIP FIRST SCREEN" call.
    There is a way to solve this problem? Any suggestion?
    Thanks in advance for the help!

    One thing I don't catch here. You said you have two screens - one selection screen and another with ALV. Then you said that you have added details buton which trigger new screen. So how many screen do you really have. Where is the ALV placed - is it selection screen?
    If so than whenever you return from FG screen your program ends and shows initial screen which is selection screen.
    You need something like
    "selection screen
    call screen 100.  "next screen also set as 100
    "pbo screen 100
    ALV here
    "pai screen 100
    call function ....
    "in function
    call screen 200 with ALV details
    "pai screen 200
    LEAVE TO SCREEN 0.
    Doing it like that you will get the processing back to ALV.
    Regards
    Marcin

  • How to create EXCEPTION in function module

    hi experts,
              how to create exeptions in function module i want step by step.
    regards,
    chaitu

    hi,
    Raising Exceptions
    There are two ABAP statements for raising exceptions. They can only be used in function modules:
    RAISE except.
    und
    MESSAGE.....RAISING except.
    The effect of these statements depends on whether the calling program handles the exception or not. The calling program handles an exception If the name of the except exception or OTHERS is specified after the EXCEPTION option of the CALL FUNCTION statement.
    If the calling program does not handle the exception
    ·         The RAISEstatement terminates the program and switches to debugging mode.
    ·         The MESSAGE..... RAISING statement displays the specified message. Processing is continued in relation to the message type.
    If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE..... RAISING statement does not display a message. Instead, it fills the system fields sy-msgid, sy-msgty, sy-msgno , and SY-MSGV1 to SY-MSGV4.
    Source Code of READ_SPFLI_INTO_TABLE
    The entire source code of READ_SPFLI_INTO_TABLE looks like this:
    FUNCTION read_spfli_into_table.
    ""Local Interface:
    *"       IMPORTING
    *"             VALUE(ID) LIKE  SPFLI-CARRID DEFAULT 'LH '
    *"       EXPORTING
    *"             VALUE(ITAB) TYPE  SPFLI_TAB
    *"       EXCEPTIONS
    *"              NOT_FOUND
      SELECT * FROM spfli INTO TABLE itab WHERE carrid = id.
      IF sy-subrc NE 0.
        MESSAGE e007(at) RAISING not_found.
      ENDIF.
    ENDFUNCTION.
    The function module reads all of the data from the database table SPFLI where the key field CARRID is equal to the import parameter ID and places the entries that it finds into the internal table spfli_tab. If it cannot find any entries, the exception NOT_FOUND is triggered with MESSAGE ... RAISING. Otherwise, the table is passed to the caller as an exporting parameter.
    Calling READ_SPFLI_INTO_TABLE
    The following program calls the function module READ_SPFLI_INTO_TABLE:
    REPORT demo_mod_tech_fb_read_spfli.
    PARAMETERS carrier TYPE s_carr_id.
    DATA: jtab TYPE spfli_tab,
          wa   LIKE LINE OF jtab.
    CALL FUNCTION 'READ_SPFLI_INTO_TABLE'
         EXPORTING
              id        = carrier
         IMPORTING
              itab      = jtab
         EXCEPTIONS
              not_found = 1
              OTHERS    = 2.
    CASE sy-subrc.
      WHEN 1.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
      WHEN 2.
        MESSAGE e702(at).
    ENDCASE.
    LOOP AT jtab INTO wa.
      WRITE: /  wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
    ENDLOOP.
    The actual parameters carrier and jtab have the same data types as their corresponding interface parameters in the function module. The exception NOT_FOUND is handled in the program. It displays the same message that the function module would have displayed had it handled the error.
    Hope this is helps,Do reward.

  • Creating Includes for Function Modules

    Hi Experts,
    Can you please let me know how to create includes for function modules.
    I came across this in a standard include program, which was generated by a function library. The includes inside this program where linked to the function modules (when I double clicked on them).
    Please let me know how to create it.
    Thanks in advance !
    Regards,
    Anand Patil.

    Hi,
    have a look at the code for better understanding
    Declaration of Workareas                                             *
      DATA: lwa_e1bp2017_gm_item_create TYPE e1bp2017_gm_item_create,
            lwa_data         TYPE edidd, " Work area for IDOC
            lwa_control      TYPE edidc. " Work Area for control rec
    Read the control data information of idoc.
      loop at idoc_contrl INTO lwa_control Where mestyp = lc_mbgmcr.
    Extract the data from the segments.
        LOOP AT idoc_data INTO lwa_data
        WHERE docnum = lwa_control-docnum and
              segnam = lc_item_create.
    *->> Set the tabix of the internal table
          lv_index = sy-tabix.
    Move the Material Document Item Segment data
          MOVE lwa_data-sdata TO lwa_e1bp2017_gm_item_create.
    Modify the material document item data  internal table
          PERFORM sub_modify_idocdata changing lwa_e1bp2017_gm_item_create.
    *->> set the changed values to the IDOC SDATA
          MOVE  lwa_e1bp2017_gm_item_create TO lwa_data-sdata.
    *->> Modify the table
          MODIFY idoc_data FROM lwa_data index lv_index.
    Clear the Work areas
          CLEAR : lwa_data,
                  lwa_e1bp2017_gm_item_create.
        ENDLOOP.                                     "LOOP AT t_idoc_data
    Call the BAPI function module to create the
    appropriate Material Document
        CALL FUNCTION 'BAPI_IDOC_INPUT1'
          EXPORTING
            input_method          = input_method
            mass_processing       = mass_processing
          IMPORTING
            workflow_result       = workflow_result
            application_variable  = application_variable
            in_update_task        = in_update_task
            call_transaction_done = call_transaction_done
          TABLES
            idoc_contrl           = idoc_contrl
            idoc_data             = idoc_data
            idoc_status           = idoc_status
            return_variables      = return_variables
            serialization_info    = serialization_info
          EXCEPTIONS
            wrong_function_called = 1
            OTHERS                = 2.
        IF sy-subrc = 1.
          RAISE wrong_function_called.
        ENDIF.
      endloop.
    ENDFUNCTION.
    here when we write the statment
    PERFORM sub_modify_idocdata changing lwa_e1bp2017_gm_item_create and double click on sub_modify_idocdata .
    it will create a include with the name "LZDTSINT052F_GPOMS_GMF01 ".
    now we can write the FORM ..END FORM In this inculde.like this.
    ***INCLUDE LZDTSINT052F_GPOMS_GMF01 .
    *&      Form  sub_modify_idocdata
    Modify the material document item data  internal table
    FORM sub_modify_idocdata
    CHANGING pwa_e1bp2017_gm_item_create TYPE e1bp2017_gm_item_create.
    contant declaration
      CONSTANTS: lc_261(3) TYPE c VALUE '261'.
      DATA : lv_aplzl LIKE resb-aplzl,
             lv_aufpl LIKE resb-aufpl,
             lv_subrc LIKE sy-subrc,
             lv_charg LIKE resb-charg,
             lv_uom LIKE pwa_e1bp2017_gm_item_create-entry_uom.
      CLEAR: pwa_e1bp2017_gm_item_create-reserv_no,
             pwa_e1bp2017_gm_item_create-res_item.
    *->> Get SAP storage bin & Storage type from the Z table
      SELECT lgtyp lgpla
        INTO (pwa_e1bp2017_gm_item_create-stge_type,
              pwa_e1bp2017_gm_item_create-stge_bin)
         UP TO 1 ROWS
        FROM zdtsint050_sttyp
         WHERE zstorage_typ = pwa_e1bp2017_gm_item_create-stge_type
          AND  zstorage_bin = pwa_e1bp2017_gm_item_create-stge_bin.
      ENDSELECT.
      IF sy-subrc NE 0.
        CLEAR: pwa_e1bp2017_gm_item_create-stge_type,
               pwa_e1bp2017_gm_item_create-stge_bin.
      ENDIF.
      PERFORM get_oper CHANGING pwa_e1bp2017_gm_item_create.
    Get the Reservation number and Reservation item number
    basing on the idoc data.
      SELECT rspos werks lgort
             INTO (pwa_e1bp2017_gm_item_create-res_item,
                  pwa_e1bp2017_gm_item_create-plant,
                     pwa_e1bp2017_gm_item_create-stge_loc)
             FROM resb
             UP TO 1 ROWS
             WHERE rsnum = pwa_e1bp2017_gm_item_create-reserv_no
             AND   matnr = pwa_e1bp2017_gm_item_create-material
             AND   charg = pwa_e1bp2017_gm_item_create-batch
             AND   aufnr = pwa_e1bp2017_gm_item_create-orderid
             AND   vornr = pwa_e1bp2017_gm_item_create-activity
             AND   bwart = lc_261.
      ENDSELECT.
      IF sy-subrc <> 0.
    Start of insertion for R31K993797
        CLEAR lv_charg.
        SELECT rspos werks lgort
             INTO (pwa_e1bp2017_gm_item_create-res_item,
                  pwa_e1bp2017_gm_item_create-plant,
                     pwa_e1bp2017_gm_item_create-stge_loc)
             FROM resb
             UP TO 1 ROWS
             WHERE rsnum = pwa_e1bp2017_gm_item_create-reserv_no
             AND   matnr = pwa_e1bp2017_gm_item_create-material
             AND   charg = lv_charg
             AND   aufnr = pwa_e1bp2017_gm_item_create-orderid
             AND   vornr = pwa_e1bp2017_gm_item_create-activity
             AND   ( splkz = 'X' or
                     splkz = space )
             AND   bwart = lc_261.
        ENDSELECT.
        IF sy-subrc <> 0.
    End of insertion for R31K993797
          SELECT SINGLE werks lgort
                INTO (pwa_e1bp2017_gm_item_create-plant,
                       pwa_e1bp2017_gm_item_create-stge_loc)
                FROM resb
                WHERE rsnum = pwa_e1bp2017_gm_item_create-reserv_no.
          CLEAR : pwa_e1bp2017_gm_item_create-reserv_no,
                  pwa_e1bp2017_gm_item_create-res_item.
        ENDIF.
      ENDIF.
    get SAP UOM
      SELECT SINGLE zsap_uom
                    INTO lv_uom
                    FROM zca_uom_conv
                    WHERE zext_uom = pwa_e1bp2017_gm_item_create-entry_uom.
      IF sy-subrc = 0.
        pwa_e1bp2017_gm_item_create-entry_uom = lv_uom.
      ENDIF.
    ENDFORM.                    " sub_modify_idocdata
    *&      Form  get_oper
         Get the operation
         <--P_PWA_E1BP2017_GM_ITEM_CREATE_RE  Segment
    FORM get_oper  CHANGING p_pwa_e1bp2017_gm_item_create TYPE
                   e1bp2017_gm_item_create.
      DATA : l_aufpl LIKE afko-aufpl,
             l_aplzl LIKE afvc-aplzl.
      REFRESH : i_op.
      UNPACK p_pwa_e1bp2017_gm_item_create-orderid TO
             p_pwa_e1bp2017_gm_item_create-orderid.
    Get the reservation and routing number for the order
      SELECT SINGLE
             rsnum
             aufpl
             FROM afko
             INTO (p_pwa_e1bp2017_gm_item_create-reserv_no,
                   l_aufpl)
             WHERE aufnr = p_pwa_e1bp2017_gm_item_create-orderid.
      IF sy-subrc = 0.
        CALL FUNCTION 'CONVERSION_EXIT_NUMCV_INPUT'
          EXPORTING
            input  = p_pwa_e1bp2017_gm_item_create-activity
          IMPORTING
            output = p_pwa_e1bp2017_gm_item_create-activity.
      ENDIF.
    ENDFORM.                    " get_oper
    Regards,
    nagaraj

Maybe you are looking for