Generic Subroutine Paramters

hI.
How to define a subroutine with a GENERIC hashed table and pass it as a parameter.
And then how to call via perform .
Please help.

hi AMC,
I hope this is what you want:
DATA : gt_bkpf TYPE HASHED TABLE OF bkpf
               WITH UNIQUE KEY bukrs belnr gjahr.
PERFORM routine USING gt_bkpf.
FORM routine USING lt_bkpf.
you can also use like:
FORM routine USING lt_bkpf TYPE ANY TABLE.
hope this helps
ec

Similar Messages

  • Generate subroutine 36 error

    Dear all,
    how can I generate more than 36 subroutine pools or dynamic programs (not perstistent programs)?
    Best regards,
    Christoph
    what I do (test case):
    Data: it_prog type stringtab.
    append 'Program  SUBPOOL.' to it_prog.
    append 'Data: result type i.' to it_prog.
    append 'form eval changing result.' to it_prog.
    append '  result = result + 1.' to it_prog.
    append 'endform.' to it_prog.
    Do 100 times.
        Do 100 times.
    CALL METHOD lc_test->process
      EXPORTING
        it_tab = it_prog
      receiving
        RESULT = result
    enddo.
    method PROCESS.
    Data: prog type string.
    generate subroutine pool it_tab name prog.
    endmethod.
    Message was edited by:
            Christoph Aschauer

    Hi all,
    I solved the problem as follows:
    - limitation of 36 subroutines: SUBMIT program. (this program generates the generic subroutine pools (communication via DB or shared objects possible)
    Christoph

  • Subroutine that takes in an array, fills it in and then spits it back out.

    I'm looking for an example where I can create a generic subroutine that takes in an array and then operates on it and then spits the entire array back out. I'm pretty sure this is simple, but I just can't figure it out... In essence I want this:
    main {
    array bob = something
    process_array(bob) /* this part takes in bob...does some stuff and then spits the modified bob back out */
    ....now go on with the rest of my program...
    process_array {
    /* this does something to the array bob */
    I'd appreciate any help. The syntax is just killing me. I can already write the code to do the manipulations for each specific array. Basically I'm reading a csv file and putting it into an array. I would like to write a subroutine that will do this for whatever file and array I give it.
    Thanks
    Edited by: nukular on May 20, 2008 3:19 PM

    nukular wrote:
    process_array(bob) /* this part takes in bob...does some stuff and then spits the modified bob back out */You either want the method to return nothing or you would want this:
    array ted = process_array(bob);Not much point in returning the array reference if you do not keep it.

  • Customer Statement via Email

    HI,
    I have config the Customer statement by means of correnpondence & it working fine.
    But I need to send it through email maintained in customer master when i run f.27 mails should be send automatically.
    For doing this do we need to do any config required or do we need to direaclty write it in the program code it self.
    Regards
    Ravi

    I have the same requirement to email from f.27 customer statement automatically
    what logic did you put to solved, can you explain me please
    There are two problems which is controlling F.27.  IT have created Z PROGRAM to control the printing and email the customer
    ZFIO_ACCOUNT_STATEMENT_EMAIL   -> program
    ZWAG_COMMON_ROUTINE                   - > Include
    ZWAG_SAPSCRIPT_ROUTINES_EM         -> Include
    ZEMAIL_SEND                                             -> Include added for email .
    The program is running fine but I have to type email id and spool number which I don't want. The program should search customer automatically based on email address from XD02 ( Customer ) .
    *&  Include           ZEMAIL_SEND                                      *
    *ZEMAIL_SEND.
    *&      Form  setup_output_parameters
    *       text
    *&  Include
    *  Purpose:
    *  Provide generic subroutines for any ABAP programs with intention of
    *  sending email (SAPOffice or Internet) with attachments
    * This report provides an example for sending an Spool
    * request as PDF via BCS
    parameters:
    mailto  type ad_smtpadr default  '[email protected]' obligatory,
    rqident type tsp01-rqident obligatory.
    DATA:v_adrnr LIKE kna1-adrnr.
    "  Mail related declarations
    "Variables
    DATA :
        G_SENT_TO_ALL   TYPE SONV-FLAG,
        G_TAB_LINES     TYPE I.
    "Types
    TYPES:
        T_DOCUMENT_DATA  TYPE  SODOCCHGI1,
        T_PACKING_LIST   TYPE  SOPCKLSTI1,
        T_ATTACHMENT     TYPE  SOLISTI1,
        T_BODY_MSG       TYPE  SOLISTI1,
        T_RECEIVERS      TYPE  SOMLRECI1,
        T_PDF            TYPE  TLINE.
    "Workareas
    DATA :
        W_DOCUMENT_DATA  TYPE  T_DOCUMENT_DATA,
        W_PACKING_LIST   TYPE  T_PACKING_LIST,
        W_ATTACHMENT     TYPE  T_ATTACHMENT,
        W_BODY_MSG       TYPE  T_BODY_MSG,
        W_RECEIVERS      TYPE  T_RECEIVERS,
        W_PDF            TYPE  T_PDF.
    "Internal Tables
    DATA :
        I_DOCUMENT_DATA  TYPE STANDARD TABLE OF T_DOCUMENT_DATA,
        I_PACKING_LIST   TYPE STANDARD TABLE OF T_PACKING_LIST,
        I_ATTACHMENT     TYPE STANDARD TABLE OF T_ATTACHMENT,
        I_BODY_MSG       TYPE STANDARD TABLE OF T_BODY_MSG,
        I_RECEIVERS      TYPE STANDARD TABLE OF T_RECEIVERS,
        I_PDF            TYPE STANDARD TABLE OF T_PDF.
    data send_request  type ref to cl_bcs.
    data document      type ref to cl_document_bcs.
    data recipient     type ref to if_recipient_bcs.
    data bcs_exception type ref to cx_bcs.
    data sent_to_all   type os_boolean.
    data pdf_size      type so_obj_len.
    data pdf_content   type solix_tab.
    data pdf_xstring   type xstring.
    DATA: TAB_LINES LIKE SY-TABIX.
    *Variables for EMAIL functionality
    DATA: MAILDATA LIKE SODOCCHGI1.
    DATA: MAILPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
    DATA: MAILHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
    DATA: MAILBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    DATA: MAILTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    DATA: MAILREC LIKE SOMLREC90 OCCURS 0 WITH HEADER LINE.
    DATA: SOLISTI1 LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
    start-of-selection.
      perform create_pdf.
      perform send.
    *  perform  get_otf_code. " piroz
    *&      Form  send
    form send.
      try.
    *     -------- create persistent send request ------------------------
          send_request = cl_bcs=>create_persistent( ).
    *     -------- create and set document -------------------------------
          pdf_content = cl_bcs_convert=>xstring_to_solix( pdf_xstring ).
          document = cl_document_bcs=>create_document(
                i_type    = 'PDF'
                i_hex     = pdf_content
                i_length  = pdf_size
                i_subject = 'Accounting statement' ).  "#EC NOTEXT
    *     add document object to send request
          send_request->set_document( document ).
    *     --------- add recipient (e-mail address) -----------------------
    *     create recipient object
          recipient = cl_cam_address_bcs=>create_internet_address( mailto ).
    *     add recipient object to send request
          send_request->add_recipient( recipient ).
    *     ---------- send document ---------------------------------------
          sent_to_all = send_request->send( i_with_error_screen = 'X' ).
          commit work.
          if sent_to_all is initial.
            message i500(sbcoms) with mailto.
          else.
            message s022(so).
          endif.
    *   ------------ exception handling ----------------------------------
    *   replace this rudimentary exception handling with your own one !!!
        catch cx_bcs into bcs_exception.
          message i865(so) with bcs_exception->error_type.
      endtry.
    endform.                    "send
    *&      Form  create_pdf
    * Create PDF Content
    * 1) get attributes of spool request
    * 2) convert spool request to PDF dependent on document type
    form create_pdf.
      data rq       type tsp01.
      data bin_size type i.
      data dummy    type table of rspoattr.
    *   ------------ get attributes of spool request ---------------------
      call function 'RSPO_GET_ATTRIBUTES_SPOOLJOB'
        exporting
          rqident     = rqident
        importing
          rq          = rq
        tables
          attributes  = dummy
        exceptions
          no_such_job = 1
          others      = 2.
      if sy-subrc <> 0.
        message e126(po) with rqident.
      endif.
    * TYPE-POOLS szadr.
    *  DATA: l_addr1_complete TYPE szadr_addr1_complete,
    *        l_adsmtp_line    TYPE szadr_adsmtp_line,
    *        ld_intad type knb1-intad.
    ** default: print payment advice
    *  c_finaa-nacha = '1'.
    **  Read mail address of vendor from knb1.customer no is available in kna1 payment data     structure
    *  clear ld_intad.
    *  IF NOT i_knb1-kunnr IS INITIAL and
    *     not i_knb1-zbukrs is initial.
    *    SELECT SINGLE intad
    *      INTO ld_intad
    *      FROM knb1
    *      WHERE kunnr = i_knb1-kunnr
    *      AND bukrs = i_knb1-zbukrs.
    *          IF NOT ld_intad IS INITIAL.
    *          c_finaa-nacha = 'I'.
    *          c_finaa-intad = ld_intad.
    *          ENDIF.
    *  ENDIF.
    ** check that address number is available
    *  IF NOT i_kna1-zadnr IS INITIAL.
    **   read complete address of vendor/customer
    *      CALL FUNCTION 'ADDR_GET_COMPLETE'
    *         EXPORTING
    *              addrnumber     = i_kna1-zadnr
    *         IMPORTING
    *              addr1_complete = l_addr1_complete
    *         EXCEPTIONS
    *              OTHERS         = 4.
    *      IF sy-subrc EQ 0.
    *             READ TABLE l_addr1_complete-id_intad                               "Insert ECDK900445
    *             INTO l_adsmtp_line                                                  "Insert ECDK900445
    *             WITH KEY adsmtp-flgdefault = 'X'.                                   "Insert ECDK900445
    *           IF sy-subrc EQ 0
    *           AND NOT l_adsmtp_line-id_intad IS INITIAL.
    **     choose message type 'I'nternet and fill email address
    *           c_finaa-nacha = 'I'.
    *           c_finaa-intad = ld_intad.
    *          ENDIF.
    *    ENDIF.
    *  ENDIF.
    *ENDFUNCTION.
    *  select SINGLE adrnr from kna1 from adr6
    *  into table internal table where
    *  kna1-kunnr eq = it_kna1-kunnr.
    ** select email ids from adr6
    *  select addrnumber smtp_addr from adr6 INTO table it_adr6
    *   where addrnumber = v_adrnr.
    *   LOOP AT it_adr6 INTO wa_adr6.
    *     i_reclist-receiver = wa_adr6-smtp_addr.
    *     i_reclist-rec_type = 'U'.
    *     i_reclist-com_type = 'INT'.
    *     i_reclist-notif_del = 'X'.
    *     i_reclist-notif_ndel = 'X'.
    *     i_reclist-notif_read = 'X'.
    *     i_reclist-express = 'X'.
    *     APPEND i_reclist.
    *     CLEAR: i_reclist, wa_adr6-smtp_addr.
    *     ENDLOOP.
    *in function module 'SO_NEW_DOCUMENT_ATT_SEND_API1' field receivers  = i_reclist.
    *CALL FUNCTION 'ZCUSTOMER_MAIL_00002310' "
    *  EXPORTING
    *    i_bkorm =                    bkorm
    *    i_koart =                    bkorm-koart
    *    i_kna1 =                     kna1
    *    i_knb1 =                     knb1
    **    i_lfa1 =                     lfa1
    **    i_lfb1 =                     lfb1
    *  TABLES
    *    t_fimsg =                    fimsg
    *  CHANGING
    *    c_finaa =                    finaa
    *    c_itcpo =                    itcpo
    **   c_archive_index = SPACE     " toa_dara
    **   c_archive_params = SPACE    " arc_params .  "  ZCUSTOMER_MAIL_00002310
    *Function module to send mail to Recipients
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = W_DOCUMENT_DATA
          PUT_IN_OUTBOX              = 'X'
          COMMIT_WORK                = 'X'
        IMPORTING
          SENT_TO_ALL                = G_SENT_TO_ALL
        TABLES
          PACKING_LIST               = I_PACKING_LIST
          CONTENTS_BIN               = I_ATTACHMENT
          CONTENTS_TXT               = I_BODY_MSG
          RECEIVERS                  = I_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.
      IF SY-SUBRC = 0 .
        MESSAGE I303(ME) WITH 'Mail has been Successfully Sent.'.
      ELSE.
        WAIT UP TO 2 SECONDS.
        "This program starts the SAPconnect send process.
        SUBMIT RSCONN01 WITH MODE = 'INT'
        WITH OUTPUT = 'X'
        AND RETURN.
      ENDIF.
    *   --- convert spool request into PDF, dependent on document type ---
      if rq-rqdoctype = 'OTF' or rq-rqdoctype = 'SMART'.
        call function 'CONVERT_OTFSPOOLJOB_2_PDF'
          exporting
            src_spoolid              = rqident
            no_dialog                = 'X'
            pdf_destination          = 'X'
            no_background            = 'X'
          importing
            pdf_bytecount            = bin_size
            bin_file                 = pdf_xstring
          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
            others                   = 12.
        if sy-subrc <> 0.
          message e712(po) with sy-subrc 'CONVERT_OTFSPOOLJOB_2_PDF'.
        endif.
      elseif rq-rqdoctype = 'LIST'.
        call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
          exporting
            src_spoolid              = rqident
            no_dialog                = 'X'
            pdf_destination          = 'X'
            no_background            = 'X'
          importing
            pdf_bytecount            = bin_size
            bin_file                 = pdf_xstring
          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 e712(po) with sy-subrc 'CONVERT_ABAPSPOOLJOB_2_PDF'.
        endif.
      else.
        message e789(po) with rq-rqdoctype.
      endif.
      pdf_size = bin_size.
    endform.                    "create_pdf
    *       FORM OUTPUT_OPENFI                                            *
    FORM OUTPUT_OPENFI.
      DATA: T_FIMSG LIKE FIMSG OCCURS 10 WITH HEADER LINE.
      CALL FUNCTION 'OPEN_FI_PERFORM_00002310_P'
           EXPORTING
                I_BKORM          = BKORM
                I_KOART          = C_KOART
                I_KNA1           = KNA1
                I_KNB1           = KNB1
    *            I_LFA1           = LFA1
    *            I_LFB1           = LFB1
           TABLES
                T_FIMSG          = T_FIMSG
           CHANGING
                C_FINAA          = ST_FINAA
                C_ITCPO          = ST_ITCPO.
    *            C_ARCHIVE_INDEX  = H_ARCHIVE_INDEX
    *            C_ARCHIVE_PARAMS = H_ARCHIVE_PARAMS.
      LOOP AT T_FIMSG.
        CALL FUNCTION 'FI_MESSAGE_COLLECT'
             EXPORTING
                  I_FIMSG       = T_FIMSG
                  I_XAPPN       = 'X'
             EXCEPTIONS
                  MSGID_MISSING = 1
                  MSGNO_MISSING = 2
                  MSGTY_MISSING = 3
                  OTHERS        = 4.
      ENDLOOP.
    ENDFORM.
    Form GET_OTF_CODE.
        DATA: BEGIN OF OTF OCCURS 0.
              INCLUDE STRUCTURE ITCOO .
        DATA: END OF OTF.
        DATA: ITCPO LIKE ITCPO.
        DATA: ITCPP LIKE ITCPP.
        CLEAR ITCPO.
        ITCPO-TDGETOTF = 'X'.
    *  Start writing OTF code
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          FORM     = 'Z140_ACC_STAT_01'
          LANGUAGE = SY-LANGU
          OPTIONS  = ITCPO
          DIALOG   = ' '
        EXCEPTIONS
          OTHERS   = 1.
      CALL FUNCTION 'START_FORM'
        EXCEPTIONS
          ERROR_MESSAGE = 01
          OTHERS        = 02.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          WINDOW        = 'MAIN'
        EXCEPTIONS
          ERROR_MESSAGE = 01
          OTHERS        = 02.
    *  Close up Form and get OTF code
      CALL FUNCTION 'END_FORM'
        EXCEPTIONS
          ERROR_MESSAGE = 01
          OTHERS        = 02.
      MOVE-CORRESPONDING ITCPO TO ITCPP.
      CALL FUNCTION 'CLOSE_FORM'
        IMPORTING
          RESULT  = ITCPP
        TABLES
          OTFDATA = OTF
        EXCEPTIONS
          OTHERS  = 1.
    *  Move OTF code to structure SOLI form email
    CLEAR SOLISTI1.
      REFRESH SOLISTI1.
      LOOP AT OTF.
        SOLISTI1-LINE = OTF.
        APPEND SOLISTI1.
      ENDLOOP.
    ENDFORM.                    "GET_OTF_CODE
    SAP recommends to use BTE 2013  and added the coding for email.
    CREATED:      ZCUSTOMER_MAIL_00002310
    TABLES: KNA1,                          "Kunden A-Segment
            KNB1,                          "Kunden B-Segment
            LFA1,                          "Lieferanten A-Segment
            LFB1,                          "Lieferanten B-Segment
            BKORM, "Korrespondenzanforderungen
            FINAA.                         "Daten zum Sendemedium
    DATA: SAVE_KOART LIKE BKORM-KOART,     "Hilfsfeld Kontoart
          SAVE_LAND1 LIKE KNA1-LAND1,      "Hilfsfeld Faxanschluß
          SAVE_TELFX LIKE KNA1-TELFX,      "Hilfsfeld Faxanschluß
          SAVE_ZSABE LIKE KNB1-ZSABE,      "Hilfsfeld Faxanschluß
    SAVE_INTAD LIKE KNB1-INTAD.      "Hilfsfeld Internet
    KNA1       = I_KNA1.
    LFA1       = I_LFA1.
    KNB1       = I_KNB1.
    LFB1       = I_LFB1.
    BKORM      = I_BKORM.
    SAVE_KOART = I_KOART.
    CLEAR: SAVE_LAND1,
           SAVE_TELFX,
           SAVE_ZSABE.
    IF SAVE_KOART = 'D'.
    SAVE_LAND1 = KNA1-LAND1.
    SAVE_TELFX = KNB1-TLFXS.
    SAVE_ZSABE = KNB1-ZSABE.
    SAVE_INTAD = KNB1-INTAD.
    ELSE.
    SAVE_LAND1 = LFA1-LAND1.
    SAVE_TELFX = LFB1-TLFXS.
    SAVE_ZSABE = LFB1-ZSABE.
    SAVE_INTAD = LFB1-INTAD.
    ENDIF.
    IF SAVE_INTAD NE SPACE.
    FINAA-NACHA      = 'I'.                   "Ausgabe über Internet
    FINAA-INTAD      = SAVE_INTAD.
    FINAA-TEXTF      = 'PDF'.
    ELSEIF SAVE_TELFX NE SPACE.
    FINAA-NACHA      = '2'.                   "Ausgabe auf Fax
    FINAA-TDSCHEDULE = 'IMM'.
    FINAA-TDTELELAND = SAVE_LAND1.
    FINAA-TDTELENUM  = SAVE_TELFX.
    FINAA-TDFAXUSER  = SPACE.
    FINAA-NAMEP      = SAVE_ZSABE.
    FINAA-FORMC      = 'FI_FAX_COVER_A4'.
    FINAA-FORNR      = SPACE.
    ELSE.
    FINAA-NACHA = '1'. "Drucken
    ENDIF.
    * Daten zum Sendemedium merken für Aufrufer
    C_FINAA = FINAA.
    ENDFUNCTION.
    ______________________________________ OR _________________________________________
    To get the email id from the customer file.
      TYPE-POOLS szadr.
      DATA: l_addr1_complete TYPE szadr_addr1_complete,
            l_adsmtp_line    TYPE szadr_adsmtp_line,
            ld_smtp_addr type adr6-smtp_addr.
    * default: print payment advice
      c_finaa-nacha = '1'.
    *  Read mail address of customer from knb1-kunnr no is available 
      clear ld_smtp_addr
      IF NOT i_kna1-kunnr IS INITIAL and
                    not i_adr6-smtp_addr is initial.
        SELECT SINGLE smtp_addr
          INTO ld_smtp_addr
          FROM kna1
          where kna1-adrnr = adr6-addrnumber.
              IF NOT ld_smtp_addr IS INITIAL.
              c_finaa-nacha = 'I'.
              c_finaa-intad = ld_smtp_addr.
              ENDIF.
      ENDIF.
    *        IF sy-subrc = 0.
    **  choose message type 'I'nternet and fill email address
    *      c_finaa-nacha = 'I'.
    *    ENDIF.
    *  ENDIF.
    * check that address number is available
      IF NOT i_kna1-zadnr IS INITIAL.
    *   read complete address of vendor/customer
          CALL FUNCTION 'ADDR_GET_COMPLETE'
             EXPORTING
                  addrnumber     = i_kna1-zadnrada
             IMPORTING
                  addr1_complete = l_addr1_complete
             EXCEPTIONS
                  OTHERS         = 4.
          IF sy-subrc EQ 0.
    *     check that internet address is available
    *     READ TABLE l_addr1_complete-adsmtp_tab INTO l_adsmtp_line INDEX 1.   "Delete ECDK900445
                 READ TABLE l_addr1_complete-adsmtp_tab                                "Insert ECDK900445
                 INTO l_adsmtp_line "Insert ECDK900445
                 WITH KEY adsmtp-flgdefault = 'X'. "Insert ECDK900445
               IF sy-subrc EQ 0
               AND NOT l_adsmtp_line-adsmtp-smtp_addr IS INITIAL.
    *     choose message type 'I'nternet and fill email address
               c_finaa-nacha = 'I'.
               c_finaa-intad = ld_smtp_addr.
              ENDIF.
        ENDIF.
      ENDIF.
    ENDFUNCTION.
    ( No output is going to the customer email address for the below steps )
    1. Generate spool requst ..
    2. Close_FORM ...will get the spool request
    3. RSPO_RETURN_SPOOLJOB will convet spool to OTF data
    4. Convet OTF data into PDF and send to mail.
    Try all sorts of programming  testing with the coding but  no result in SOST ( to send email it is asking to enter the email id , when the email is enter going the customer which is not correct  as there are bunches of account with different email address )
    Regards
    Piroz
    Message was edited by: Piroz Eslam

  • Handling of Fortran language extensions

    One place where Sun Fortran needs work is in management of language extensions. For example, it seems that it is not possible to exclude the generic REALLOC() extension function, meaning that it is not possible to have a generic subroutine interface of that name. The same is probably true of many other extensions. Also, using the -ansi flag causes warnings about F2003 features as extensions. It also allows incorrect use of F2003 features, and has no way to warn specifically about non-standard usage.
    I think that a good approach to language extensions is to support all of them in terms of intrinsic modules, including all of the existing non-standard extensions. Instead of compiler flags to control sets of extensions, the "-use=" flag could be used to automatically include those extensions for existing code that uses it. Supporting extensions this way also allows extensions to be used selectively in certain subroutines, and would allow renaming so that name conflicts can be avoided without completely disabling the extension.

    It may be a minority view to handle extensions as modules, but it is not a minority view to avoid interference with completely valid code. Intel Fortran compiles the code posted under bug 6579426 with no problems, despite the fact that it supports the same traditional realloc() extensions as Sun Fortran. This has to be fixed to be Standards compliant, and therefore is a bug.
    Without vendor modules, language extensions are not supposed to be brought into the name space if the first instance of their use is to declare them otherwise. If REALLOC is declared INTRINSIC, the extension becomes valid. If REALLOC is declared EXTERNAL, the extension becomes invalid, unless it is provided as an external-procedure in a library which only gets linked in if their is no such user function. Sun Fortran seems to get this right.
    If REALLOC is first seen in an INTERFACE declaration that conflicts with the intrinsic REALLOC, then the user's REALLOC takes priority. Sun Fortran gets this wrong. For example, if I declare "intrinsic :: realloc", then Intel Fortran gives me the same generic-procedure error as Sun.

  • Constructing ABAP statement dynamically...

    Hello Gurus,
    I have a custom report (ZREPTA) which calls another generic custom program (ZGENERIC) inside. This program is
    used by many other custom reports. Now this generic custom program has as a perform routine. The form-endform for this perform is written in the custom report which is calling the generic custom program. Now its not necessary that  all custom reports needs the peform routine of generic custom program (ZGENERIC).
    My question is how do I build the following ABAP lines of dynamically so that even if other program
    say ZREPTC calls ZGENERIC, it won't be a problem even if it does not have form routine defined
    since the perform statement in ZGENERIC is build dynamically.
    perform post_process tables doc_connect.
    Regards,
    Jainam.
    Edited by: Jainam Shah on Oct 2, 2009 9:08 PM
    Edited by: Jainam Shah on Oct 2, 2009 9:08 PM

    Avoiding the temptation to use generic subroutines is the best option in my opinion.
    > Because I am working on module development in whcih there can be 100's of reports from which some will and some won't use that.
    Why dont you create a function mode then which only uses this form if requested to do so). But it also might involve exposing the parameter to it's interface so you need to be carefull if it is remote enabled.
    That is what FM's are for  -> modularization.
    Cheers,
    Julius
    Edited by: Julius Bussche on Oct 2, 2009 10:01 PM

  • Passing paramters to subroutine

    Hi experts.
    I just want to ask how to do this stuff.
    I have to parameters sign1 and sign2. I use the FM module "F4IF_INT_TABLE_VALUE_REQUEST".
    Now since both parameters use the same FM, I created a subroutine which I pass the name of the parameter. But eventually, there is an error with my code when I execute. May you please help me how to solve this issue.
    Thanks a lot.
    Heres my code:
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR sign1.
      PERFORM search_help_field using sign1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR sign2.
      PERFORM search_help_field using sign2.
    FORM search_help_field using signature.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield        = 'SIGID'
          dynpprog        = sy-repid
          dynpnr          = sy-dynnr
          dynprofield     = signature
          value_org       = 'S'
        TABLES
          value_tab       = it_custid
        EXCEPTIONS
          parameter_error = 1
          no_values_found = 2
          OTHERS          = 3.
    ENDFORM.

    Hi Levis,
    Try modifying the following assignment:
    dynpprog = sy-repid
    dynpnr = sy-dynnr
    Change the SY-fields for variables:
    data: gv_repid type sy-repid,
            gv_dynnr type sy-dynnr.
    gv_repid = sy-repid.
    gv_dynnr = sy-dynnr.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    retfield = 'SIGID'
    dynpprog = gv_repid
    dynpnr = gv_dynnr
    dynprofield = signature
    value_org = 'S'
    TABLES
    value_tab = it_custid
    EXCEPTIONS
    parameter_error = 1
    no_values_found = 2
    OTHERS = 3.
    I hope it helps.
    Regards,
    M.

  • Function Module IMPORT structures not recognized in form subroutines

    Hello everyone,
    Did some searching on SDN and didn't find the answer, so I apologize if this has been covered before.
    Just finished my first Function Module.  It's a remote-enabled (RFC) function that will be called by XI to do some processing.  I have two components declared on the IMPORT tab, which we'll call "A" and "B".  Both "A" and "B" are defined with a user type, each of which is a simple structure of 4-5 fields each.  My Function Module also has two tables, and these are defined on the TABLES tab.
    Here's my problem:  When I do a syntax check, I get an error telling me that "A" and "B" are unknown.  However, I only get this error where I reference "A" or "B" in the FORM subroutines I have declared at the end of my function.
    I have my other data declarations defined globally in the "LZ...TOP" Include for my Function Module, so those don't pose a problem.  But these are my Function Module parameters, so I can't go "declare" those as I already have them defined on the appropriate tabs.
    Is there a way for me to get around this error and have them recognized globally, or do I have to resort to moving the values to some globally-declared "hold" field?  I'm hesitant to have to add them as parameters passed into the FORM routines because I pretty much reference each of the fields within the structures for "A" and "B".
    Thanks everyone.  Points definitely awarded for helpful answers.

    Dave,
    The parameters are visible only in the main program of the function module. So, if the subroutines are directly in the main function, they you should not have a issue. But if you subroutines in an include and you are calling them in the main function, then the paramters are not visible in the subroutines. In that case you will have to hold the values in a globally declared tables.
    Or you will have to pass them as parameters to Sub routines as well.
    Regards,
    Ravi
    note : please mark the helpful answers
    Message was edited by: Ravikumar Allampallam

  • Somewhat complicated nested generics question

    I have a slightly complicated generics question. I have some parameterized code that looks something like:
    public <T extends MyBaseObject> Map<String,T> loadObjectCache (Class<T> clazz) {
        // load objects of type T from somewhere (file, database, etc.)
        List<T> objs = loadObjects(clazz);
        // create map to store objects keyed by name
        Map<String,T> map = new HashMap<String,T>();
        for (T obj : objs) {
            map.put(obj.name(), obj);
        return map;
    public static void main (String[] args) {
        // load objects of type Foo (a subclass of MyBaseClass)
        Map<String,Foo> map = loadObjectCache(Foo.class);
        // retrieve a Foo by name
        Foo foo = map.get("bling");
    }This all works great, and the parameterization helps me avoid some annoying casts. Now let's suppose I want build these maps for multiple classes, and I want to create a second-order cache of objects: a Map which is keyed by Class and contains elements each of which is a Map as above (keyed by name, containing objects of the given class). So, I'd like to declare something like:
    Map<Class,Map<String,Object>> metaMap = new HashMap<Class,Map<String,Object>>();However, this doesn't quite work. The compiler complains about the following code added just before the return in loadObjectCache() because a Map<String,Foo> is not a subclass of a Map<String,Object>:
        metaMap.put(clazz, map);So, What I'd like is some way to make the above declaration of metaMap such that the objects in a given inner Map are checked to be of the same type as the Class used to store that Map in the meta-map, something like:
    Map<Class<T>,Map<String,T>> metaMap = new HashMap<Class<T>,Map<String,T>>();But this isn't quite right either. I don't want a Map that uses a particular Class as its key. Rather, I want a Map that uses multiple Class objects as keys, and the element stored for each is itself a Map containing objects of that type. I've tried a variety of uses of Object, wildcards, etc., and I'm stumped. I currently have the meta-map defined as:
    Map<Class,Map<String,?>> metaMap = new HashMap<Class,Map<String,?>>();Then in my new getObjectByName() method, I have to use an ugly cast which gives me a type safety warning:
    public <T> T getObjectByName (Class<T> clazz, String name) {
        Map<String,T> map = (Map<String,T>)metaMap.get(clazz);
        return map.get(name);
    }If anyone know how I should declare the meta-map or whether it's even possible to accomplish all this without casts or warnings, I would much appreciate it!
    Dustin

    Map<Class<?>,Map<String,?>> metaMap = new
    new HashMap<Class<?>,Map<String,?>>();
    public <T> T getObjectByName (Class<T> clazz,
    azz, String name) {
         Map<String,?> map = metaMap.get(clazz);
         return clazz.cast(map.get(name));
    }Cute. Of course, that's really only hiding the warning, isn't it?
    Also it doesn't generalize because there's no way to crete a type token for a parameterized class. So you can't use a paramterized class as a key, nor can you nest 3 Maps.
        public static <U> void main(String[] args) {
            MetaMap mm = new MetaMap();
            Appendable a = mm.getObjectByName(Appendable.class, "MyAppendable");
            Comparable<U> u = mm.getObjectByName(Comparable.class, "MyComparable"); //unchecked converstion :(
        }Hey, not to sound ungrateful though. The solution posed is very useful for a certain class of problem.

  • Dynamic subroutine call

    how to perform dynamic subroutine call

    Hi,
    In the Program where you are writing the PERFORM statement: write as below:
    PERFORM <Subroutine Name>(give the other Program name where this subroutine has to be called dynamically)  USING <paramters>.
    In the Other program you will just call this perform with FORM... ENDFORM...
    The PERFORM will not appear in that program.
    Regards,
    Anji

  • Subroutine parameters ..by default pass by value or pass by ref

    how parameters pass ?  value or ref
    if we use changing in both perform and form...will it become CALL BY REF?
    Message was edited by:
            balaji velpuri

    Hi,
    <u><b>The Parameter Interface</b></u>
    The USING and CHANGING additions in the FORM statement define the formal parameters of a subroutine. The sequence of the additions is fixed. Each addition can be followed by a list of any number of formal parameters. When you call a subroutine, you must fill all formal parameters with the values from the actual parameters. At the end of the subroutine, the formal parameters are passed back to the corresponding actual parameters.
    Within a subroutine, formal parameters behave like dynamic local data. You can use them in the same way as normal local data objects that you would declare with the DATA statement. They mask global data objects with the same name. The value of the parameters at the start of the subroutine is the value passed from the corresponding actual parameter.
    Subroutines can have the following formal parameters:
    <u><b>Parameters Passed by Reference</b></u>
    You list these parameters after USING or CHANGING without the VALUE addition:
    FORM <subr> USING ... <pi> [TYPE <t>|LIKE <f>] ...
    CHANGING ... <pi> [TYPE <t>|LIKE <f>] ...
    The formal parameter occupies no memory of its own. During a subroutine call, only the address of the actual parameter is transferred to the formal parameter. The subroutine works with the field from the calling program. If the value of the formal parameter changes, the contents of the actual parameter in the calling program also change.
    For calling by reference, USING and CHANGING are equivalent. For documentation purposes, you should use USING for input parameters which are not changed in the subroutine, and CHANGING for output parameters which are changed in the subroutine.
    To avoid the value of an actual parameter being changed automatically, you must pass it by value.
    <u><b>Input Parameters That Pass Values</b></u>
    You list these parameters after USING with the VALUE addition:
    FORM <subr> USING ... VALUE(<pi>) [TYPE <t>|LIKE <f>] ...
    The formal parameter occupies its own memory space. When you call the subroutine, the value of the actual parameter is passed to the formal parameter. If the value of the formal parameter changes, this has no effect on the actual parameter.
    <u><b>Output Parameters That Pass Values</b></u>
    You list these parameters after CHANGING with the VALUE addition:
    FORM <subr> CHANGING ... VALUE(<pi>) [TYPE <t>|LIKE <f>] ...
    The formal parameter occupies its own memory space. When you call the subroutine, the value of the actual parameter is passed to the formal parameter. If the subroutine concludes successfully, that is, when the ENDFORM statement occurs, or when the subroutine is terminated through a CHECK or EXIT statement, the current value of the formal parameter is copied into the actual parameter.
    If the subroutine terminates prematurely due to an error message, no value is passed. It only makes sense to terminate a subroutine through an error message in the PAI processing of a screen, that is, in a PAI module, in the AT SELECTION-SCREEN event, or after an interactive list event.
    <u><b>Specifying the Type of Formal Parameters</b></u>
    Formal parameters can have any valid ABAP data type. You can specify the type of a formal parameter, either generically or fully, using the TYPE or LIKE addition. If you specify a generic type, the type of the formal parameter is either partially specified or not specified at all. Any attributes that are not specified are inherited from the corresponding actual parameter when the subroutine is called. If you specify the type fully, all of the technical attributes of the formal parameter are defined with the subroutine definition.
    The following remarks about specifying the types of parameters also apply to the parameters of other procedures (function modules and methods). If you have specified the type of the formal parameters, the system checks that the
    corresponding actual parameters are compatible when the subroutine is called. For internal subroutines, the system checks this in the syntax check. For external subroutines, the check cannot occur until runtime. By specifying the type, you ensure that a subroutine always works with the correct data type. Generic formal parameters allow a large degree of freedom when you call subroutines, since you can pass data of any type. This restricts accordingly the options for processing data in the subroutine, since the operations must be valid for all data types. For example, assigning one data object to another may not even be possible for all data types. If you specify the types of subroutine parameters, you can perform a much wider range of operations, since only the data appropriate to those operations can be passed in the call. If you want to process structured data objects component by component in a subroutine, you must specify the type of the parameter.
    Regards,
    Bhaskar

  • Concept of Subroutine or Method in MXML?

    Hi. Does Flex MXML have the concept of a subroutine (like VB) or a method (like ActionScript)?
    Reason I ask is that I have some MXML code which will be duplicated (yecch!) unless I can refactor it into a subroutine of some sort.
    Ben Ethridge
    Senior Java Developer / Flex Newbie

    I have this coded and it compiles ok but returns an error in AS at runtime:
    TypeError: Error #1034: Type Coercion failed: cannot convert incl::IncludeEmulator@700a479 to mx.effects.Effect.
        at mx.effects::CompositeEffect/getChildrenTargets()[C:\autobuild\3.2.0\frameworks\projects\f ramework\src\mx\effects\CompositeEffect.as:400]
        at mx.effects::CompositeEffect/captureStartValues()[C:\autobuild\3.2.0\frameworks\projects\f ramework\src\mx\effects\CompositeEffect.as:294]
        at mx.core::UIComponent/commitCurrentState()[C:\autobuild\3.2.0\frameworks\projects\framewor k\src\mx\core\UIComponent.as:7163]
        at mx.core::UIComponent/setCurrentState()[C:\autobuild\3.2.0\frameworks\projects\framework\s rc\mx\core\UIComponent.as:7113]
        at mx.core::UIComponent/set currentState()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.a s:4361]
        at EastRidgeSoftware/__btnRestart_click()[C:\Users\Ben\workspace\EastRidgeSoftware\src\EastR idgeSoftware.mxml:267]
    Here is the associated code in the parent:
                <mx:Transition fromState="Designing" toState="Initial">
                    <mx:Sequence>
                        <!-- fadeout what is shown -->
                        <mx:Fade duration="{fadeDuration}" targets="{[designingImage,designingText,designingText1,designingText2]}" alphaFrom="1.0" alphaTo="0.0"/>
                        <mx:SetPropertyAction name="visible" targets="{[designingImage,designingText,designingText1,designingText2]}"/>
                        <inc:IncludeEmulator initialImage="{initialImage}" initialText="{initialText}" initialText1="{initialText1}" moveDuration="{moveDuration}"/>   
                    </mx:Sequence>
                </mx:Transition>
    ...and the child:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300">
    <mx:Script>
        <![CDATA[
            import mx.controls.Text;
            import mx.controls.Image;
            [Bindable]
            public var initialImage:Image;
            [Bindable]
            public var initialText:Text;
            [Bindable]
            public var initialText1:Text;
            public var moveDuration:Number;
        ]]>
    </mx:Script>
                            <!-- Fadein what should now be shown. -->
                        <mx:Fade duration="1" targets="{[initialImage,initialText,initialText1]}" alphaFrom="0.0" alphaTo="1.0"/>
                        <mx:SetPropertyAction name="visible" targets="{[initialText,initialText1,initialImage]}"/>
                        <!-- Move it across the screen into reading position. -->
                        <mx:Move duration="{moveDuration}" targets="{[initialText,initialText1,initialImage]}"/>
    </mx:Module>
    So it appears that a generic "Module" is not allowed, i.e. it wants a true "Component" one flavor or another.  Looking at the error above, my top guess is that AS cares about the component type, i.e. since it's running within a Transition, the only components allowed are Effects? Unfortunately, mx.effects.Effect is not in the list, i.e. not in <mx:> namespace.  I tried Canvas just for laughs, but same error, so I'm stuck.  Is there a way to inherit from Effect in MXML maybe?
    Ben

  • Sensor device for LV subroutine using CAN?

    The product of our project will be a LabView subroutine that would take in a list of messages and output the responses to those messages. A named cluster might be an appropriate format for the output. The subroutine should be generic in that once it is fed the appropriate message(s), it can query across the CAN to the appropriate sensor. We need this capability because many new sensors that we use for testing come only with CAN outputs rather than the traditional voltage outputs. These are relatively simple transducers that don't have extensive vocabularies. Six messages may be sufficient for each of these applications.
    CAN subroutine suggestions:
    -six message (word?) capability These messages can be fed in as inputs specific to the particular transducer the routine to be used.
    -named cluster output
    -should be able to run in a 20 hz main loop if possible
    **In order to proceed with this project, we need communication between the sensor and the bus, which is our main problem. When using MAX, we only get error transmission with a 100% bus load, does this means the sensor is actually working? Also, does anyone knows how to insert the sensor as a LV subroutine, once is communicating?
    Thank you!

    Ok, lets assume the device channel parameters are alright.
    By named cluster I mean, just that, a cluster with a name that if save as a subVI, when use in a VI it displays as a cluster within the main VI. But thats not a big issue.
    Today I finally created the subVI and is reading form the CAN device, now...how do I get it to writethe data is gathering into a file, preferably Excel? I am attaching what I have sor far, which works given a CAN device.
    "Could you also describe more what you mean by six message/word capability?"
    -The subroutine should be generic in that once it is fed the appropriate message(s), it can query across the CAN to the appropriate sensor. We need this capability because many new sensors that we use for testing come only with CAN outputs rather than the traditional voltage outputs. Some examples are the urea quality sensor that I've shown you, NH3 sensor, and NOx/O2 sensors all are CAN based. These are relatively simple transducers that don't have extensive vocabularies. Six messages may be sufficient for each of these applications, but this should be confirmed.
    Thank you.
    Attachments:
    uqs2.0temp.vi ‏63 KB

  • Subroutine & Function Module

    HI Experts,
                   Plz give me similarities & Diffrences between External Subroutine & Function Modules.
    thanks.
    Khan

    External Subroutines are better for documentational purposes. You can have all the subroutines related to the program into single include program.
    Another difference is that they are compiled with the program so they share the same memory, so there's no context change while calling a subroutine. It does save system time.
    Also, you can access all the global variables of the program in External subroutine but you can not access them in Function module unless they are passed as a parameter.
    Which one to use depends on the case you are dealing with.
    For example, if you are developing functionality to convert ouptut in PDF format then it is better to create a function module so that all the programs across all packages can use that functionality.
    if you are developing functionality which will be used by a defined set of programs(which are handling same kind of data) then it's better to use External subroutines, where you can defined common data in External subroutines program.
    In External subroutine perform statement is in one program and form routine is in another program.It is used for Reusability purpose.
    Check this Link,
    http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db999535c111d1829f0000e829fbfe/frameset.htm
    Here is the notes of differences bet. FM and Subroutines.
    Hi Function modules are for modularization urpose. You can the Function Module in any program. That is available all over in the SAP system.
    Where as subroutine is program specific. Once you create a subroutine in one program then you can use that in that program and related programs like includes in the program or you have to call the subroutine specifically using the main program name.
    Finally subroutines are for program modularization. Not for generic use.
    FM's are for generic use. Not program dependent.
    FMs are mainly used when a routine is to be performed by many programs.
    Subroutines (forms) are generally only executed within one program.
    You can perform routines from other programs, but it's not often done.
    both forms and FMs are reusable modularization units.
    To distinguish we generally say that forms are used for internal modularization and
    FMs are used for external modularization.
    To decide on which to implement, consider whether you need the content to be used just for a limited program
    or wheteher it can be called from many independent programs.
    For the first purpose it is better to implement a form whereas for the second we implement an FM.
    However, ABAP does not isolate the usage context.
    That is; you can call a form from another program within whose code the form is not actually implemented.
    However, this requires attention since the form may utilize global variables.
    The same issue holds for FMs.
    FMs are encapsulated in function groups and function groups may have global variables that can be globally
    used by all FMs inside it.

  • Problem with persistence in Generic Sync application

    Hi:
    We are developing an application which runson SAP Mi 2.5, SP 18,
    Windows Mobile 5.0 and Generic Sync for PDAs.
    We need persistence in our application. We tried with persistence API but
    we found a problem and we send a message to SAP. Until we can solve
    this issue we must implement persistence in other way to satisfy our customer requierements
    Since now,we have implemented persistence with files but the performance of this solution does not meet our customer requirements (the search of data in the PDA is very slow).
    We are thinking in another solution, which consists on using
    Syncbos.Using this alternative, before making a generic sync, and
    executing the code shown below:
    SmartSyncRuntime.getInstance().getSyncBoDescriptorFacade
    ().getAllSyncBoDescriptors()
    the returned syncBOS are those which I have defined in XML. On the
    contrary, after making a generic sync, executing the same code, the
    returned syncbos ARE NOT those whic I have defined in XML. The only
    return that I get is the MIAUTH.
    Any other ideas?
    Thanks
    Kind Regards

    hi satur,
    there are some things to take care if you want to use the persistence layer of the
    SmartSync layer from your GenericSync app.
    first, you have to let the MI client think that your application is using the
    SmartSync functionality. this can be achieved by just including a dummy metadata
    meRepMeta.xml file in the war archive during the deployment process. once the
    MI client framework sees this during the installation, it will set a flag on the MSD
    that your app is a smartsync.
    second, if your app is considered a smartsync, MI will generate the delta request
    and upload messages for your data if ever you have your SyncBo defined in the
    metadata. Since you don't want such functionalities to be ON, i would suggest to
    mark all your SyncBo as local ones; i.e. using attributes suppressDownload=true
    and suppressUpload=true. this way, the MI framework will skip creating the requests
    and delta upload messages for your app during the synchronization process.
    third, your application has to have the syncEventListener implementation to get
    notification when the Sync button (or event) was initiated. if you don't want your
    app to be notified, you may just add synchronization button within your application
    that will call your data manager to prepare your containers (i.e. retrieving the newly
    inserted syncbo, modified syncbos and the list of deleted ones -> genericSync
    containers) and to call the synchronizeWithBackend method.
    fourth, you need to have the inboundProcessor that will parse your data and insert
    them a SyncBo into your local database.
    having tried this but i guess it might work...
    regards
    jo

Maybe you are looking for