Function Module to Insert Source Code through RFC

Hi,
I have a Requirement to Insert the Source code to Remote System. I know it is possible in local system with syntax 'INSERT REPORT' . But I want to insert source to Remote system . Is there any Function Module through which I can Insert Source through RFC ?
Regards,
Sachin

Maen Anachronos wrote:
Despite Mat's warning you still want to proceed?
There's no teaching some people. If the client wants there system wide open to abuse, that's up to them. What will they do if someone uses the function module to send a program that does something like this?
DELETE t000 WHERE mandt NE space
So, here's some more rope, and further demonstration of the huge risk.
You want to create a program dynamically, with a name of your choosing. Simple, send the FM the source code of a program that generates the program you want, with the fixed name. I suggest SAPMSYST as a really good one to play with.

Similar Messages

  • RFC enabled function module for insert update and delete in a Ztable..

    friends..
    Is there any standatd RFC enabled function module to insert , update and delete data in a custom database-table (Ztable)? if not how can we create it? plz give me the details steps..
    what are the import, export parameters and how to develop and process it.. (for example: suppose fields in the table is Emp_Id, Name, Address)
    Thanks and Regards

    Hi,
    Try this code.
    REPORT ZMMC071Z_RMV.
    TYPE-POOLS : ABAP.
    FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE,
                   <DYN_WA>,
                   <DYN_FIELD>,
                   <LV_CONDI>.
    DATA: DY_TABLE TYPE REF TO DATA,
    DY_LINE TYPE REF TO DATA,
    XFC TYPE LVC_S_FCAT,
    IFC TYPE LVC_T_FCAT.
    SELECTION-SCREEN BEGIN OF BLOCK F1 WITH FRAME TITLE TEXT-001.
    PARAMETERS: P_TABLE  LIKE DD02L-TABNAME OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK F1.
    Evento: At Selection Screen                                          *
    START-OF-SELECTION.
      PERFORM GET_STRUCTURE.
      PERFORM CREATE_DYNAMIC_ITAB.
      PERFORM GET_DATA.
    END-OF-SELECTION.
    *& Form get_structure
    text
    FORM GET_STRUCTURE.
      DATA : IDETAILS TYPE ABAP_COMPDESCR_TAB,
      XDETAILS TYPE ABAP_COMPDESCR.
      DATA : REF_TABLE_DES TYPE REF TO CL_ABAP_STRUCTDESCR.
      DATA VL_LENGHT(30).
    Get the structure of the table.
      REF_TABLE_DES ?=
      CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( P_TABLE ).
      IDETAILS[] = REF_TABLE_DES->COMPONENTS[].
      LOOP AT IDETAILS INTO XDETAILS.
        CLEAR XFC.
        XFC-FIELDNAME = XDETAILS-NAME .
        XFC-DATATYPE = XDETAILS-TYPE_KIND.
        XFC-INTTYPE = XDETAILS-TYPE_KIND.
        XFC-INTLEN = XDETAILS-LENGTH.
        XFC-DECIMALS = XDETAILS-DECIMALS.
        APPEND XFC TO IFC.
      ENDLOOP.
    ENDFORM. "get_structure
    *& Form create_dynamic_itab
    text
    FORM CREATE_DYNAMIC_ITAB.
    Create dynamic internal table and assign to FS
      CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = IFC
        IMPORTING
          EP_TABLE        = DY_TABLE.
      ASSIGN DY_TABLE->* TO <DYN_TABLE>.
    Create dynamic work area and assign to FS
      CREATE DATA DY_LINE LIKE LINE OF <DYN_TABLE>.
      ASSIGN DY_LINE->* TO <DYN_WA>.
    ENDFORM. "create_dynamic_itab
    *&      Form  get_data
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DATA .
    *Get data from p_table into internal table <DYN_TABLE>
      SELECT * INTO TABLE <DYN_TABLE>
          FROM (P_TABLE)
    Here you can implemente function DELETE, INSERT.
    ENDFORM.                    " De_para

  • RFC enabled function module to insert , update and delete data in a ZTABLE

    friends..
    Is there any standatd RFC enabled function module to insert , update and delete data in a custom database-table (Ztable)?
    if not how can we create it? plz give me the details steps..
    what are the import, export parameters and how to code and process it.. (for example: suppose fields in the table is Emp_Id, Name, Address. I need to develop a RFM which does the 3 tasks, insert update delete in the same RFM)
    Thanks and Regards

    create a f.n mod in se37 and make it rfc enabled.  ur import parameters are Emp_Id, Name, Address and TASK and u can have an export parameter like result which gives the status of the update. based on task u can insert using keyword INSERT....and update using UPDATE or MODIFY and delete using DELETE. these keyword are not compelte with syntax but need to refer the SAP documentation.

  • Function Module to Insert Agent assignment upon creation of Responsibility

    Hi Friends,
    Using BDC I am able to create Resposibilities in Responsibilities tab of PFAC tcode.
    I need to insert Agent assignment under created Responsibility.
    Actually In Tcode PFAC I enter Rule then select change button this will lead us to next screen there i select Responsibilities tab
    there I select create button then it will give a pop-up in that i will enter Object abbr. and Name then i will select continue.
    then next i will enter category then select save.
    Up to this using recording I am able to create Responsibilities but here i need to come back and i need to select just now created
    Responsibility and i need to select insert agent assignment icon then it will give popup there i need to select Orgnizational unit then continue then it will give small popup ther i need to give search term (what ever we entered in Object abbr.) then continue again one popup will come ther we need to select that Org.unit check box then continue then it will one more popup there i need to select create then it will be inserted under Responsibilitty.
    In the above entire explanation I am able do upto  create Responsibilities but to insert agent assignment we need to come back after save but it is not possible through Recording because after save Recording will be ended.
    So could you please guid me how to insert agent assignment under just created Responsibility.
    If there is any function module to do that please suggest me .
    Thanks
    Chandu

    Hi,
    I tried like that also.
    Whenever we need to insert agent assignment under just created Responsibility we need to select just created responsibility
    created by first BDC . But in seccond BDC WITH TCODE OOCU_RESP Recording is not capturing that action (selecting just created Responsibility).
    It is giving the message 'You did not select a valid object' in the status bar.
    So It is unable to insert agent assignment under responsibility.
    I think there would a function module which insert agent assignment under selected responsibility.
    If anybody knows please suggest me or am I making any mistake ?
    If you would like to see my code pls find below.
    *& Report  YCRM_CREATE_REPBLT_AGENT
    REPORT  ycrm_create_repblt_agent.
    *Selection Screen
    PARAMETERS : p_rule TYPE pdtask-seark OBLIGATORY,
                 p_file TYPE rlgrap-filename OBLIGATORY.
    *Data Declarations
    TYPES : BEGIN OF ty_resp,
            short    TYPE p1000-short,
            stext    TYPE p1000-stext,
            category TYPE ro_expr, "EDIT_BIND_DEF-EXPR_LOW(02),
            END OF ty_resp.
    DATA : it_resp TYPE TABLE OF ty_resp,
           wa_resp TYPE ty_resp,
           p_file1 TYPE string.
    DATA : it_bdcdata    TYPE TABLE OF bdcdata,
           wa_bdcdata    TYPE bdcdata,
           it_bdcmsgcoll TYPE TABLE OF bdcmsgcoll,
           wa_bdcmsgcoll TYPE bdcmsgcoll.
    *Constants Declarations
    CONSTANTS : c_x        TYPE c VALUE 'X',
                c_tcode(4) TYPE c VALUE 'PFAC',
                c_mode     TYPE c VALUE 'A'.
    *AT SELECTION-SCREEN event for providing f4 help for input file
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      PERFORM file_on_f4.
    *Start of selectin event.
    START-OF-SELECTION.
    File Upload
      PERFORM upload_file.
    *BDC Logic
      PERFORM bdc_to_create_rep.
    *&      Form  BDC_DYNPRO
          text
         -->P_0061   text
         -->P_0062   text
    FORM bdc_dynpro  USING    fp_program "value(p_0061)
                              fp_dynpro. "value(p_0062).
      CLEAR wa_bdcdata.
      wa_bdcdata-program  = fp_program.
      wa_bdcdata-dynpro   = fp_dynpro.
      wa_bdcdata-dynbegin = c_x.
      APPEND wa_bdcdata TO it_bdcdata.
    ENDFORM.                    " BDC_DYNPRO
    *&      Form  BDC_FIELD
          text
         -->P_0066   text
         -->P_0067   text
    FORM bdc_field  USING    fp_fnam "value(p_0066)
                             fp_fval. "value(p_0067).
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam  = fp_fnam.
      wa_bdcdata-fval  = fp_fval.
    *WA_BDCDATA-DYNBEGIN = C_X.
      APPEND wa_bdcdata TO it_bdcdata.
    ENDFORM.                    " BDC_FIELD
    *&      Form  FILE_ON_F4
          text
    -->  p1        text
    <--  p2        text
    FORM file_on_f4 .
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          field_name    = 'P_FILE'
        CHANGING
          file_name     = p_file
        EXCEPTIONS
          mask_too_long = 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.
    ENDFORM.                    " FILE_ON_F4
    *&      Form  UPLOAD_FILE
          text
    -->  p1        text
    <--  p2        text
    FORM upload_file .
      p_file1 = p_file.
      CALL METHOD cl_gui_frontend_services=>gui_upload
        EXPORTING
          filename                = p_file1
          has_field_separator     = 'X'
        CHANGING
          data_tab                = it_resp
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          not_supported_by_gui    = 17
          error_no_gui            = 18
          OTHERS                  = 19.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " UPLOAD_FILE
    *&      Form  BDC_TO_CREATE_REP
          text
    -->  p1        text
    <--  p2        text
    FORM bdc_to_create_rep .
      LOOP AT it_resp INTO wa_resp.
        REFRESH : it_bdcdata,
                  it_bdcmsgcoll.
    *Screen 0600
        PERFORM bdc_dynpro      USING 'SAPLRHWS' '0600'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'PDTASK-SEARK'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=AEND'.
        PERFORM bdc_field       USING 'PDTASK-SEARK'
                                       p_rule. "'90000159'.
    *Screen 0040
        PERFORM bdc_dynpro      USING 'SAPLRHWS' '0040'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=RESP'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'HRS1000-SHORT'.
        PERFORM bdc_field       USING 'HRS1000-SHORT'
                                      'Z99999999972'.
        PERFORM bdc_field       USING 'HRS1000-STEXT'
                                      'Category (RUN -SUPPORT) + C&PS Web'.
        PERFORM bdc_field       USING 'HRS1203-ACTOR_FLAG'
                                      'R'.
    *Screen 0040
        PERFORM bdc_dynpro      USING 'SAPLRHWS' '0040'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=INSE'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'DATESET'.
        PERFORM bdc_field       USING 'DATESET'
                                      'O'.
    *Screen 0300
        PERFORM bdc_dynpro      USING 'SAPLSPO4' '0300'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'SVALD-VALUE(02)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=FURT'.
        PERFORM bdc_field       USING 'SVALD-VALUE(01)'
                                       wa_resp-short. "'PL-BK'.
        PERFORM bdc_field       USING 'SVALD-VALUE(02)'
                                       wa_resp-stext. "'Plan - BendixKing Team'.
    *Screen 0200
        PERFORM bdc_dynpro      USING 'SAPLRHUZ' '0200'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'EDIT_BIND_DEF-EXPR_LOW(02)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=SAVE'.
       PERFORM bdc_field       USING 'P1000-BEGDA'
                                 '23.03.2011'.
       perform bdc_field       using 'P1000-ENDDA'
                                 '31.12.9999'.
        PERFORM bdc_field       USING 'P1000-SHORT'
                                       wa_resp-short. "'PL-BK'.
        PERFORM bdc_field       USING 'P1000-STEXT'
                                       wa_resp-stext. "'Plan - BendixKing Team'.
        PERFORM bdc_field       USING 'EDIT_BIND_DEF-EXPR_LOW(02)'
                                       wa_resp-category.        "'z11'.
        CALL TRANSACTION c_tcode USING it_bdcdata
                                 MODE c_mode
                                 MESSAGES INTO it_bdcmsgcoll.
        IF sy-subrc <> 0.
          MESSAGE i001(ymsg)."Error Message
         ROLLBACK WORK.
        ELSE.
          REFRESH : it_bdcdata,
                    it_bdcmsgcoll.
    **screen 0410
          PERFORM bdc_dynpro      USING 'SAPLRHUZ' '0410'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'P1000-OBJID'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=CHG'.
          PERFORM bdc_field       USING 'P1000-OBJID'
                                         p_rule. "'90000162'.
    **screen 0420
          PERFORM bdc_dynpro      USING 'SAPLRHUZ' '0420'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=RELI'.
          PERFORM bdc_field       USING 'DATESET'
                                        'O'.
    **screen 0110
          PERFORM bdc_dynpro      USING 'SAPLRHW0' '0110'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=CONT'.
    **screen 0100
          PERFORM bdc_dynpro      USING 'SAPLRHWL' '0100'.
    *perform bdc_field       using 'BDC_CURSOR'
                                 'PCHDY-SEARK'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=CONT'.
          PERFORM bdc_field       USING 'PCHDY-SEARK'
                                         wa_resp-short. "'PL-BK'.
    **screen 0120
          PERFORM bdc_dynpro      USING 'SAPMSSY0' '0120'.
    *perform bdc_field       using 'BDC_CURSOR'
                                 '04/03'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=ENTR'.
    **screen 0400
          PERFORM bdc_dynpro      USING 'SAPLRHUA' '0400'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=INSE'.
    *perform bdc_field       using 'BDC_CURSOR'
                                 'PERIOD-BEGDA'.
          PERFORM bdc_field       USING 'PERIOD-BEGDA'
                                        '29.03.2011'.
          PERFORM bdc_field       USING 'PERIOD-ENDDA'
                                        '31.12.9999'.
          CALL TRANSACTION 'OOCU_RESP' USING it_bdcdata
                                       MODE c_mode
                                       MESSAGES INTO it_bdcmsgcoll.
          IF sy-subrc <> 0.
            MESSAGE i001(ymsg)."Error Message
            ROLLBACK WORK.
          ELSE.
            MESSAGE i000(ymsg)."Success Message
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " BDC_TO_CREATE_REP
    Guide me on this.
    Thanks

  • How to incoporate a function module in data source based on view

    Hi,
    I need to develop a data source in R/3 based on a view (which is straight forward).
    One field in the R/3 Z table  will be in like this ‘20,070,709,110,000’
    There is a function module developed in R/3 when executed will split the record(20,070,709,110,000) and display time & date
    How can i incorporate this function module in data source so that the data and time records will be loaded to BW
    Thanks

    Enhance the data source with date and time and populate these fields in the user exit using the function module IB_CONVERT_FROM_TIMESTAMP .
    OR
    You can create Z function module IB_CONVERT_FROM_TIMESTAMP in BW side and write a routine in update rules/transfer rules to populate date and time.
    hope this helps ...
    Ravi

  • Function Module for Outbound process code

    Hi,
    I have a scenario in which i have to send MBGMCR02 Idoc from SAP to XI.
    I created a new Outbound process code and now I have to code the function module that populates data into the segments.
    Does anyone have sample code for this, i.e code to put in the finction module of an outbound process code?

    hi...
    please find the below code.
    *& Report  ZPROGRAM11
    REPORT  ZPROGRAM11.
    tables : likp,vbuk,vbfa,ibin,vbap,vbak,kna1.
    types : begin of iy_tab,
             vbeln type vbfa-vbeln,
            vbelv type vbfa-vbelv,
           posnv type vbfa-posnv,
           end of iy_tab.
    types : begin of iy_tab1,
    vbeln type vbuk-vbeln,
    wbstk type vbuk-wbstk,
    end of iy_tab1.
    types : begin of iy_tab2,
    vbeln type vbak-vbeln,
    kunnr type vbak-kunnr,
    vkorg type vbak-vkorg,
    vtweg type vbak-vtweg,
    spart type vbak-spart,
    end of iy_tab2.
    data : i_ibase type ib_ibase.
    data : i_kunnr type vbak-kunnr.
    data : it_tab type table of iy_tab with header line,
      it_tab1 type standard table of iy_tab1 ,
      wa_tab1 type iy_tab1,
      it_tab2 type standard table of iy_tab2 ,
      wa_tab2 type iy_tab2.
    data : t_edidd type standard table of edidd .
    data : t_edidc type  edidc.
    data : t_edidc1 type standard table of edidc .
    data : wa type edidd.
    data : wa1 type e1edl20.
    data : wa2 type zibase.
    data : wa3 type e1edl32.
    data : wa4 type e1edl44.
    data : wa5 type e1edl37.
    data : wa6 type e1edl28.
    data : wa7 type e1edl30.
    data : wa8 type e1edl24.
    data : wa9 type e1adrm1.
    data : begin of it_tab3 occurs 10,
           vbeln type iy_tab-vbelv,
           posnr type iy_tab-posnv,
           i_ibase type ib_ibase,
           end of it_tab3.
      types :    begin of iy_tab4 ,
            valfr type ibin-valfr,
            ibase type ibin-ibase,
           amount type ibin-amount,
           unit type ibin-unit,
           end of iy_tab4.
           data : it_tab4 type standard table of iy_tab4,
                  wa_tab4 type iy_tab4.
      data : begin of it_tab5 occurs 10,
             vbeln type vbfa-vbelv,
             posnr type vbfa-posnv,
             ibase type ibib-ibase,
             valfr type ibin-valfr,
             amount type ibin-amount,
             unit type ibin-unit,
             matnr type vbap-matnr,
             kunnr type vbak-kunnr,
             vkorg type vbak-vkorg,
             vtweg type vbak-vtweg,
             spart type vbak-spart,
             name1 type kna1-name1,
             end of it_tab5.
          types : begin of iy_tab6,
                 vbeln type vbap-vbeln,
                 posnr type vbap-posnr,
                 matnr type vbap-matnr,
                end of iy_tab6.
          data : it_tab6 type standard table of iy_tab6,
                 wa_tab6 type iy_tab6.
    types : begin of iy_tab7,
            kunnr type kna1-kunnr,
            name1 type kna1-name1,
            end of iy_tab7.
    data: it_tab7 type standard table of iy_tab7,
          wa_tab7 type iy_tab7.
          data : wa_table type ytable1.
    selection-screen: begin of block b1 with frame title text-t00.
    parameters: p_vbeln type vbfa-vbeln.
    selection-screen: end of block b1.
    start-of-selection.
      select vbeln vbelv posnv  from vbfa into table it_tab
      where vbeln = p_vbeln.
      if sy-subrc eq 0.
            loop at it_tab.
        select vbeln wbstk from vbuk into table it_tab1
          for all entries in it_tab
        where vbeln = it_tab-vbeln.
            endloop.
      endif.
      loop at it_tab1 into wa_tab1.
        if wa_tab1-wbstk = 'C'.
          loop at it_tab.
            call function 'IBSD_CREATE_IBASE'
              exporting
                i_vbeln                     = it_tab-vbelv
                i_posnr                     = it_tab-posnv
                i_as_sold                   = '0'
                i_as_build                  = '0'
                i_capid                     = '0'
              I_CHANGE                    = ' '
               i_commit                    = 'X'
              I_COMMIT_WAIT               = ' '
             importing
               e_ibase                     = i_ibase
             exceptions
               order_not_found             = 1
               position_not_found          = 2
               nothing_to_do               = 3
               too_much_to_do              = 4
               missing_authorization       = 5
               foreign_lock                = 6
               others                      = 7
            if sy-subrc <> 0.
              message id sy-msgid type sy-msgty number sy-msgno
                      with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            else.
              move it_tab-vbelv to it_tab3-vbeln.
              move it_tab-posnv to it_tab3-posnr.
              move i_ibase to it_tab3-i_ibase.
              append it_tab3.
              if sy-subrc eq 0.
               select valfr ibase  amount unit from ibin into table it_tab4
                  for all entries in it_tab3
                  where ibase = it_tab3-i_ibase.
                 if sy-subrc eq 0.
                   select vbeln posnr matnr from vbap into table it_tab6
                     for all entries in it_tab3
                     where vbeln = it_tab3-vbeln and posnr = it_tab3-posnr .
                     if sy-subrc eq 0.
              select vbeln  kunnr vkorg vtweg spart from vbak into table it_tab2
                for all entries in it_tab
                  where vbeln = it_tab-vbelv.
              sort it_tab2 by vbeln.
              delete adjacent duplicates from it_tab2 comparing all fields.
             if sy-subrc <> 0.
               select kunnr name1 from kna1 into table it_tab7
                 for all ENTRIES IN it_tab2
                 where kunnr = it_tab2-kunnr.
                 endif.
               endif.
               endif.
               endif.
               endif.
          endloop.
        else.
          exit.
       if sy-subrc eq 0.
       endif.
        endif.
      endloop.
      loop at it_tab3.
        move it_tab3-vbeln to it_tab5-vbeln.
        move it_tab3-posnr to it_tab5-posnr.
        move it_tab3-i_ibase to it_tab5-ibase.
        if sy-subrc eq 0.
          read table it_tab4 into wa_tab4 with key ibase = it_tab3-i_ibase.
          move wa_tab4-valfr to it_tab5-valfr.
          move wa_tab4-amount to it_tab5-amount.
          move wa_tab4-unit to it_tab5-unit.
          if sy-subrc eq 0.
            read table it_tab6 into wa_tab6 with key  vbeln = it_tab3-vbeln posnr = it_tab3-posnr.
            move wa_tab6-matnr to it_tab5-matnr.
            if sy-subrc eq 0.
              read table it_tab2 into wa_tab2 with key vbeln = it_tab3-vbeln.
              move wa_tab2-kunnr to it_tab5-kunnr.
              move wa_tab2-vkorg to it_tab5-vkorg.
              move wa_tab2-vtweg to it_tab5-vtweg.
              move wa_tab2-spart to it_tab5-spart.
              if sy-subrc eq 0.
                read table it_tab7 into wa_tab7 with key kunnr = wa_tab2-kunnr.
                move wa_tab7-name1 to it_tab5-name1.
                append it_tab5.
                endif.
              endif.
          endif.
          endif.
         append it_tab5.
          endloop.
        loop at it_tab5.
          move it_tab5-vbeln to wa_table-vbeln.
           move it_tab5-kunnr to wa_table-kunnr.
            move it_tab5-vbeln to wa_table-vbeln.
             move it_tab5-ibase to wa_table-ibase.
              move it_tab5-matnr to wa_table-matnr.
               move it_tab5-valfr to wa_table-valfr.
                move it_tab5-unit to wa_table-unit.
                 move it_tab5-amount to wa_table-amount.
                  move it_tab5-vkorg to wa_table-vkorg.
                   move it_tab5-vtweg to wa_table-vtweg.
                    move it_tab5-spart to wa_table-spart.
                    move it_tab5-name1 to wa_table-name1.
                    insert ytable1 from wa_table.
                    endloop.
    *INSERT ytable1 FROM TABLE it_tab5.
        loop at it_tab5.
        wa1-vbeln = it_tab-vbeln.
        wa1-vkorg = it_tab5-vkorg.
        wa-segnam = 'E1EDL20'.
        wa-sdata = wa1.
        wa-hlevel = 2.
        append wa to t_edidd.
      loop at it_tab3.
        wa2-i_ibase = it_tab5-ibase.
        wa2-i_qty = it_tab5-amount.
        wa2-i_dat = it_tab5-valfr.
        wa-segnam = 'ZIBASE'.
        wa-sdata = wa2.
        wa-hlevel = 3.
        append wa to t_edidd.
               endloop.
    wa9-name1 = it_tab5-name1.
    wa-segnam = 'E1ADRM1'.
    wa-sdata = wa9.
    wa-hlevel = 3.
    append wa to t_edidd.
        wa-segnam = 'E1EDL28'.
        wa-sdata = wa6.
        wa-hlevel = 3.
        append wa to t_edidd.
        wa-segnam = 'E1EDL30'.
        wa-sdata = wa7.
        wa-hlevel = 4.
        append wa to t_edidd.
        wa3-kunnr = it_tab5-kunnr.
        wa-segnam = 'E1EDL32'.
        wa-sdata = wa3.
        wa-hlevel = 5.
        append wa to t_edidd.
        wa8-meins = it_tab5-unit.
        wa8-vtweg = it_tab5-vtweg.
        wa8-spart = it_tab5-spart.
        wa-segnam = 'E1EDL24'.
        wa-sdata = wa8.
        wa-hlevel = 3.
       append wa to t_edidd.
        wa-segnam = 'E1EDL37'.
        wa-sdata = wa5.
        wa-hlevel = 3.
        append wa to t_edidd.
        wa4-vbeln  = it_tab5-vbeln.
        wa4-posnr = it_tab5-posnr.
        wa4-matnr = it_tab5-matnr.
        wa-segnam = 'E1EDL44'.
        wa-sdata = wa4.
        wa-hlevel = 4.
        append wa to t_edidd.
        endloop.
        t_edidc-mandt = sy-mandt.
        t_edidc-direct = '1'.
        t_edidc-rcvpor = 'A000000062'.
        t_edidc-rcvprt = 'LS'.
        t_edidc-rcvprn = 'O2C_ASSET'.
    t_edidc-rcvpfc = 'LS'.
        t_edidc-sndpor = 'SAPSIT'.
        t_edidc-sndprt = 'LS'.
        t_edidc-sndprn = 'T90CLNT090'.
    t_edidc-sndpfc = 'LS'.
        t_edidc-mestyp = 'DELVRY'.
        t_edidc-idoctp = 'DELVRY03'.
    *t_edidc-rcvpfc = 'LS'.
    t_edidc-sndpfc = 'LS'.
        t_edidc-cimtyp = 'ZDELVRY03'.
        append t_edidc to t_edidc1.
        call function 'MASTER_IDOC_DISTRIBUTE'
                                   exporting
                                     master_idoc_control                  = t_edidc
                                 OBJ_TYPE                             = ''
                                 CHNUM                                = ''
                                   tables
                                     communication_idoc_control           = t_edidc1
                                     master_idoc_data                     = t_edidd
                                  exceptions
                                    error_in_idoc_control                = 1
                                    error_writing_idoc_status            = 2
                                    error_in_idoc_data                   = 3
                                    sending_logical_system_unknown       = 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.
          else.
          CALL FUNCTION 'DB_COMMIT'
          CALL FUNCTION 'DEQUEUE_ALL'
          EXPORTING
            _SYNCHRON       = ' '
          COMMIT WORK.
        endif.
         endloop.

  • Function Module to fetch Release Code for PReqs

    Hi,
    Is there any function module to get the current release code applicale by passing the requisition number?
    Example : If we have 4 levels of approval, say A1,A2,A3 and A4, and I want to know with what release code shall I release the requisition.
    If release has benn effected for the requisition with codes A1 and A2 and if I query with the function module what is the current release code applicable, then it should give A3 or atleast a result that A2 has been the last release code effected.
    Also where is the release related info stored ? I mean which tables...
    Not the release strategy related info but the release effected info.
    Dont worry about points...

    Hi
    Pur requisition Release Codes are stored in <b>T161E</b> table
    Release code is linked with Release strategy in <b>T161F</b> table
    Link the code with Release strategy field in <b>EBAN</b> table
    Also check the fun modules
    MM_CHECK_RELEASE_CODE_EQUAL_KI
    MM_CHECK_RELEASE_CODE_NOT_KI
    ME_RELEASE_REQUISITION
    BAPI_REQUISITION_RELEASE
    Reward points if useful
    Regards
    Anji
    Message was edited by:
            Anji Reddy Vangala

  • Function Module to get Company code and Plant on the basis of infotype and pernr

    Hi Experts,
    I need to know the function module which will return company code and plant based on infotype and pernr(employee Number).
    Thanks,
    Salil Bagchi

    I think thats the only way
    CALL FUNCTION 'CU_READ_RGDIR'
        EXPORTING
          persnr          = p0001-pernr
        TABLES
          in_rgdir        = it_rgdir
        EXCEPTIONS
          no_record_found = 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.
    check whether "Pay date for payroll result" with in Start Date and
                  End date, and "Reason for Off-Cycle Payroll" is initial
      LOOP AT it_rgdir WHERE paydt >= v_begda
                             AND paydt <= v_endda AND
                             void IS INITIAL
                             AND ocrsn IS INITIAL
                             AND srtza = 'A'.
        v_seqnr = it_rgdir-seqnr.
    ENDLOOP.
    Hope this helps.
    Thanks
    Kiran

  • BAPI or Function Module for inserting record in any " Org. Mgmt" Infotype

    Hi All,
    I am working on HR-ABAP.
    I wanted to know the name of the <b>BAPI </b>or the <b>Function Module.</b> that can be used to insert the records in any of the <b>Organization Management</b> Infotype, particularly in the <b>Planned Compensation</b> infotype HRP1005.
    It is Quite Urgent. Kindly drop ur post if u have any idea even.
    Thanks and Regards
    Ajay

    RH_INSERT_INFTY
    Regards,
    Amit
    Reward all helpful replies.

  • 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

  • Transaction code to assign the function module to the process code

    Hi,
    What is the transaction to assign the function module to the process code

    Hello Preethi,
    Try with these Tcodes:
    <b>
    WE41                           0000  Process codes, outbound
    WE42                 RSECODIN  1000  Process codes, inbound
    WE43                           0000  Funct.module: Status record display</b>
    If useful reward.
    Vasanth

  • Function module to check source system

    Hello
    Can some one help me by providing the name of the function module to check the Source system connection?
    I know that in the source system we can right click and check.
    But i want to know the function module to check the status.
    Thanks in advance
    Kind regards
    M.A
    Edited by: M.A on Aug 19, 2008 12:42 PM

    Hi shasank,
    Thanks for the info.
    I had given the tech name of the source system as an input to the function module.
    But it raises an exception that destination does not exists.
    But the source system connection is ok.
    Regards
    M.A

  • Function module to insert table VBEH /move from VBEP to VBEH

    Hi all,
    Actually, I'm using BAPI_SALESORDER_CHANGE to change quantity of the schedule line, but it only update quantity in table VBEP. I want to make old quantity saved to history table (VBEH).
    is there any function module/BAPI to get this?
    When Sales Distribution - schedule line agreement (VBEP) move to schedule line history (VBEH) ?.
    Thanks.

    yeah....
    i got this method from my friend. Thanks Teddy
    it will save old schedule line to VBEH and create new release order
    *   Populate Sales and Distribution Document Number
        p_salesdocument = pwa_curr_forecast-vbeln.
    *   Populate Sales Document Header Checkbox
        pwa_order_header_inx-updateflag = 'U'.
    * Populate Schedule Lines
      CLEAR lwa_schedule_in.
      lwa_schedule_in-itm_number  = pwa_curr_forecast-posnr.
      lwa_schedule_in-sched_line  = pwa_curr_forecast-etenr.
      lwa_schedule_in-req_qty     = pwa_curr_forecast-wmeng.
      APPEND lwa_schedule_in TO pi_schedule_in.
    * Populate Schedule Line Checkbox
      CLEAR lwa_schedule_inx.
      lwa_schedule_inx-itm_number = pwa_curr_forecast-posnr.
      lwa_schedule_inx-sched_line = pwa_curr_forecast-etenr.
      lwa_schedule_inx-updateflag = 'I'.
      lwa_schedule_inx-req_qty    = 'X'.
      APPEND lwa_schedule_inx TO pi_schedule_inx.
    * Populate delete schedule vblb
      CLEAR lwa_del_schedule_in.
      lwa_del_schedule_in-itm_number   = pwa_release_ord-posnr.
      lwa_del_schedule_in-rel_type     = '1'.
      lwa_del_schedule_in-dlvschedno   = l_labnk.
      lwa_del_schedule_in-dlvscheddate = pwa_release_ord-abrdt.
      APPEND lwa_del_schedule_in TO pi_del_schedule_in.
    * Populate delete schedule vblb checkbox
      CLEAR lwa_del_schedule_inx.
      lwa_del_schedule_inx-itm_number   = pwa_release_ord-posnr.
      lwa_del_schedule_inx-rel_type     = '1'.
      lwa_del_schedule_inx-dlvschedno   = 'X'.
      lwa_del_schedule_inx-dlvscheddate = 'X'.
      lwa_del_schedule_inx-updateflag   = 'I'.
      APPEND lwa_del_schedule_inx TO pi_del_schedule_inx.
    CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'
        EXPORTING
          salesdocument               = p_salesdocument
    *     ORDER_HEADER_IN             =
          order_header_inx            = pwa_order_header_inx
    *     SIMULATION                  = ' '
    *     INT_NUMBER_ASSIGNMENT       = ' '
    *     BEHAVE_WHEN_ERROR           = ' '
    *     BUSINESS_OBJECT             = ' '
    *     CONVERT_PARVW_AUART         = ' '
    *     CALL_FROM_BAPI              = ' '
    *     LOGIC_SWITCH                =
    *     I_CRM_LOCK_MODE             = ' '
    *     NO_STATUS_BUF_INIT          = ' '
    *   IMPORTING
    *     SALES_HEADER_OUT            =
    *     SALES_HEADER_STATUS         =
        TABLES
          return                      = li_return
    *     ITEM_IN                     =
    *     ITEM_INX                    =
          schedule_in                 = pi_schedule_in
          schedule_inx                = pi_schedule_inx
    *     PARTNERS                    =
    *     PARTNERCHANGES              =
    *     PARTNERADDRESSES            =
    *     SALES_CFGS_REF              =
    *     SALES_CFGS_INST             =
    *     SALES_CFGS_PART_OF          =
    *     SALES_CFGS_VALUE            =
    *     SALES_CFGS_BLOB             =
    *     SALES_CFGS_VK               =
    *     SALES_CFGS_REFINST          =
    *     SALES_CCARD                 =
    *     SALES_TEXT                  =
    *     SALES_KEYS                  =
    *     CONDITIONS_IN               =
    *     CONDITIONS_INX              =
    *     SALES_CONTRACT_IN           =
    *     SALES_CONTRACT_INX          =
    *     EXTENSIONIN                 =
    *     ITEMS_EX                    =
    *     SCHEDULE_EX                 =
    *     BUSINESS_EX                 =
    *     INCOMPLETE_LOG              =
    *     EXTENSIONEX                 =
    *     CONDITIONS_EX               =
    *     SALES_SCHED_CONF_IN         =
    *     DEL_SCHEDULE_EX             =
          del_schedule_in             = pi_del_schedule_in
          del_schedule_inx            = pi_del_schedule_inx
    *     CORR_CUMQTY_IN              =
    *     CORR_CUMQTY_INX             =
    *     CORR_CUMQTY_EX              =
    *     PARTNERS_EX                 =
    *     TEXTHEADERS_EX              =
    *     TEXTLINES_EX                =
    *     BATCH_CHARC                 =

  • Searching for function modul which insert adressdata bevor fm vendor_insert

    hello,
    i read many threads, but I find no solution.
    I want use the fm vendor_insert for a migration. But using the fm vendo_insert require an existing address entry.
    Is there any central fm which create the whole address.
    regards
    Kim Werner

    Hi Mahesh,
    Very good questions.  Infact it's very difficult to answer all the questions.
    You can search many FAQs in net...
    If you have any specific questions related to single topic, Post message for each.
    I can send some of FAQ documents to u
    Answers
    1) Using Index like Field(1)-1st record field , Field(2) - 2nd record field etc... in Table control.. we can handle BDC
    2) BAPI will be programmed using OO concepts more.. and as Interfacing is more enhanced here than normal FM.
    etc...
    Regards,
    Manjunatha

  • Different types of function module

    hi,
    When we create a function module : in one of the tabs we can find
      1 general function module
      2. remote function module
    3. update function module.
    What is meant by update function module and remote function module. can anyone explain me with an example and when shd we opt for 2 and 3.
    thanxs
    hari

    Function Modules:
    Function modules allow you to encapsulate and reuse global functions in the R/3 System.
    They are stored in a central library. The R/3 System contains a wide range of predefined
    function modules that you can call from any ABAP program.
    Unlike subroutines, you do not define function modules in the source code of your program.
    Instead, you use the Function Builder. The actual ABAP interface definition remains hidden
    from the programmer. You can define the input parameters of a function module as optional.
    You can also assign default values to them. Function modules also support exception handling.
    This allows you to catch certain errors while the function module is running. You can test
    function modules without having to include them in a program using the Function Builder.
    Function Groups:
    Function groups are containers for function modules. You cannot execute a function group.
    When you call a function module, the system loads the whole of its function group into the
    internal session of the calling program.
    Calling Function Modules in ABAP:
    To call a function module, use the CALL FUNCTION statement:
    CALL FUNCTION <module>
    [EXPORTING f1 = a 1.... f n = a n]
    [IMPORTING f1 = a 1.... f n = a n]
    [CHANGING f1 = a 1.... f n = a n]
    [TABLES f1 = a 1.... f n = a n]
    [EXCEPTIONS e1 = r 1.... e n = r n [ERROR_MESSAGE = r E]
    [OTHERS = ro]].
    You can specify the name of the function module <module> either as a literal or a variable.
    Each interface parameter <fi> is explicitly assigned to an actual parameter <a i>. You can
    assign a return value <r i> to each exception <e i>. The assignment always takes the form
    <interface parameter> = <actual parameter>. The equals sign is not an assignment operator
    in this context.
    • After EXPORTING, you must supply all non-optional import parameters with values
    appropriate to their type. You can supply values to optional import parameters if you
    wish.
    [email protected]
    34
    • After IMPORTING, you can receive the export parameters from the function module by
    assigning them to variables of the appropriate type.
    • After CHANGING or TABLES, you must supply values to all of the non-optional
    changing or tables parameters. When the function module has finished running, the
    changed values are passed back to the actual parameters. You can supply values to
    optional changing or tables parameters if you wish.
    You can use the EXCEPTIONS option to handle the exceptions of the function module. If an
    exception <e i > is raised while the function module is running, the system terminates the
    function module and does not pass any values from the function module to the program,
    except those that were passed by reference. If <e i > is specified in the EXCEPTION option,
    the calling program handles the exception by assigning <r i > to SY-SUBRC. <r i > must be a
    numeric literal.
    If you specify of ERROR_MESSAGE in the exception list you can influence the message
    handling of function modules. Normally, you should only call messages in function modules
    using the MESSAGE ... RAISING statement. With ERROR_MESSAGE you can force the system
    to treat messages that are called without the RAISING option in a function module as follows
    for various FM's
    http://www.erpgenie.com/abap/functions.htm
    Calling Function Modules
    http://help.sap.com/saphelp_46c/helpdata/en/9f/db98ef35c111d1829f0000e829fbfe/content.htm
    remote enabled fm's are BAPI's
    refer
    Introduction to BAPIs:
    Definition
    The SAP Business Objects held in the Business Object Repository (BOR) encapsulate their data
    and processes. External access to the data and processes is only possible by means of specific
    methods - BAPIs (Business Application Program Interfaces).
    A BAPI is defined as a method of a SAP Business Object.
    For example, the functionality that is implemented with the SAP Business Object type
    "Material" includes a check for the material’s availability. Thus, the Business Object type
    "Material" offers a BAPI called "Material.CheckAvailability".
    Use
    To use a BAPI method, an application program only needs to know how to call the method;
    that is, it needs to know the method’s interface definition. Therefore, when including a BAPI
    invocation in your application program, you only need to supply the appropriate interface
    information.
    A BAPI interface is defined by:
    • Import parameters, which contain data to be transferred from the calling program to
    the BAPI
    • Export parameters, which contain data to be transferred from the BAPI back to the
    calling program
    • Import/export (table) parameters for both importing and exporting data
    Structure
    The BAPIs in the R/3 System are currently implemented as function modules, all of which are
    held in the Function Builder. Each function module underlying a BAPI:
    • Supports the Remote Function Call (RFC) protocol
    • Has been assigned as a method to an SAP Business Object in the BOR
    • Is processed without returning any screen dialogs to the calling application
    Integration
    The architecture enables SAP to change the details of a BAPI’s implementation without
    affecting external applications, which are using the BAPI.
    Advantages of Using BAPIs
    BAPIs are standardized methods of SAP Business Objects that enable customers and third
    parties to integrate their software components with the R/3 System and the Business
    Framework.
    Business Standard
    SAP Business Objects and their BAPIs provide a business content standard, rather than a
    technical interoperability standard; that is, they enable the integration of R/3 and other
    software components on a business level, not on a technical level.
    [email protected]
    97
    Standards Conformance
    BAPIs are being developed as part of the SAP joint initiative with customers, partners, and
    leading standards organizations. BAPIs are becoming a communication standard between
    business systems.
    You can access SAP Business Objects and their BAPIs by using object-oriented interfacing
    technologies such as Microsoft’s COM/DCOM (Component Object Model/Distributed Component
    Object Model).
    The SAP Business Objects already comply with the Open Applications Group (OAG)
    specifications, and, in conjunction with ObjectBridge from VisualEdge, conform to the Object
    Management Group’s CORBA (Common Object Request Broker Architecture) guidelines.
    Stability and Downward Compatibility
    Once a BAPI is implemented and released by SAP, its interface definition and parameters
    remain stable in the long term, thus ensuring that your application program remains
    unaffected by any changes to the underlying R/3 software and data.
    SAP can make any necessary extensions to the BAPIs, for example, additional optional
    parameters, without destabilizing the operation of existing applications and, at the same time,
    can offer the enhanced functionality to new applications.
    Object Orientation
    As methods of the SAP Business Objects, BAPIs provide access to R/3 data and processes
    following an object-oriented programming model. BAPIs can be called using object-oriented
    interfacing technologies, such as COM/DCOM, thus enabling software components from SAP
    and third parties to interact freely.
    Openness
    You can access BAPIs from all development platforms that support the SAP Remote Function
    Call (RFC) protocol.
    BAPI Definition
    A Business Application Programming Interface (BAPI) is a precisely defined interface providing
    access to processes and data in business application systems such as R/3. BAPIs are defined
    as API methods of SAP Business Objects. These business objects and their BAPIs are described
    and stored in the Business Object Repository (BOR).
    A BAPI is implemented, however, as a function module, that is stored and described in the
    Function Builder.
    BAPIs can be called within the R/3 System from external application systems and other
    programs. BAPIs are the communication standard for business applications. BAPI interface
    technology forms the basis for the following developments:
    • R/3 satellite systems
    • Isolating components within the R/3 System in the context of Business Framework
    • Distributed R/3 scenarios using Application Link Enabling (ALE)
    • Connecting R/3 Systems to the Internet using Internet Application Components (IACs)
    • Visual Basic programs as front-end to R/3 Systems
    • Workflow applications that extend beyond system boundaries
    • Customers’ and partners’ own developments
    • Connections to non-SAP software
    • Connections to legacy systems
    [email protected]
    98
    Standardized BAPIs
    Some BAPIs and methods provide basic functions and can be used for most SAP Business
    Objects. Such BAPIs are known as "standardized" BAPIs.
    Using the descriptions below as a guide, verify whether you can implement the BAPI as a
    standardized BAPI.
    Features
    BAPIs for Reading Data
    The following BAPIs provide you with read-only access to data in the associated business
    object:
    • GetList
    With this BAPI you can select a range of object key values, for example, company
    codes and material numbers. To specify appropriate selection requirements the calling
    program must pass the relevant parameters to the interface. The key values selected
    by the BAPI GetList are returned to the calling program in a table, together with other
    useful information, for example, short texts. The key values can then be passed on to
    another BAPI for further processing, for example, the BAPI GetDetail, as listed below.
    • GetDetail
    The BAPI GetDetail uses a key to retrieve details about an instance(s specific
    occurrence) of a business object and returns this data to the calling program.
    • GetStatus
    The BAPI GetStatus is used to query the status of an SAP Business Object, for
    example, to display the processing status of a sales order. This BAPI is used only for
    displaying the status of an object and does not retrieve full details like the BAPI
    GetDetail.
    • ExistenceCheck
    The BAPI ExistenceCheck checks, whether an entry exists for an SAP Business Object,
    for example, whether the customer master has been created. You should implement
    this method as a workflow method and not as a BAPI (RFC capable function module).
    The method CompanyCode.ExistenceCheck of the business object CompanyCode
    (BUS0002) is an example of this. This workflow method is indirectly invoked when the
    calling program instantiates an object, for example, by using
    GetSAPObject("CompanyCode") from within Visual Basic.
    BAPIs for Creating or Changing Data
    The following BAPIs can create, change or delete instances of a business object: If required,
    you can implement these BAPIs so that, several instances of a business object can be created,
    deleted or modified simultaneously in the same call. In such cases "multiple" is added to the
    method name, for example ChangeMultiple.
    BAPIs that can create, change or delete instances are:
    • Create or CreateFromData
    The BAPI Create or CreateFromData creates an instance of an SAP Business Object,
    for example, a sales order. Create is the preferred name for this BAPI. Use the name
    CreateFromData only when a workflow method called Create already exists for the
    business object in question.
    [email protected]
    99
    • Change
    The BAPI Change changes an existing instance of a SAP Business Object, for example,
    a sales order.
    • Delete
    The BAPI Delete deletes an instance of a SAP Business Object, for example, sales
    order.
    BAPIs for Replicating Business Object Instances
    The BAPIs below can be implemented as methods of business objects that can be replicated.
    They enable specific instances of an object type to be copied to one or more different systems.
    These BAPIs are used mainly to transfer data between distributed systems within the context
    of Application Link Enabling (ALE).
    The method below must be implemented for each business object to be replicated.
    • Replicate
    The BAPI Replicate is called in the system, which contains the originals of the business
    object instances to be replicated. It is used to:
    • Identify the business objects to be replicated and to organize the required data.
    • Call the clone methods described below in the receiving system
    Moreover, at least one of the clone methods below must be implemented for each business
    object to be replicated.
    • Clone
    The BAPI Clone is used by a system to replicate one business object on another
    system or to modify one business object that has already been cloned.
    • CloneMultiple
    The BAPI CloneMultiple is used by a system to replicate several business objects on
    another system or to modify several business objects that have already been cloned.
    Defining and Implementing the BAPI
    Purpose
    Various components of the ABAP Workbench are used when you define and implement a BAPI.
    A BAPI is an API method of a business object and is defined as such in the Business Object
    Repository (BOR). However, a BAPI is implemented as an RFC capable function module, which
    is maintained in the Function Builder. The definitions and descriptions of the data structures
    used by the BAPI are stored in the ABAP Dictionary.
    For function modules that implement BAPIs, certain standards and rules must be adhered to
    over and above the standard programming rules for function modules. For example, COMMIT
    WORK commands must not be used in the function modules that a BAPI is based on.
    The following sections guide you through the steps involved in developing a BAPI. The sections
    contain information about the guidelines and conventions that you should adhere to when
    defining and implementing a BAPI. When implementing BAPIs follow the requirements below
    to ensure you achieve consistent behavior and representation of BAPIs as object oriented
    methods of SAP Business Objects.
    [email protected]
    100
    BAPI Programming
    BAPI Definition
    A Business Application Programming Interface (BAPI) is a precisely defined interface providing
    access to processes and data in business application systems such as R/3.
    BAPIs are defined as API methods of SAP Objects. These objects and their BAPIs are described
    and stored in the BOR (BOR).
    Use
    BAPIs can be called within the R/3 System from external application systems and other
    programs. A BAPI call can either be made as an object oriented method call or as a remote
    function call (RFC).
    BAPIs are a global communication standard for business applications.
    Examples of what BAPIs can be used for include:
    • R/3 satellite systems
    • Distributed R/3 scenarios using Application Link Enabling (ALE)
    • Connecting R/3 Systems to the Internet using Internet application components (IACs)
    • Visual Basic programs as front-end to R/3 Systems
    • Workflow applications that extend beyond system boundaries
    • Customers’ and partners’ own developments
    • Connections to non-SAP software
    • Connections to legacy systems
    BOR Definition
    The Business Object Repository (BOR) is the object-oriented repository in the R/3 System. It
    contains, among other objects, SAP Business Objects and their methods. In the BOR a
    Business Application Programming Interface (BAPI) is defined as an API method of an SAP
    Business Object. Thus defined, the BAPIs become standard with full stability guarantees as
    regards their content and interface.
    Use
    With regard to SAP Business Objects and their BAPIs, the BOR has the following functions:
    • Provides an object-oriented view of R/3 System data and processes.
    R/3 application functions are accessed using methods (BAPIs) of SAP Business
    Objects. Implementation information is encapsulated; only the interface functionality
    of the method is visible to the user.
    • Arranges the various interfaces in accordance with the component hierarchy, enabling
    functions to be searched and retrieved quickly and simply.
    • Manages BAPIs in release updates.
    BAPI interface enhancements made by adding parameters are recorded in the BOR.
    Previous interface versions can thus be reconstructed at any time. When a BAPI is
    created the release version of the new BAPI is recorded in the BOR. The same applies
    when any interface parameter is created.
    The version control of the function module that a BAPI is based on is managed in the
    Function Builder.
    • Ensures interface stability.
    Any interface changes that are carried out in the BOR, are automatically checked for
    syntax compatibility against the associated development objects in the ABAP
    Dictionary.
    [email protected]
    101
    Integration
    You should only define a BAPI as a SAP Business Object method in the BOR if the function
    module that the BAPI is based on has been fully implemented. Full access to the BOR is
    restricted to the persons responsible for the objects involved and for quality control.
    BOR-BAPI Wizard
    The BOR-BAPI Wizard assists with creating new BAPI methods in the BOR. It takes you
    through the creation process step by step.
    Transaction Model for Developing BAPIs Purpose
    The transaction model in which BAPIs are used determines how you have to program BAPIs.
    The transaction model described here has been used to develop BAPIs for R/3 Releases 3.1
    and 4.0A.
    Logical Unit of Work (LUW) and Statelessness
    Within the context of this transaction model a transaction represents one processing step or
    one logical unit of work (LUW). When a transaction is called, database operations are either
    fully executed or not at all. The whole transaction must be programmed to be stateless.
    This transaction model requires that:
    • No data is imported that may indirectly affect the result. If a transaction is called more
    than once, each call must have the same result. For BAPIs this means, for example,
    that Set or Get parameters cannot be used. However, you can keep Customizing data
    in a global memory, as this data remains unchanged even if transaction calls are
    repeated.
    • There must be no functional dependencies between two transactions.
    • Either all relevant data has to be changed in the database or none at all.
    Determining the SAP Business Object and Its Key Fields
    You have to identify the relevant SAP Business Object in the Business Object Repository (BOR)
    and determine whether the key fields of the Business Object are relevant for your BAPI.
    A key is defined in the BOR for most SAP Business Objects. This key can consist of several key
    fields. The content of these key fields uniquely identifies one individual instance of an SAP
    Business Object.
    You can differentiate between instance-dependent and instance-independent BAPI methods.
    Unlike instance-independent methods, instance-dependent methods relate to one instance
    (one specific occurrence) of an SAP Business Object type, for example to one specific sales
    order.
    In the case of instance-dependent BAPIs, the key fields of the corresponding SAP Business
    Object must be used as parameters in the function module the BAPI is based on so that the
    associated object instance can be identified. The names of the key fields in the SAP Business
    Object and the corresponding parameters in the BAPI function module must be the same,
    because the name links the key fields to the parameters.
    All the key fields defined in the BOR for the SAP Business Object in question must be used as
    the parameters in the function module.
    Example
    SAP Business Object Creditor has a key field named CreditorId.
    This key field must be defined as a parameter with the name CREDITORID in the function
    modules of the instant-dependent BAPIs for this Business Object.
    [email protected]
    102
    To display the Business Object and its key fields follow the steps below:
    1. Select Tools -> ABAP Workbench -> Overview -> Business Object Browser . The
    business objects are displayed in the order of the R/3 application hierarchy.
    2. Select the required SAP Business Object in the application hierarchy and double click it
    to open it.
    3. To display the Business Object’s key fields, expand the node Key fields.
    Defining the Interface Structure of the BAPI
    In this step you are going to define the BAPI interface, that is, the individual import, export
    and table parameters required for calling the BAPI.
    Caution
    You cannot use Changing and Exception parameters in a function module which implements a
    BAPI.
    Process Flow
    To define the interface parameters, proceed as follows:
    1. Check whether the key fields of the SAP Business Object are required in the interface. The
    key fields of the SAP Business Object are some of the most important BAPI parameters.
    If a key value is to be passed to the BAPI by the calling program, the key field must be set as
    an import parameter in the function module of the BAPI. That way a specific instance of the
    Business Object is identified.
    For example, this could be a customer number (CustomerNo) in the BAPIs Customer.GetDetail
    and Customer.CheckPassword, or the number of a sales document in the BAPI
    SalesOrder.GetStatus.
    For BAPIs that generate instances, for example, the BAPIs Create or CreateFromData, the key
    field of the Business Object should be set as an export parameter in the BAPI function module.
    These BAPIs return one key value, for example, an order number in the BAPI
    SalesOrder.CreateFromData.
    For BAPIs that are class methods a key field is neither set as an import nor as an export
    parameter in the BAPI function module. Class methods are instance-independent and are
    called without the use of key values. Usually they return a table with a selection of key values.
    2. Specify what other data is relevant as import, export or table parameters for the BAPI.
    Every BAPI must have an Export parameter return that reports messages back to the calling
    program.
    Example
    The BAPI to be developed is to read data from the SAP Business Object Creditor. To read
    creditor details, the calling program has to pass the ID of the creditor and the company code.
    The creditor data returned is to include general details, specific details and bank details.
    To map these requirements onto the BAPI interface, the following parameters must be set in
    the function module which the BAPI is based on:
    • The key field CreditorID of the SAP Business Object as an import parameter
    • An import parameter for the company code
    • A Return parameter that reports messages back to the calling program
    • A parameter for general details of the creditor
    • A parameter for specific details of the creditor
    • A parameter for bank details of the creditor
    for BAPI list
    refer www.sapbapi.com
    for FM's refer www.se37.com
    regards
    srinivas
    <b>*reward for useful answers*</b>

Maybe you are looking for