How to Create the Function Module Exit

Hi,
  How to Create the Function Module Exit. Please tell me the step by step procedure.

Hi,
Check this link for how to create the function module exit..
http://sap.niraj.tripod.com/id62.html
Thanks
naren

Similar Messages

  • How to create the funtion module with step by step

    friends can u help me regarding how to create the function module very urgent,
    regards
    bhavani

    To create a function module, you first need to create a Function Group which will keep all the function module of same functionality.
    To create a Function Group, go to SE80->Click on Workbench-Edit Object->Function Group Tab->Enter Function Group name-> Click Create.
    To create a Function Module:
    Go to T.Code SE37->Enter the Function name->Enter Function Group name n Short Des.-> Here you need to define Import, Export parameters with the condition. Also you can write your code in source code tab.
    check this link
    Converting seconds values
    check the FM code. if you don't have this FM code, create it in SE37 and make use of it.
    FM MONI_TIME_CONVERT
    FUNCTION MONI_TIME_CONVERT.
    ""Lokale Schnittstelle:
    *" IMPORTING
    *" REFERENCE(LD_DURATION) TYPE SY-TABIX
    *" EXPORTING
    *" REFERENCE(LT_OUTPUT_DURATION) TYPE SWL_PM_CVH-DURATION
    DATA: LD_HOUR(4) TYPE N. "
    DATA: LD_MIN(4) TYPE N. "
    DATA: LD_SEC(4) TYPE N. "
    DATA: LD_VALUE2(2) TYPE N.
    DATA: LD_VALUE3(3) TYPE N.
    DATA: LD_VALUE4(4) TYPE N.
    DATA: SAVE_DURATION LIKE SY-TABIX.
    data: ld_minus(1).
    SAVE_DURATION = LD_DURATION.
    if ld_duration < 0.
    save_duration = save_duration * ( -1 ).
    ld_minus = true.
    endif.
    CLEAR LT_OUTPUT_DURATION.
    IF SAVE_DURATION NE 0.
    LD_HOUR = SAVE_DURATION DIV 3600.
    save_duration = save_duration - ld_hour * 3600.
    LD_MIN = SAVE_DURATION DIV 60.
    save_duration = save_duration - ld_min * 60.
    LD_SEC = SAVE_DURATION.
    IF LD_HOUR LE 100.
    LD_VALUE2 = LD_HOUR.
    WRITE LD_VALUE2 TO LT_OUTPUT_DURATION+3(2).
    ELSEIF LD_HOUR LE 1000.
    LD_VALUE3 = LD_HOUR.
    WRITE LD_VALUE3 TO LT_OUTPUT_DURATION+2(3).
    ELSE.
    LD_VALUE4 = LD_HOUR.
    WRITE LD_VALUE4 TO LT_OUTPUT_DURATION(4).
    ENDIF.
    WRITE ':' TO LT_OUTPUT_DURATION+5.
    LD_VALUE2 = LD_MIN.
    WRITE LD_VALUE2 TO LT_OUTPUT_DURATION+6(2).
    WRITE ':' TO LT_OUTPUT_DURATION+8.
    LD_VALUE2 = LD_SEC.
    WRITE LD_VALUE2 TO LT_OUTPUT_DURATION+9(2).
    LT_OUTPUT_DURATION = LT_OUTPUT_DURATION+1.
    if ld_minus = true.
    write '-' to lt_output_duration+1(1).
    endif.
    ELSE.
    job running or aborted
    ENDIF.
    ENDFUNCTION.
    Eg:2
    Use the following procedure to create a function module
    1.From the ABAP/4 Development Workbench screen, press the Function Library button on the Application toolbar.
    2.Type the name of your function module in the Function Module field. The name must begin with Y_ or Z_.
    3.Press the Create button. The Function Module Create: Administration screen is shown
    4.Type the name of a function group in the Function Group field. The function group name must be four characters long and must begin with Y or Z.
    5.Type an S in the Application field. This field is used to indicate which function area uses the function module. Our functionality is not used by any functional area, it is simply an example, so any choice will do. (S indicates that the function module contains functionality needed by Basis.)
    6.Type a description of the function module in the Short Text field. The contents of this field are seen when displaying a list of function modules.
    Press the Save button on the Application toolbar.
    7.If the function group does not already exist, a pop-up informs you of that fact and asks you if you want to create it. Press the Yes button to create the function group. The Create Function Group dialog box appears. Type a description in the Short Text field and press the Save button. The Create Object Catalog Entry screen appears. Press the Local Object button. You are returned to the Function Module Change: Administration screen.
    8.Press the Source Code button on the Application toolbar. The Function Module Edit screen is displayed.
    9.Type the source code for your function module. Do not change the system-generated comment lines under any circumstances! Your function module might fail to operate if you do.
    10.Press the Save button on the Application toolbar. The message Program xxxxx saved appears in the status bar at the bottom of the window.
    11.Press the Back button on the Application toolbar. You are returned to the Function Library Initial screen.
    12.If you want to define import or export parameters, select the Import/Export Parameter Interface radio button. Press the Change pushbutton. You are shown the Import/Export Parameters screen (refer to Figure 19.6). Type the names of your parameters in the first column and enter any other desired characteristics for each parameter. When you are finished, press the Save button and then the Back button.
    13.Finally, to activate your function module, press the Activate button on the Application toolbar of the Function Library Initial Screen.
    http://www.erpgenie.com/abap/bapi/example.htm

  • How to use the function module /IRM/IPBB_AGREEMENT_CREATE.

    Hi all,
    Please help me how to use the function module /IRM/IPBB_AGREEMENT_CREATE.
    It is a Vistex fuction module which is used to create Sales contract in SAP-Vistex. If anyone has use the function module and do have the sample code please share it.
    Thanks.

    FORM create_agreement TABLES pt_agreement
                                           CHANGING po_agreement .
      CONSTANTS: c_strt_knumh TYPE knumh VALUE '0000000000'.
      DATA: lc_kona  TYPE /irm/s_gkona,
            lc_cbasp TYPE /irm/s_ipcbasp,
          lt_cbapr TYPE /irm/t_ipcbapr,         "Partners
          lc_cbapr TYPE /irm/s_ipcbapr,
          lt_cbadt TYPE  /irm/t_ipcbadt,        "Dates
          lc_cbadt TYPE  /irm/s_ipcbadt,
          lt_cbafs TYPE  /irm/t_ipcbafs,
          lc_cbafs TYPE  /irm/s_ipcbafs,
          lt_cbacn TYPE  /irm/t_ipcbacn,
          lc_cbacn TYPE  /irm/s_ipcbacn,
          lt_cbacl TYPE  /irm/t_ipcbacl,
          lc_cbacl TYPE  /irm/s_ipcbacl,
          lt_cbtpv TYPE  /irm/t_ipagtpv,
          lc_cbtpv TYPE  /irm/s_ipagtpv,
          lt_texts TYPE  text_lh,
          lc_texts TYPE  itclh,
          lt_cbasd TYPE  /irm/t_ipcbasd,
          lc_cbasd TYPE  /irm/s_ipcbasd,
          lc_agreement    TYPE  /irm/s_ipcbasp_doc,
          lc_e_log_number TYPE  balognr,
          lt_messages     TYPE  /irm/t_gprolog.
      DATA: lt_vake      TYPE  cond_vakevb_t,
            lc_vake      TYPE LINE OF cond_vakevb_t,
            lt_konh      TYPE  /irm/t_gkonh,
            lc_konh      TYPE LINE OF /irm/t_gkonh,
            lt_konp      TYPE  /irm/t_gkonp,
            lc_konp      TYPE LINE OF /irm/t_gkonp,
            lt_konw      TYPE  /irm/t_gkonwu,
            lc_konw      TYPE LINE OF /irm/t_gkonwu,
            lt_konm      TYPE  /irm/t_gkonmu,
            lc_konm      TYPE LINE OF  /irm/t_gkonmu,
            lt_komg      TYPE  /irm/t_gkomg_index,
            lc_komg      TYPE LINE OF /irm/t_gkomg_index,
            lt_user_data TYPE  /irm/t_gpraxfu_index,
            lc_user_data TYPE LINE OF /irm/t_gpraxfu_index.
      DATA: lc_updt(1) TYPE c.
      DATA: lc_knumh TYPE knumh.
      DATA: BEGIN OF lc_str_knumh,
             hd(2) TYPE c VALUE '$$',
             inc_num(8) TYPE c,
            END OF lc_str_knumh.
      DATA: blank_agree_key TYPE knuma VALUE '~~~~~~~~~~'.
      FIELD-SYMBOLS <konh_line> LIKE LINE OF lt_konh.
      FIELD-SYMBOLS <konp_line> LIKE LINE OF lt_konp.
      DATA: lc_rule TYPE type_key_rule.
      READ TABLE pt_agreement INTO lc_rule INDEX 1.
    SELECT SINGLE * FROM  kona
            WHERE  vkorg   = lc_rule-vkorg
            AND    vtweg   = '10'
            AND    spart   = '10'
            AND    boart   = 'ZPS1'
            AND    botext  = lc_rule-sap_agkey.
    IF sy-subrc = 0.
       lc_updt = 'U'.
    ELSE.
      lc_updt = 'I'.
    ENDIF.
      LOOP AT pt_agreement INTO lc_rule.
        MOVE sy-tabix TO lc_str_knumh-inc_num.
        CONDENSE lc_str_knumh-inc_num NO-GAPS.
        WHILE lc_str_knumh-inc_num+7(1) = ' '.
          CONCATENATE '0' lc_str_knumh-inc_num INTO lc_str_knumh-inc_num.
          CONDENSE lc_str_knumh-inc_num NO-GAPS.
        ENDWHILE.
        CONCATENATE '$$' lc_knumh INTO lc_knumh.
        MOVE lc_str_knumh TO lc_knumh.
       MOVE c_strt_knumh TO lc_knumh.
        CLEAR: lc_konh, lc_konp, lc_komg.
        MOVE: lc_rule-vkorg    TO lc_komg-komg-vkorg,
              '10'             TO lc_komg-komg-vtweg,
              '10'             TO lc_komg-komg-spart,
              p_waers          TO lc_komg-komg-waerk,
              '1300'           TO lc_komg-komg-bukrs,
              lc_rule-lifnr    TO lc_komg-komg-lifnr,
              lc_knumh         TO lc_komg-knumh,
              lc_knumh         TO lc_konh-knumh,
              lc_knumh         TO lc_konp-knumh,
              lc_rule-datab    TO lc_konh-datab,
              lc_rule-datbi    TO lc_konh-datbi.
        CASE lc_rule-tablnam.
          WHEN 'A701'.                   "Every Agreement will have a A701 rule -
            "Therefore we acn setup the header using A701
            MOVE: 'New       '  TO lc_kona-knuma,
                  lc_rule-vkorg TO lc_kona-vkorg,
                  '10'          TO lc_kona-vtweg,
                  '10'          TO lc_kona-spart,
                  'ZPS1'        TO lc_kona-boart,
                  'C'           TO lc_kona-abtyp,
                  'V'           TO lc_kona-kappl,
                  p_waers       TO lc_kona-waers,
                  lc_rule-knuma_ag TO lc_kona-abrex,
                  'ZPS2'        TO lc_kona-kobog,
                  lc_rule-datab TO lc_kona-datab,
                  lc_rule-datbi TO lc_kona-datbi,
                  lc_rule-sap_agkey TO lc_kona-botext,
                  '1300'        TO lc_kona-bukrs,
                  'I'           TO lc_kona-updkz.
            MOVE: 'New       '  TO lc_cbasp-knuma_ag,
                  'ZPS1'        TO lc_cbasp-boart_ag,
                  p_waers       TO lc_cbasp-waers,
                  'A'           TO lc_cbasp-setl_mth,
                  'B'           TO lc_cbasp-setl_typ,
                  'A2'          TO lc_cbasp-ident,
                  'E'           TO lc_cbasp-setlm,
                  'ZPDA'        TO lc_cbasp-pargr,
                  'X'           TO lc_cbasp-npric,
                  'LF'          TO lc_cbasp-stprl,
                  lc_rule-lifnr TO lc_cbasp-stpar,
                  lc_rule-contract_rev  TO lc_cbasp-rvnum,
                  'I'           TO lc_cbasp-updkz.
            CONCATENATE: blank_agree_key
                   lc_rule-lifnr        INTO lc_konh-vakey.
            MOVE: lc_rule-lifnr TO lc_konp-lifnr.
          WHEN 'A703'.
            CONCATENATE: blank_agree_key
                         lc_rule-kunnr      INTO lc_konh-vakey.
            MOVE lc_rule-kunnr TO lc_komg-komg-kunnr.
          WHEN 'A709'.
            CONCATENATE: blank_agree_key
            lc_rule-zzprodh1  lc_rule-zzprodh2  lc_rule-zzprodh3
                   lc_rule-zzprodh4  lc_rule-zzprodh5 INTO lc_konh-vakey.
            CONCATENATE: lc_rule-zzprodh1  lc_rule-zzprodh2  lc_rule-zzprodh3
                   lc_rule-zzprodh4  lc_rule-zzprodh5 INTO lc_komg-komg-prodh.
          WHEN 'A710'.
            CONCATENATE: blank_agree_key
                lc_rule-matkl   INTO lc_konh-vakey.
            MOVE lc_rule-matkl TO lc_komg-komg-matkl.
          WHEN 'A711'.
            CONCATENATE: blank_agree_key
                 lc_rule-matnr   INTO lc_konh-vakey.
            MOVE lc_rule-matnr TO lc_komg-komg-matnr.
            IF lc_rule-kschl = 'ZPPL'.
              MOVE: 'C'              TO lc_konp-krech,
                    'CAD'              TO lc_konp-konwa.
              lc_konp-kbetr = lc_rule-net_po_price * 1.
            ENDIF.
          WHEN 'A717'.
          WHEN 'A718'.
            CONCATENATE: blank_agree_key
                 lc_rule-zzextwg INTO lc_konh-vakey.
            MOVE lc_rule-zzextwg TO lc_komg-komg-zzextwg.
         WHEN 'A719'.
           CONCATENATE: blank_agree_key
                lc_rule-werks INTO lc_konh-vakey.
           MOVE lc_rule-werks TO lc_komg-komg-werks.
         WHEN 'A721'.
           CONCATENATE: blank_agree_key
                 lc_rule-kunnr lc_rule-werks INTO lc_konh-vakey.
           MOVE: lc_rule-kunnr TO lc_konp-kunnr,
                 lc_rule-kunnr TO lc_komg-komg-kunnr.
          WHEN 'A722'.
            CONCATENATE: blank_agree_key
                         lc_rule-vkbur INTO lc_konh-vakey.
            MOVE lc_rule-vkbur TO lc_komg-komg-vkbur.
          WHEN 'A724'.
            CONCATENATE: blank_agree_key
                          lc_rule-kunnr lc_rule-vkbur INTO lc_konh-vakey.
            MOVE: lc_rule-kunnr TO lc_konp-kunnr,
                  lc_rule-kunnr TO lc_komg-komg-kunnr,
                  lc_rule-vkbur TO lc_komg-komg-vkbur.
        ENDCASE.
        MOVE: 'A'                  TO lc_konh-kvewe,
              lc_rule-tablnam+1(3) TO lc_konh-kotabnr,
              lc_rule-kappl        TO lc_konh-kappl,
              lc_rule-kschl        TO lc_konh-kschl.
        REPLACE ALL OCCURRENCES OF '~' IN lc_konh-vakey WITH ' '.
        APPEND lc_konh TO lt_konh.
        CLEAR lc_konh.
    *--- Add in the KONP.Do we need to add
        MOVE: lc_rule-kappl        TO lc_konp-kappl,
              lc_rule-kschl        TO lc_konp-kschl,
              'G'                  TO lc_konp-krech.
        IF lc_rule-kschl+3(1) = '%'.
          MOVE: 'A'              TO lc_konp-krech,
                '%'              TO lc_konp-konwa.
          lc_konp-kbetr = lc_rule-rebate_perc * 1.
        ENDIF.
        APPEND lc_konp TO lt_konp. CLEAR lc_konp.
        APPEND lc_komg TO lt_komg. CLEAR lc_komg.
      ENDLOOP.
      IF  lc_updt = 'I'.
        CALL FUNCTION '/IRM/IPCB_AGREEMENT_CREATE'
          EXPORTING
          I_MESSAGES_DISPLAY        = ' '
          I_SAVE_MESSAGES           = ' '
          I_COMMIT_WORK             = 'X'
          I_CALL_FROM_WS            = ' '
            is_kona                   = lc_kona
            is_cbasp                  = lc_cbasp
            it_cbapr                  = lt_cbapr
            it_cbadt                  = lt_cbadt
            it_cbafs                  = lt_cbafs
            it_cbacn                  = lt_cbacn
            it_cbacl                  = lt_cbacl
            it_cbtpv                  = lt_cbtpv
            it_texts                  = lt_texts
            it_cbasd                  = lt_cbasd
          IMPORTING
            es_agreement              = lc_agreement
            e_log_number              = lc_e_log_number
          TABLES
            t_messages                = lt_messages
         CHANGING
          CT_VAKE                   = lt_vake
          ct_konh                   = lt_konh
          ct_konp                   = lt_konp
          CT_KONW                   = lt_konw
          CT_KONM                   = lt_konm
           ct_komg                   = lt_komg
          CT_USER_DATA              = lt_usr_data
          EXCEPTIONS
            no_documents_to_process   = 1
            no_authorization          = 2
            creation_failed           = 3
            new_pricing_not_maitained = 4
            OTHERS                    = 5.
        IF sy-subrc <> 0.
    Implement suitable error handling here
        ELSE.
          MOVE: lc_agreement-knuma_ag TO po_agreement,
                lc_agreement-knuma_ag TO lc_kona-knuma.
        ENDIF.
        APPEND LINES OF lt_messages TO gt_messages.
      ELSE.
        MOVE-CORRESPONDING kona TO lc_kona.
      ENDIF.
      LOOP AT lt_konh ASSIGNING <konh_line>.
        MOVE lc_kona-knuma TO <konh_line>-vakey+0(10).
       move '&'           to <konh_line>-knumh+0(1).
      ENDLOOP.
      LOOP AT lt_konp ASSIGNING <konp_line>.
       MOVE lc_kona-knuma TO <konp_line>-vakey+0(10).
        move '&'           to <konh_line>-knumh+0(1).
      ENDLOOP.
      lc_kona-updkz = 'U'.
      lc_cbasp-updkz = 'U'.
      CLEAR lt_messages.
      CALL FUNCTION '/IRM/IPCB_AGREEMENT_CHANGE'
        EXPORTING
        I_MESSAGES_DISPLAY      = ' '
        I_SAVE_MESSAGES         = ' '
        I_COMMIT_WORK           = 'X'
        I_INIT_DATA             = 'X'
          is_kona                 = lc_kona
          is_cbasp                = lc_cbasp
         it_cbapr                = lt_cbapr
         it_cbadt                = lt_cbadt
         it_cbafs                = lt_cbafs
         it_cbacl                = lt_cbacl
         it_cbacn                = lt_cbacn
        IT_FIELDS               =
         it_texts                = lt_texts
       IMPORTING
         e_log_number            = lc_e_log_number
         TABLES
           t_messages              = lt_messages
        CHANGING
          cs_agreement            = lc_agreement
        CT_VAKE                 = lt_vake
          ct_konh                 = lt_konh
          ct_konp                 = lt_konp
        CT_KONW                 = lt_konw
        CT_KONM                 = lt_konm
          ct_komg                 = lt_komg
        CT_USER_DATA            = lt_usr_data
        EXCEPTIONS
          no_documents_to_process = 1
          no_authorization        = 2
          change_failed           = 3
          agreement_locked        = 4
          OTHERS                  = 5.
    IF sy-subrc <> 0.
    Implement suitable error handling here
    ENDIF.
      APPEND LINES OF lt_messages TO gt_messages.
    ENDFORM.                    " CREATE_AGREEMENT

  • How to use the function module 'HR_ES_FEATURE_BACKFIELD'

    Hi,
    How to use the function module 'HR_ES_FEATURE_BACKFIELD'?
    I need the usage from both technical as well as functional point of view.
    What is the use of this function module and technically how it is to be used to retrieve a feature for a particular employee.

    hey iam from functional side can u be little bit clear of that feature
    thanks
    sikindar

  • 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

  • How to Use the Function Module 'BAPI_BUSPROCESSND_CHANGEMULTI'

    Dear Experts,
             Can anyone Explain me how to Use the Function Module 'BAPI_BUSPROCESSND_CHANGEMULTI'.My Requirement is i want to change the Partners of the Service Order.It is Very Urgent Requirement Please Help me.
    Thanks & Regards,
    Ashok.

    Hi,
    For service order you can use FM 'BAPI_ACTIVITYCRM_CHANGEMULTI' as it is much easier to use.
    Sample code is below. You can use that:
    "fill the details of partner which is
              "to be added as main partner or in place of Interaction Agent
              wa_partner_new-ref_guid = w_guid_ref.
              wa_partner_new-ref_handle = '0000000000'.
              wa_partner_new-ref_kind = 'A'.
              wa_partner_new-kind_of_entry = wa_partner-kind_of_entry.
              wa_partner_new-ref_partner_handle = '0000'.
              wa_partner_new-ref_partner_fct = 'Z_IA'.
    "wa_partner-partner_no : New partner no.
              wa_partner_new-ref_partner_no = wa_partner-partner_no.
              wa_partner_new-ref_no_type = wa_partner-ref_no_type.
              wa_partner_new-ref_display_type = wa_partner-ref_display_type.
              wa_partner_new-display_type = 'BP'.
              wa_partner_new-no_type = 'BP'.
              wa_partner_new-partner_fct = 'Z_IA'.
    "w_partner_no : Old partner no. which is to be changed
              wa_partner_new-partner_no = w_partner_no.
              wa_partner_new-mainpartner = 'X'.
              INSERT wa_partner_new INTO TABLE it_partner_new.
              wa_partner_newx-display_type = 'X'.
              wa_partner_newx-no_type = 'X'.
              wa_partner_newx-partner_fct = 'X'.
              wa_partner_newx-partner_no = 'X'.
              wa_partner_newx-mainpartner = 'X'.
              INSERT wa_partner_newx INTO TABLE it_partner_newx.
      IF it_partner_new[] IS NOT INITIAL AND it_partner_newx[] IS NOT INITIAL.
        "maintain all changes to be done
        CALL FUNCTION 'BAPI_ACTIVITYCRM_CHANGEMULTI'
          TABLES
            partner  = it_partner_new
            partnerx = it_partner_newx.
        CLEAR : wa_guid1.
        REFRESH : it_guid1.
        wa_guid1-guid = w_guid_ref.
        APPEND wa_guid1 TO it_guid1.
        "save the changes
        CALL FUNCTION 'BAPI_ACTIVITYCRM_SAVE'
          TABLES
            objects_to_save = it_guid1.
        "commit the transaction
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      ENDIF.
    Reply fro any further help.
    Please reward points if helpful.
    Regards,
    Ashlesha

  • How to Create a Function module z_create and to track the error records?

    I want to create a function module z_create which will insert the data from the internal tables gt_model_master and gt_model  into the corresponding database custom tables y_model_master.
    Secondly if any error is encountered during the above updation, then how to track those error records ?

    HI,
    check the sy-subrc ,if it is zero the insertion is success,otherwise use 
    message class.
    if sy-subrc ne 0.
    message e052(zmessage).
    endif.
    Edited by: rakesh dhudipala on Feb 12, 2008 2:33 PM
    Edited by: rakesh dhudipala on Feb 12, 2008 2:33 PM

  • How to run the Function module Parallelly at a time.

    Hi all,
    LOOP AT ITAB.
    call function 'Z_SAMPLE'
    ENDLOOP.
    Here if ITAB is having 4 records, Function module Z_SAMPLE will be runned 4 times one by one .
    My requirement is If ITAB is having 4 record ,Function module should be runned 4 times parallely(parallel process) .
    Please tell me how i can do this  Can i run that statement 4 times by removing the loop or
    Can i Create 4 different jobs and run that jobs at a time if yes please tell me how to creat the jobs and run parallelly.
    Please suggest me the solution
    Please do ask  me if question is not clear
    Thanks in Advance
    Ajay

    Is it possible ?
    DATA : f1 TYPE string VALUE '1',
           f2 TYPE string VALUE '2',
           f3 TYPE string VALUE '3',
           f4 TYPE string VALUE '4'.
    DATA : f1o TYPE string ,
           f2o TYPE string ,
           f3o TYPE string,
           f4o TYPE string.
    PERFORM call_fm USING f1 CHANGING f1o.
    PERFORM call_fm USING f2 CHANGING f2o.
    PERFORM call_fm USING f3 CHANGING f3o.
    PERFORM call_fm USING f4 CHANGING f4o.
    WRITE f1o.
    WRITE f2o.
    WRITE f3o.
    WRITE f4o.
    *&      Form  CALL_FM
    *       text
    *      -->P_F1  text
    FORM call_fm  USING f1 CHANGING f1o.
    * FUNCTION Z_TEST_MULTI.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(A) TYPE  STRING OPTIONAL
    *"  EXPORTING
    *"     VALUE(B) TYPE  STRING
    *b = a.
    *ENDFUNCTION.
      CALL FUNCTION 'Z_TEST_MULTI'
        EXPORTING
          a = f1
        IMPORTING
          b = f1o.
    ENDFORM.                    " CALL_FM

  • I'm very new tp SAP ABAP, how to create a function module..V.URGENT

    hi folks,
    I'm very new to sap abap.
    I want to create a function module.
    the following is my requirement.
    by passing(eporting parameters to funtion module from pgm point of view) a field, i want to get(importing parameters from the funtion module, from pgm point of view) some 7 fields(of various tables).
    please also tell me how can code an inner join for tables 5 tables(a,b,c,d,e). i'm joining a on b, b on c, c on d,the problem here is that i can not join d on e as there are no common fields in d and e.
    can i join e and c or b, there are no common fields even in a and e.
    please tell me the solution as soon as possible, this very important and urgent deliverable.
    thanks in advance

    Here is link for creating function modules
    <a href="http://help.sap.com/saphelp_47x200/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/frameset.htm">Creating Function Modules</a>
    Regds
    Manohar

  • How to create RFC function module and how to call this function module

    Hi,
    i want to know step for creating RFC function module and then How to  use this function module from some other sap system.
    Thnaks,
    jigar

    Jigar,
    To implement a remote function module in ABAP, perform the following steps:
    Register the module as remotely callable in the RFC server system.
    In the function module Administration screen (transaction code SE37), set the field Can be called via REMOTE CALL. Registering a module as remote causes an RFC stub to be generated for it.
    Write the code for the function module.
    Create the destinations.....................
    Displaying, Maintaining and Testing Destinations
    To display, create or modify destinations, choose Tools ® Administration ® Administration ® Network ® RFC destinations or enter transaction code SM59.
    Remote Destinations are stored in table RFCDES. The RFCDES table describes logical destinations for remote function calls.
    It is not possible to maintain the RFCDES table directly.
    You can also access logical destinations via the Implementation Guide (IMG) by choosing Tools ® AcceleratedSAP ® Customizing ® Execute Project ® SAP Reference IMG.
    In the Implementation Guide, expand the following hierarchy structure:
    Basis
    Application Link Enabling (ALE)
    Sending and Receiving Systems
    Systems in Network
    Define Target Systems for RFC Calls
    Displaying Destinations
    The initial screen for this transaction displays a tree:
    Different connection types (i.e. partner systems or programs) are possible. For further information, see Types of Destinations.
    To display all information for a given destination, double-click it, or place the cursor on it and press F2 .
    To search for a destination, press the Find button and specify your selection. You get a list of all entries matching your selection. Place the cursor on the one you want, and press F2 or simply double-click the destination. All information for the given entry appears.
    Creating Destinations
    On the destinations overview screen (transaction code SM59), the connection types and all existing destinations are displayed in a tree structure.
    All available connection types are explained in Types of Destinations.
    To create a new RFC destination, press the Create button. A new screen is displayed with empty fields for you to fill in.
    If you want to create a new destination
    As you create a remote destination, you can specify a particular application server or a group of servers for a balanced distribution of system load.
    For details of the destination parameters, see Entering Destination Parameters.
    Changing Existing Destinations
    On the destinations overview screen (transaction code SM59), the connection types and all existing destinations are displayed in a tree structure.
    You can display all information for a given destination by double-clicking it or pressing F2 on it.
    To change an existing destination, double-click it, or place the cursor on it and press the Change button.
    For details of the destination parameters, see Entering Destination Parameters.
    Testing Destinations
    To test a destination, choose the appropriate function from the Test menu.
    Connection (also available via the Test connection pushbutton)
    Authorization (checks logon data)
    Local network (provides a list of application servers)
    You can use the CALL FUNCTION statement to call remote functions, just as you would call local function modules. However, you must include an additional DESTINATION clause to define where the function should run:
    CALL FUNCTION RemoteFunction
    DESTINATION Dest
    EXPORTING
    f1 =...
    f2 =...
    IMPORTING
    f3 =...
    TABLES
    t1 =...
    EXCEPTIONS......
    The field Dest can be either a literal or a variable: its value is a logical destination (for example, "hw1071_53") known to the local SAP System. Logical destinations are defined in the RFCDES table (or the TRFCD table in R/2 Systems) via transaction sm59 or the following menu path: Tools ® Administration, Administration ® Network ® RFC destinations. You can also access logical destinations via the Implementation Guide (IMG) by choosing Tools ® Customizing ® Enterprise IMG. In the Implementation Guide, you can then choose Cross-application components ® ALE ® Communication ® Define RFC destination.
    The remote function call concept, for example, allows you to access a function module in an R/2 System from an ABAP program in an R/3 System. If you want to read a customer record from your R/2 System’s database, create a remotely callable function module in the R/2 environment which retrieves customer records. Call this function from your R/3 System using a remote function call and listing the destination for the target R/2 System:
    Pls. reward if useful

  • How to create ENQUEUE function module for s567 table

    Hi Experts,
    Anyone Plz tell the steps how to create a ENQUEUE function module for the table s567.
    Its somewht urgent, plz help me.
    <REMOVED BY MODERATOR>
    Mohana
    Edited by: Alvaro Tejada Galindo on Mar 10, 2008 4:21 PM

    Hi,
    You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
    Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
    Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
    Technicaly:
    When you create a lock object System automatically creat two function module.
    1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
    2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
    You have to use these function module in your program.
    Hope this will give a basic idea.
    Regards
    Sudheer

  • How to findout the Function module for a particular object

    Hello friends,
       Related to my thread, there was one thread in the forum,to find out the function module for a particular object.I tried the solution provided my our experts but couldn't got the results.Thats why i am putting this thread again.
      I want to find out the function modules used for the particular object, i.e. Production order.
       solution i tried is, first go to T.C SE37, then in function module field put the object name like Production order and enter, than it will show another screen, there also put object name in function module field and than press enter, it will show all the function modules available for that object.
        So could you guys help me out to find out where i am wrong in the process of finding out the function module for a particular object.
                           Plz don't bother abt the point.Helpful answers will definitely get awarded.
                                Thanking you guys for your valuable support till now and hoping to get in future too.

    Dear
    When the problem is solved please give points too. Otherwise why people will help others, give time and share their valuable knowledge. This will build up self confidence.
    If not solved and closing, then mention the difficulties what u exactly looking for. Simpy closing is not enough because who ever is providing solution will not able to know the real problem.
    How to give points I believe u already know that and need not explain.
    I had seen many times this problem with others too. Even if the problem is totally resolved they give 2 in stead of 10.
    Edited by: BNR on Sep 21, 2008 6:10 PM

  • How to use the Function Module RH_READ_INFTY_1001...

    Hi,
    Can any one Tell me .. How to do the same functionality .. given below (select).
    Using the Function Module RH_READ_INFTY_1001...
    *reads CP (Central Person) based on BP (Business Partner)
    Select single objid (Object ID)
           from hrp1001
           into gv_sobid
           where subty eq 'B207'
           and sclas eq 'BP'
           and sobid eq  is_header-partner.
    *reads P (Person) Based on determined BP (Business Partner)
    select single sobid (ID related Object)
           from hrp1001
           into gv_sobid
           where subty eq 'B209'
           and   otype eq 'CP'
           and   objid eq gv_sobid.
    *determines UserID from IT0105 for determined personell ID
    select single usrid
           from pa0105
           into gv_usrid
           where pernr eq gv_sobid
           and   subty eq '999'.
    Reply ASAP....
    Answers will be Rewarded...

    objects-plvar = l_plvar.
                  objects-otype = 'S '.
                  objects-sobid = l_positions-objid.
                  APPEND objects.
                  CLEAR i1001_itab. REFRESH i1001_itab.
                  CALL FUNCTION 'RH_READ_INFTY_1001'
                       EXPORTING
    *                       AUTHORITY       = 'DISP'
    *                       WITH_STRU_AUTH  = 'X'
                            istat           = '1'
    *                       EXTEND          = 'X'
                            subty           = 'A008'
                            begda           = l_keyda
                            endda           = l_keyda
    *                       CONDITION       = '00000'
    *                       SORT            = 'X'
    *                       WITH_EV         = ' '
    *                       ADATA           = 'X'
                       TABLES
                            i1001           = i1001_itab
                            objects         = objects
                       EXCEPTIONS
                            nothing_found   = 1
                            wrong_condition = 2
                            OTHERS          = 3.
                  IF sy-subrc <> 0.
                    CLEAR i1001_itab. REFRESH i1001_itab.
                    CLEAR mngr_nr.
                  ELSE.
                    READ TABLE i1001_itab WITH KEY sclas = 'P'.
                    IF sy-subrc = 0.
                      mngr_nr = i1001_itab-sobid.
                    ELSE.
    THis is the sample code to use function module using this function module you can get upto HRP1001 selection for userid you need to use same select you write for PA0105

  • How to use the function module CONVERSION_FACTOR_GET?

    Hi Experts,
    I have to use convert the value of a field from units 'HL' to 'HHL'. According to me, we can use the function module CONVERSION_FACTOR_GET. However, i am not able to know how to use it?
    Can anyone explain how to use the FM, i mean what should be the importing and exporting parameter.... For recap, i need to convert HL to HHL, for example 3 HL to 0.03 HHL.
    Please help.
    Rewards for sure!
    Thanks in advance.
    Aksh

    Hi
    If it is Unit Conversion better use the following Fun modules
    UNIT_CONVERSION_SIMPLE
    MD_CONVERT_MATERIAL_UNIT
    goto SE37 first and execute them by entering some value and then use it in the code after confirming it
    Regards
    Anji

  • Regarding how to use the function module *control_form* in scripts

    HI friends,
    Can any one tell why and where do we use the function module control_form in scripts. Can you give me a small scenario how to use in scripts.

    hi satish,
    by using this function module we can pass the control
    commands to FORM THROUGH ABAP/4 PROGRAM.
    see the following example:
    TABLES: kna1.
    DATA: BEGIN OF it_kna1 OCCURS 0,
          kunnr LIKE kna1-kunnr,
          name1 LIKE kna1-name1,
          ort01 LIKE kna1-ort01,
          land1 LIKE kna1-land1,
          END OF it_kna1.
    DATA:records TYPE i,
         window TYPE i value 1.
    select-options:s_kunnr for kna1-kunnr.
    SELECT kunnr name1 ort01 land1 FROM kna1 INTO TABLE it_kna1
    where kunnr in s_kunnr.
    CALL FUNCTION 'OPEN_FORM'
      EXPORTING
        form     = 'ZSCRIPT4'
        language = sy-langu.
    LOOP AT it_kna1.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element  = 'ELE1'
          function = 'SET'
          type     = 'BODY'
          window   = 'MAIN'.
      DESCRIBE TABLE it_kna1 LINES records.
      IF window lt records.
        window = window + 1.
      CALL FUNCTION 'CONTROL_FORM'
       EXPORTING
            command         = 'NEW-WINDOW'
    EXCEPTIONS
      UNOPENED        = 1
    UNSTARTED       = 2
    OTHERS          = 3
      ENDIF.
    ENDLOOP.
    CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
      RESULT                         =
      RDI_RESULT                     =
    TABLES
      OTFDATA                        =
    EXCEPTIONS
      UNOPENED                       = 1
      BAD_PAGEFORMAT_FOR_PRINT       = 2
      SEND_ERROR                     = 3
      SPOOL_ERROR                    = 4
      CODEPAGE                       = 5
      OTHERS                         = 6
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    thanks,
    raji

Maybe you are looking for