Update sap table using a function module call by php code

Hello,
I m trying to update the table VBAP using a function module ZZ_SET_DISTANCE  call by a php code.
But I have this problem:
the saprfc seems to work well but when I look to the table VBAP the fields have not been update.
I tried the function module in debug mode and it work good. The fields are update.
I also handle the saprfc call function and the return SAPRFC_OK
This are the function module ZZ_SET_DISTANCE, and the php code
//PHP CODE
$fce = saprfc_function_discover($sap,"ZZ_SET_DISTANCE");
              if (! $fce ) {echo "Echec d'ouverture du module fonction "; exit;}
               saprfc_import ($fce,"COMMANDE", '0000001998');
               saprfc_table_init($fce,"TBLE_CMDE");
                    $val=array();
                    $val['NUM_POST']='000030';
                    $val['HN_EXP']='';
                    $val['ST_EXP']='';
                    $val['PC_EXP']='';
                    $val['CI_EXP']='';
                    $val['CO_EXP']='';
                    $val['HN_REC']='';
                    $val['ST_REC']='';
                    $val['PC_REC']='';
                    $val['CI_REC']='';
                    $val['CO_REC']='';
                    $val['DIST']='popo';
                    saprfc_table_append ($fce,"TBLE_CMDE", $val);
             $rfc_rc = saprfc_call_and_receive ($fce);
             echo "\n".$rfc_rc;
             if ($rfc_rc != SAPRFC_OK) { if ($sap == SAPRFC_EXCEPTION ) echo ("Exception raised: ".saprfc_exception($fce)); else echo (saprfc_error($fce)); }else{echo '/execution de la function ;}
             saprfc_function_free($fce);
//FUNCTION MODULE ZZ_SET_DISTANCE
FUNCTION ZZ_SET_DISTANCE.
""Local Interface:
*"  IMPORTING
*"     VALUE(COMMANDE) TYPE  VBELN
*"  TABLES
*"      TBLE_CMDE STRUCTURE  ZADD_COM_LOXAN
DATA : NUMC TYPE VBELN.
NUMC = COMMANDE .
WHILE STRLEN( NUMC ) < 10 .
  CONCATENATE '0' NUMC INTO NUMC .
ENDWHILE .
DATA tble_addrcomm LIKE LINE OF TBLE_CMDE .
LOOP AT  TBLE_CMDE INTO  tble_addrcomm.
  DATA : NUMP TYPE POSNR.
  NUMP = tble_addrcomm-NUM_POST.
  WHILE STRLEN( NUMP ) < 6 .
  CONCATENATE '0' NUMP INTO NUMP .
  ENDWHILE .
  UPDATE VBAP SET ARKTX = tble_addrcomm-DIST
  WHERE VBELN EQ COMMANDE
  AND POSNR EQ NUMP.
ENDLOOP.
ENDFUNCTION.
Is anybody can help me?
thank.

Marie, create a Blog please, about more details for dummies....
1) how to connect to sap system?
2) you run the php code where? in a webserver or where?
3) wich is the url for run the FM: ZZ_SET_DISTANCE
4) you placed some dlls files on the web server?
please is interesting this...
Thanks

Similar Messages

  • Unalbe to delete lock entry table using Dequeue function module

    Friends,
    I display a base ALV list with custom app. tool bar. When i click on a button, i submit another report which updates a z-table for that corresponding row. I create a lock object for this entry before submitting the report. After updating the table, I try to delete the lock object using dequeue function module in the called report, but though the subrc is 0, the lock entry is not getting deleted in SM12. The called report, after dequeue, again submits report 1 (the caller). So, when i try to do some operation for the same row which I first selected, it triggers Foreign_lock exception. When I completely go out of the base list, only then the entry is deleted. Can anyone tell me the reason? I have tried with parameters _SCOPE & _SYNCHRON, but same result.
    Regards,
    Sathish R

    Hi,
    The triggering of the dequeue is not in the proper position as it need to be placed.
    Thats the only problem as per u have described the issue.
    Place the deque as soon as the report is return the value.
    I hope it may work ur issue.

  • Updating SAP  Table using JCO

    Dear All
                      How to update SAP Table (Any single or multiple tables) through Java code using JCO. Can any body provide sample code regarding this...
    Thanks&Regards
    mgreddy

    Hi,
    I think for that anyway you will have to use JCO as the middleware to connect to SAP R/3.
    So what you can to do is to write three RFCs and call them through JCO from your JAVA application.
    1. First BAPI for reading the dictionary information about an SAP table.
    2. Second to read data from the table.
    3. And, third to write data to that table.
    But if you want to edit any table (and not a specific table) then your program will become even more complex since then you will have to pass the table name and information dynamically to the BAPIs.
    Best regards,
    Guru.

  • Table used in function module

    Hi,
    As I am programming ABAP for the first time I have a question which I think is pretty basic.
    I have created a function module Z_POPUP_GET_VALUES which calls the function POPUP_GET_VALUES. I got some sample code from another forum post and it defines a table name and fieldname. But I am not sure what this table is suppose to be (or do)? Is it an ABAP dictionary table? If so, how do I create one based on the characteristic I want to display??
    The implemented code is as follows:
    DATA: i_sval Like sval occurs 1 with Header Line.
    data: v_subrc like sy-subrc.
    i_sval-tabname =
    i_sval-fieldname = '?????'.i_sval-fieldtext = 'Eiendelsområde'.
    i_sval-field_obl = 'X'.
    append i_sval.
    CALL FUNCTION 'POPUP_GET_VALUES'
    EXPORTING
    NO_VALUE_CHECK = ' '
    POPUP_TITLE = 'Asset Area'
    START_COLUMN = '5'
    START_ROW = '5'
    IMPORTING
    RETURNCODE = v_subrc
    TABLES
    FIELDS = i_sval
    EXCEPTIONS
    ERROR_IN_FIELDS = 1
    OTHERS = 2.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    All help appreciated!
    Best regards,
    TM

    Hi,
    Tables in function modules are parameter to that function module.
    That can be processed when the function module code is called.
       and the result can be stored in the tables.
    Tables have a structure like ABAP Dictionary structure .ie. You will be
    define the table type as a dictionary table.
    Regards,
    <b>Ramganesan K</b>

  • How to Update  crmd_customer_h TABLE Using CRMV_EVENT Through Funtion Module

    Hi
    How we can update customer_h table using the CRMV_EVENT Where i implemented logic below in the Funtion Module.
    data:     lt_doc_flow          TYPE crmt_doc_flow_wrkt,
              lw_cust_h_com        TYPE crmt_customer_h_com,
              lw_input_field_names TYPE crmt_input_field_names,
              lt_input_field_names TYPE crmt_input_field_names_tab,
              lt_objects_to_save TYPE crmt_object_guid_tab,
              lw_guid TYPE CRMT_OBJECT_GUID.
    DATA : lv_process_type TYPE crmt_process_type.
    data: wa_doc_flow type CRMT_DOC_FLOW_WRK.
    data: wa_customer_h type crmd_customer_h.
    *  Function module for retriving the Process type.
      CALL FUNCTION 'CRM_ORDERADM_H_READ_OW'
        EXPORTING
          iv_orderadm_h_guid     = iv_header_guid
        IMPORTING
          ev_process_type        = lv_process_type
        EXCEPTIONS
          admin_header_not_found = 1
          OTHERS                 = 2.
    if lv_process_type eq 'ZG01'.
    CALL FUNCTION 'CRM_DOC_FLOW_READ_OB'
    EXPORTING
       IV_HEADER_GUID                 = iv_header_guid
    IMPORTING
       ET_DOC_FLOW_WRK                = lt_doc_flow.
    read table lt_doc_flow with key objtype_a = 'BUS2000116' INTO wa_doc_flow. "gc_object_type-service.
                if sy-subrc eq 0.                    "set flag for service order
                lw_cust_h_com-ref_guid       =  wa_doc_flow-objkey_a.
                lw_cust_h_com-ZZTRAIL_FLAG   = 'X'.
                 lw_cust_h_com-mode           = 'A'.
                lw_cust_h_com-ref_handle     = '0000000001'.
                lw_guid = wa_doc_flow-objkey_a.
                INSERT lw_guid INTO TABLE lt_objects_to_save.
         endif.
                  lw_input_field_names-fieldname = 'REF_GUID'.
                lw_input_field_names-fieldname = 'ZZTRAIL_FLAG'.
              lw_input_field_names-changeable = ' '.
               INSERT lw_input_field_names INTO TABLE lt_input_field_names.
    Maintain Customer H
             CALL FUNCTION 'CRM_CUSTOMER_H_MAINTAIN_OW'
                  EXPORTING
                    is_customer_h_com    = lw_cust_h_com
                  CHANGING
                    ct_input_field_names = lt_input_field_names
                  EXCEPTIONS
                    header_change_error  = 1
                    header_create_error  = 2
                   error_occurred       = 3.
    ENDIF.
    *endif.
    *Clearing local variables
      clear: lv_process_type,
             lw_cust_h_com,
             lw_input_field_names.
    *Free internal tables
      free: lt_doc_flow,
            lt_input_field_names.

    Hi Faisal
    I think your not clear with what i am saying anyhow i will again explain you my requirement
    As per my requirement
    1)in the service order search report i need to add a field called "Has trail order with No Follow up" with values "Yes" & "Blank"
    For above Field i added  using the structure CRMST_QUERY_SRVO_BTIL and through configuration i am able to display the field in webui as per (Attachement Pic 1)
    2)When i  search with search criteria as  "Has trail order with No Follow up" with  "Yes"
    Then in result list i need to show the service order those having follow up as trail orders(sales order) only.if for  next document trail order  having any follow up then those service orders dont want to show in result list.
    For above requirement i implemented F.M using CRMV_EVENT & I configured for BUS2000115 And BEFORE_SAVE The Order
    The FM Will get trigger when i save the service order and for that service order if create any follow up and try to save the trail order then This FM Will trigger and in this i am doing validations.
    3)Add one AET Trail Flag field is added under CUSTOMER_H Table.
    4)in the FM I am validating for if the trail order having the preceding document as service order then i need to make flag as "X" For that service order in customer_h
    if suppose when i delete trail order from the service order then that flag must need to be "unset" from the CUSTOMER_H.
    Why bcoz we are doing above process is do show records in result list based on Flag values
    these flag checks are validating in the BADI Which we implemented for search logic.
    Please refer below Login for my requirement:-
    Proposal to have a custom “flag” field (background at table level,
         crmd_customer_h) linked to service order which gets flagged whenever at
         least one Trial order is created and saved from the Service Order.
    The flag value should be cleared when all the trial orders created and
    saved as follow up transactions are deleted from the system.
    Similarly for Trial Orders will use the same custom “flag” field
         which gets activated when at least one follow up is created and saved from Trial Order.
    The flag value should be cleared when all the follow up transactions from
    the Trial Order are deleted from the system.
    When the above search criteria “Has Trial order with no follow up”
         “is” “Yes” is applied then the logic derives all the service
         orders which satisfy additional search criteria applied in the search and
         for these Service orders checks if the custom flag field is checked to
         derive all Service orders which have Trial order. The custom flag values
         values are derived from crmd_customer_h table in CRM.
    4 )Further for all the Trial Orders determined in Step 3
    check if the Trial Order has a follow up by checking if the custom flag field
    is checked. The custom flag values are derived from crmd_customer_h table in
    CRM.
    5) If step 4 is not met populate the preceding Service
    Orders in the Result list

  • Updation of material data using a function module

    HI
      i want to update fields in the mvke table,but the field is a Customer field in the table, not sap table field.i want to update the field using a program , not going to mm02. which function can i use for the updation.There is a function module MATERIAL_MAINTAIN_DARK for updation,will this funtion module update the customer fields also. Can anyone tell me about this function module and how to use this function module or MATERIAL_MAINTAIN_DARK.

    Using the function Module BAPI_MATERIAL_SAVEDATA , you can also update the custom fields.
    This is the documentation for the extension fields:
    <b>Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIO
    Description
        You use this structure to transfer the material's customer-defined
        fields. For information on transferring these fields, see the function
        module documentation.
    Note
        Besides the table fields already defined, customer-defined table fields
        can also be supplied with data. Since these fields are created by the
        customer, they are known only during the runtime and must therefore be
        determined dynamically.
        The structures BAPI_TE_<NAME> (<NAME> = MARA, MARC, MARD, MBEW, MLGN,
        MLGT, MVKE) and the relevant checkbox structures BAPI_TE_<NAME> (<NAME>
        = MARAX, etc.) must first be extended by the customer to include the
        fields required. The standard structures contain only the corresponding
        key fields. When including new fields in these structures, make sure
        that the field has the same name as the field in the database table. In
        addition, the fields in the structures BAPI_TE_<NAME> may only be of the
        type CHARACTER. The data element BAPIUPDATE must be used for the fields
        in the checkbox structure (except for key fields).
        The two parameters EXTENSIONIN and EXTENSIONINX are used to transfer the
        data to the method. The field STRUCTURE contains the name of the
        structure (for example, BAPI_TE_MARA or BAPI_TE_MARAX) used to identify
        the work area (for example, WA_BAPI_TE_MARA or WA_BAPI_TE_MARAX) to
        which the data is transferred. The remaining fields for the parameter
        EXTENSIONIN or EXTENSIONINX contain the data for the key fields (for
        example, the material number) and the data for the customer-defined
        fields. The number of characters reserved in the two parameters for the
        content of a customer-defined field must be the same as the number of
        characters for the corresponding work area field. If the number of
    characters required is smaller, the remaining characters in the two
    parameters must be filled with blanks. Only then may the content of
    another field be transferred. Here too, remember that the data is
    written to the database only if the corresponding indicator has been set
    in the work area.</b>
    Regards,
    ravi

  • Null character removal in sap using a function module

    Little background :
    1) we are using a lot of interfaces with legacy and the data in sap has null characters for example : phone#123 .
    the prob is not on sap side but on bw side when i extract this data it converts to hex format and the load fails.
    2) so i wrote a abap function module for the extractor which uses the function modules SRET_TEXT_TO_BINARY and SRET_BINARY_TO_TEXT and passed the variable that has the null character and replaced it with space.
    3) the prob is i get null characters in a lot of fields now and i am not sure how i can pass it to SRET_BINARY_TO_TEXT OR SRET_TEXT_TO_BINARY as they are SAP standard and it takes in just a single variable. i have all my fields in a internal table .
    I apologize for the the length of the message but any help is greatly appreciated.I want to know how to pass a internal table with null in all fields to a standard function module bec . The code is below :
    =======================================================
      CALL FUNCTION 'SRET_TEXT_TO_BINARY'
        EXPORTING
          TEXT                        = input
        TEXT_LENGTH                 = -1
          LAISO                       = '00'
        IV_CATID                    = ' '
        IV_RFC_FOR_INITIALIZE       = ' '
       IMPORTING
        OUTPUT_LENGTH               =
          XBUFFER                     = v_hexa
       EXCEPTIONS
          FAILED                      = 1
          OTHERS                      = 2
      IF SY-SUBRC = 0.
    *Replacing all NULL (X'00') values with SPACE (X'20')
      REPLACE ALL OCCURRENCES OF c_null IN v_hexa WITH c_space IN BYTE MODE.
        CALL FUNCTION 'SRET_BINARY_TO_TEXT'
          EXPORTING
            XBUFFER                     = v_hexa
            LAISO                       = '00'
          IV_CATID                    = ' '
          IV_RFC_FOR_INITIALIZE       = ' '
         IMPORTING
          OUTPUT_LENGTH               =
            TEXTBUFFER                  = output
         EXCEPTIONS
            FAILED                      = 1
            OTHERS                      = 2

    The entire code :
    =======================================================
    FUNCTION YFR1_CA_U_NULL_SPACE.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(INPUT) TYPE  C
    *"  EXPORTING
    *"     REFERENCE(OUTPUT) TYPE  C
    *"  EXCEPTIONS
    *"      LENGTH_TOO_LONG
    *"      FAILED
    This function provides the functionality of replacing the NULL
    characters with SPACE .
      DATA : v_hexa(100) TYPE X ,
             c_space(2) TYPE X VALUE '0020' ,
             c_null(2) TYPE X VALUE '0000' ,
             v_length TYPE i .
      COMPUTE v_length = STRLEN( input ) .
      IF v_length > '100'.
        RAISE length_too_long .
      ENDIF .
      CALL FUNCTION 'SRET_TEXT_TO_BINARY'
        EXPORTING
          TEXT                        = input
        TEXT_LENGTH                 = -1
          LAISO                       = '00'
        IV_CATID                    = ' '
        IV_RFC_FOR_INITIALIZE       = ' '
       IMPORTING
        OUTPUT_LENGTH               =
          XBUFFER                     = v_hexa
       EXCEPTIONS
          FAILED                      = 1
          OTHERS                      = 2
      IF SY-SUBRC = 0.
    *Replacing all NULL (X'00') values with SPACE (X'20')
      REPLACE ALL OCCURRENCES OF c_null IN v_hexa WITH c_space IN BYTE MODE.
        CALL FUNCTION 'SRET_BINARY_TO_TEXT'
          EXPORTING
            XBUFFER                     = v_hexa
            LAISO                       = '00'
          IV_CATID                    = ' '
          IV_RFC_FOR_INITIALIZE       = ' '
         IMPORTING
          OUTPUT_LENGTH               =
            TEXTBUFFER                  = output
         EXCEPTIONS
            FAILED                      = 1
            OTHERS                      = 2
        IF SY-SUBRC <> 0.
          RAISE FAILED .
        ENDIF.
      ELSE.
        RAISE FAILED .
      ENDIF .
    ENDFUNCTION.

  • Raise exception in function module call from SAP owned program

    I need to raise an exception in a function module to terminate a transaction, display a error message and return to to previous selection screen so the user can fix the error before moving forward.......  
    How do you do this when the program using the function module is SAP owned?
    Thank You!
    Jeff

    Hi,
    After calling the function module, you can do something like this.
    IF SY-SUBRC <> 0.
      RAISE EXCEPTION.
    ENDIF.
    Regards,
    Ferry Lianto

  • Calling a Z-Report using a Function Module.

    Hi All,
    Kindly provide me help in: 
    How to call a Z-Report which generates a flat file in the Application server. And which I want to call using a Function Module and display all the fields which are generated in the file.
    Steps I've already done:
    1) I've created a Function Module
    2) Created a structure which I've used in the Tables tab of the FM
    3) Used:
       SUBMIT ZSCOMAR
                    VIA SELECTION-SCREEN
                    USING SELECTION-SET 'Variant'
                   AND RETURN.
    Output whichI'm receiving:
    Only the no. of rows is shown but not the fields individually.
    Thanks in Advance.
    Regards,
    Sreedhar.

    you can either :
    display the data from the ZPROGRAM(by editing it)
    or
    by reading the file again in you FM using open dataset, read dataset, close dataset. and display the content

  • BOM Update using a function module - 'CSAP_MAT_BOM_MAINTAIN'

    Hi,
    I have problem in updating the item status for a BOM using a function module - 'CSAP_MAT_BOM_MAINTAIN'.
    My goal is reset the Checkbox for 'Indicator: item relevant to production'. When i pass the value ' '[Space] to the structure field 'T_STPO-REL_PROD' it doen't work.
    Do let me know if you come across such problem & what needs to passed as input to reste the checkbox in the BOM.
    Thanks & Regards,
    Bhargava

    PLM wants to manipulate the Indicators u2013 u201CBulk Materialu201D & u201CCost Relevancyu201D in BOM.
    Note: The 2 indicators [u201CBulk Materialu201D & u201CCost Relevancyu201D] are interlinked with each other for a business functionlity given by SAP. So, if we try to set both indicators we get the below SAP standard error.
    E 29127 Bulk material not allowed for items relevant to costing
    SAP Field Name                             RFC Tag       SAP values    PLM values  Meaning for SAP field
    Indicator: bulk material                   BULK_MAT   Space             !                   No
    Indicator: bulk material                   BULK_MAT    X                   X                  Yes
    Indicator: item relevant to costing  REL_COST    Space            !                    Not relevant to costing
    Indicator: item relevant to costing  REL_COST     1                   1                   Not relevant to costing
    Indicator: item relevant to costing  REL_COST     2                   2                   Packaging operation
    Indicator: item relevant to costing  REL_COST     3                   3                   Packaging material
    Indicator: item relevant to costing  REL_COST     X                   X                  Relevant to costing
    To achieve the clear/reset/set value for 2 indicators [u201CBulk Materialu201D & u201CCost Relevancyu201D] from PLM, only eitheir of indicators status needs to sent [i.e 1 indicator status @ a time].

  • Using Standard SAP Tables in SAP Tables, clusters or functions connections

    Hi Gurus,
    I am trying to use Standard SAP table like MARA, MAKT.. etc. in my crystal designer. When i make a new connection using SAP tables, Cluster or Functions, these tables are not listed.
    Any configuration i have to maintain to list those standard table.?
    With Regards,
    Balachander.S

    Due to performance reasons there is  a limitation regarding the number of the dispplayed table names. Once you are in the connection/table browser select a table and invoke the context menu by pressing the right mouse button. Select Options and in the options panel you can use wildcards in order to limit the results to the desired range (eg. use MA% to get a list of tables starting with MA). After you close the options panel press F5 and expand the connection entry again.
    Regards,
    Stratos

  • Issue with use of Function Module GUI_UPLOAD

    Hi Experts,
    I have an issue in using the Function Module GUI_UPLOAD for uploading the contents of an Excel file on the Presentation Server to an internal table in an ABAP Program.
    My file consists of around 300 records but the FM succeeds in uploading only the first 6 lines to the Internal Table specified while calling the FM.
    I dont have any idea why this happens. Any pointers in this direction will be helpful.
    Thanks in advance.
    Regards,
    Keerthi

    Hi,
    Kindly go through this link below:
    https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=60655105
    Hope it helps you
    Regards
    Mansi

  • Function Module Call CONVERT_OTF_AND_FAX

    Hi,
    Could someone please explain how to use this FM, it is unable to generate a fax for me and I always get a conversion error in SOST, following is the code. I have searched this forum and internet and usage in standard SAP includes but still could not find a good example for this function module with all the parameters explained.
    So far I was able to get till this point, please let me know if I am missing anything -
    REPORT y_bcs_example_6.
    DATA:it_otf LIKE soli OCCURS 0 WITH HEADER LINE.
    DATA: la_fax  TYPE itcpp,
          l_faxok,
          lt_otf  TYPE TABLE OF itcoo.
    la_fax-tddevice = 'TELEFAX'.
    la_fax-tdgetotf = 'X'.
    la_fax-tdcover  = space.
    la_fax-tdimmed  = 'X'.
    la_fax-tdteleland = 'US'.
    la_fax-tdtelenum  = 'XXX-XXX-XXXX'.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
      EXPORTING
        rqident              = '81228'
        desired_type         = 'OTF'
      TABLES
        buffer               = it_otf
      EXCEPTIONS
        no_such_job          = 1
        job_contains_no_data = 2
        selection_empty      = 3
        no_permission        = 4
        can_not_access       = 5
        read_error           = 6
        type_no_match        = 7
        OTHERS               = 8.
    CALL FUNCTION 'CONVERT_OTF_AND_FAX'
      EXPORTING
        faxoptions         = la_fax
        user               = sy-uname
    IMPORTING
       fax_ok             = l_faxok
    *   OFFICE_OBJID       =
    *   MSGID              =
    *   MSGNO              =
    *   MSGV1              =
    *   MSGV2              =
    *   MSGV3              =
    *   MSGV4              =
      TABLES
        otf                =  it_otf
    COMMIT WORK.

    I have found that I cannot publish a spool to any printer and expect CONVERT_OTFAND_FAX to do the OTF conversion and fax. Only some specific printers can be used for FAX ( I am still a bit fuzzy on how this works), I used LP01 to generate the spool and then used the function module CONVERT_OTF_AND_FAX to generate the output.
    The following code worked -
    DATA: it_otf LIKE soli OCCURS 0,
          la_fax  TYPE itcpp,
          l_faxok.
    la_fax-tddevice = 'TELEFAX'.
    la_fax-tddest   = 'LP01'.
    la_fax-tdcopies = 1.
    la_fax-tdgetotf = ''.
    la_fax-tdcover  = space.
    la_fax-tdimmed  = 'X'.
    la_fax-tddelete = 'X'.
    la_fax-tdteleland = 'US'.
    la_fax-tdtelenum  = 'XXX-XXX-XXXX'.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
      EXPORTING
        rqident              = XXXX
        desired_type         = 'OTF'
      TABLES
        buffer               = it_otf
      EXCEPTIONS
        no_such_job          = 1
        job_contains_no_data = 2
        selection_empty      = 3
        no_permission        = 4
        can_not_access       = 5
        read_error           = 6
        type_no_match        = 7
        OTHERS               = 8.
    CALL FUNCTION 'CONVERT_OTF_AND_FAX'
      EXPORTING
        faxoptions         = la_fax
        user               = sy-uname
    IMPORTING
       fax_ok             = l_faxok
      TABLES
        otf                =  it_otf
    COMMIT WORK.

  • How to Use ECC function Module

    Hi Experts - We need to execute the function module in ECC and need to write data in Oracle table.
    We are using BODS 4.0.
    How to use function module in data flow ? how it can work as a source ?
    I just need some basic steps how to use function module as a source and do the transformation to target.
    Thanks
    R

    Hi Ashwani,
    It is still not possible to use a FM as a source in DS.
    You can use a FM in a transformation but you have to start from a file or table as a source and load into a target (a FM can not be an end point of a dataflow - as it is used in the transformation and each transformation requires a source and a target.
    The scenario I described above was based on a situation where you have a source (flat file or table) and want to use a Function Module to transform your data and/or load the data in a transparant table in SAP.
    Your scenario is different, as your source is not a table/ff but a FM.
    In your case, I can see two scerio's:
    - Use an ABAP dataflow. Although I haven't got any experience with this I do believe this would be an option for your scenario. Please referer to the Data Services documentation on ABAP dataflows for further guidance.
    - As suggested earlier, you can create a bespoke (BW) Datasource based on a Function Module. Please refer to SAP help for creating a generic datasource:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
    Depending on your scenario there might be a third option:
    - Use a SAP transparant table as a source. Create a transformation into the designated Oracle table. In the transformation call a FM which executes whatever logic you require. This solution will work if you have a table which produces the same number of records as your FM. If your function module produces more or less records (than there are in the transparant table), then this might become a bit tricky. It might work, but I have never tried it.
    Instead of a transparant table you can also use a table join, obviously. Perhaps part of the complexity of your FM could be resolved by using a join and you can create a new simpler FM for the remaining logic?
    Good luck,
    Jan.

  • How to use the function module ....

    hi
    how to use the function module ssf_function_module_name in smartforms

    Hi..
    If you are using this Function module, you can get the generated function module name of smartform dynamically. It is good progrmaming practice to get the fucntion module name dynamically because there might be some problems if you are hard coding in program.
    This will return the name of the function module and then from the exporting parameters you can use the fucntion module name to pass parameters to Smartforms.
    Check this link.I am expalining here how to use this function module.
    https://wiki.sdn.sap.com/wiki/pages/pointstab/viewpageversion.action?pageId=36109&version=2
    Calling SMARTFORMS from your ABAP program
    REPORT ZSMARTFORM.
    Calling SMARTFORMS from your ABAP program.
    Collecting all the table data in your program, and pass once to SMARTFORMS
    SMARTFORMS
    Declare your table type in :-
    Global Settings -> Form Interface
    Global Definintions -> Global Data
    Main Window -> Table -> DATA
    Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
    http://sapr3.tripod.com
    TABLES: MKPF.
    DATA: FM_NAME TYPE RS38L_FNAM.
    DATA: BEGIN OF INT_MKPF OCCURS 0.
    INCLUDE STRUCTURE MKPF.
    DATA: END OF INT_MKPF.
    SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
    SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
    MOVE-CORRESPONDING MKPF TO INT_MKPF.
    APPEND INT_MKPF.
    ENDSELECT.
    At the end of your program.
    Passing data to SMARTFORMS
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = 'ZSMARTFORM'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    FM_NAME = FM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    if sy-subrc <> 0.
    WRITE: / 'ERROR 1'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function FM_NAME
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    CONTROL_PARAMETERS =
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    TABLES
    GS_MKPF = INT_MKPF
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5.
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    <b>Reward points if useful</b>
    Regards
    Ashu

Maybe you are looking for