Partner function update using CRM_PARTNER_MAINTAIN_SINGLE_OW

Hi Experts,
Can some one pls help me with some working code/sample to update a partner function value in CRM Order. I tried the below code but it doesnt seems to be working.
Appreciate your help on this.
    call function 'CRM_ORDER_READ'
      exporting
        it_header_guid       = lt_guid
        iv_mode              = 'C'
      importing
        et_orderadm_h        = it_orderadm_h
      et_sales             = it_sales
      et_orderadm_i        = it_orderadm_i
      et_orgman            = it_orgman
      et_shipping          = it_shipping
      et_partner           = it_partner
      exceptions
        document_not_found   = 1
        error_occurred       = 2
        document_locked      = 3
        no_change_authority  = 4
        no_display_authority = 5
        no_change_allowed    = 6
        others               = 7.
    if sy-subrc <> 0.
Implement suitable error handling here
    endif.
      clear wa_orderadm_h.
      read table it_orderadm_h into wa_orderadm_h index 1.
     lv_ref_guid = it_orderadm_h-guid.
      call function 'CRM_PARTNER_GET_CONTROL_INF_OW'
        exporting
          iv_ref_guid          = wa_orderadm_h-guid
          iv_ref_kind          = 'A'
        importing
          es_partner_control   = ls_partner_control
        exceptions
          determination_failed = 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.
      move-corresponding ls_partner_control to es_partner_control.
Common fields for both create and change *****
      import lv_qplant to lv_werks2 from memory id 'QUOTA_PLANT'.
      select single partner_no
        from crmm_locmap
        into w_partner
       where ext_locno = lv_werks2. "wa_quota_so_items_return-werks2.
Partner_com parameter
      ls_partner_com-ref_guid = wa_orderadm_h-guid.
      ls_partner_com-ref_kind = 'A'.
      ls_partner_com-partner_no = w_partner.
      ls_partner_com-display_type = 'BP'.
      ls_partner_com-no_type = 'BP'.
Find whether create or change is required
      read table gt_partner into wa_partner with key partner_fct = '00000035' ref_kind ='A'.
      if sy-subrc eq 0.
        ls_partner_com-kind_of_entry = 'C'.
        ls_partner_com-partner_fct = '00000035'.
        ls_ip_fields-fieldname = 'DISPLAY_TYPE'.
        append ls_ip_fields to lt_ip_fields.
        ls_ip_fields-fieldname = 'KIND_OF_ENTRY'.
        append ls_ip_fields to lt_ip_fields.
        ls_ip_fields-fieldname = 'NO_TYPE'.
        append ls_ip_fields to lt_ip_fields.
        ls_ip_fields-fieldname = 'PARTNER_FCT'.
        append ls_ip_fields to lt_ip_fields.
        ls_ip_fields-fieldname = 'PARTNER_NO'.
        append ls_ip_fields to lt_ip_fields.
        call function 'CRM_PARTNER_MAINTAIN_SINGLE_OW'
          exporting
            iv_ref_guid           = wa_orderadm_h-guid
            iv_ref_kind           = 'A'
            is_partner_com        = ls_partner_com
            iv_populate_mode      = 'X'
            iv_check_partner_only = ' '
            is_partner_control    = es_partner_control
            iv_external_call      = 'X'
          changing
            ct_input_field_names  = lt_ip_fields
          exceptions
            error_occurred        = 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.

Reply to an old post but still can be helpful to someone in need
*& Report  ZUPDATE_TRANSACTION_PF
REPORT  zupdate_transaction_pf.
*======================================================================*
*  Variable declaration for ALV                                        *
*======================================================================*
TYPE-POOLS: slis.     " Type pool required for ALV
TYPES: BEGIN OF gs_output,
          extid             TYPE ib_extid,
          prodid            TYPE comt_product_id,
          msg_type          TYPE bapi_mtype,
          message           TYPE bapi_msg,
          layout            TYPE slis_t_specialcol_alv,
       END OF gs_output.
DATA: gt_output             TYPE TABLE OF gs_output,
      gs_output             TYPE gs_output,
      gt_fieldcat           TYPE slis_t_fieldcat_alv,
      gt_color_green        TYPE slis_t_specialcol_alv,
      gt_color_red          TYPE slis_t_specialcol_alv,
      gt_color_yellow       TYPE slis_t_specialcol_alv,
      gt_layout             TYPE slis_layout_alv,
      lt_header_guid        TYPE crmt_object_guid_tab,
      ls_header_guid        TYPE crmt_object_guid,
      lt_partner            TYPE crmt_partner_external_wrkt,
      ls_partner            TYPE crmt_partner_external_wrk,
      lt_guid               TYPE crmt_object_guid_tab,
      lt_guid_single        TYPE crmt_object_guid_tab,
      lt_req_obj            TYPE crmt_object_name_tab,
      ls_req_obj            TYPE crmt_object_name,
      lt_partner_update     TYPE crmt_partner_comt,
      lt_partner_com        TYPE crmt_partner_comt,
      ls_partner_com        TYPE crmt_partner_com,
      lt_input_fields       TYPE crmt_input_field_names_tab,
      ls_input_fields       TYPE crmt_input_field_names,
      lv_partner_fct        TYPE crmt_partner_fct,
      lv_partner_no         TYPE bu_partner,
      lv_trans_no           TYPE crmt_object_id_db,
      lt_return             TYPE STANDARD TABLE OF ddshretval,
      ls_return             LIKE LINE OF lt_return,
      lv_guid               TYPE crmt_object_guid.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE block1.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (36) forpf.
PARAMETERS: p_pf TYPE comt_partner_fct OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (36) frombp.
PARAMETERS: p_frombp TYPE but000-partner  OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (36) tobp.
PARAMETERS: p_tobp TYPE but000-partner OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (36) fortrans.
SELECT-OPTIONS: p_trans FOR lv_trans_no MATCHCODE OBJECT crm_order_object_id.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE block2.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (36) fortest.
PARAMETERS: p_test AS CHECKBOX.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b2.
INITIALIZATION.
  fortrans = 'Transaction Number'.
  forpf = 'Partner Function'.
  frombp = 'From Business Partner'.
  tobp = 'To Business Partner'.
  fortest = 'Test Run, Check Only'.
*======================================================================*
*  AT SELECTION-SCREEN                                                 *
*======================================================================*
AT SELECTION-SCREEN.
  FIELD-SYMBOLS:
    <sscrfields> TYPE sscrfields.
  DATA:
  lv_answer   TYPE char1,
  lt_options  TYPE TABLE OF rfc_db_opt,
  lt_fields   TYPE TABLE OF rfc_db_fld,
  lt_func_det TYPE TABLE OF tab512.
  CHECK sy-ucomm EQ 'ONLI'.
AT SELECTION-SCREEN ON p_trans.
  CHECK sy-ucomm EQ 'ONLI' OR sy-ucomm EQ 'SJOB'.
  IF p_trans IS INITIAL.
    MESSAGE e398(00) WITH 'Please enter the transaction numbers'.
  ENDIF.
AT SELECTION-SCREEN ON p_pf.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_pf.
  CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
    EXPORTING
      tabname           = 'CRMC_PARTNER_FT'
      fieldname         = 'PARTNER_FCT'
    TABLES
      return_tab        = lt_return[]
    EXCEPTIONS
      field_not_found   = 1
      no_help_for_field = 2
      inconsistent_help = 3
      no_values_found   = 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.
  IF lt_return[] IS NOT INITIAL.
    READ TABLE lt_return[] INTO ls_return INDEX 1.
    p_pf = ls_return-fieldval.
  ENDIF.
  CHECK sy-ucomm EQ 'ONLI' OR sy-ucomm EQ 'SJOB'.
  IF p_pf IS INITIAL.
    MESSAGE e398(00) WITH 'Please enter the partner function'.
  ENDIF.
AT SELECTION-SCREEN ON p_frombp.
  CHECK sy-ucomm EQ 'ONLI' OR sy-ucomm EQ 'SJOB'.
  IF p_frombp IS INITIAL.
    MESSAGE e398(00) WITH 'Please enter the business partner id to be changed'.
  ENDIF.
AT SELECTION-SCREEN ON p_tobp.
  CHECK sy-ucomm EQ 'ONLI' OR sy-ucomm EQ 'SJOB'.
  IF p_tobp IS INITIAL.
    MESSAGE e398(00) WITH 'Please enter the new business partner id'.
  ENDIF.
*======================================================================*
*  START-OF-SELECTION                                                  *
*======================================================================*
START-OF-SELECTION.
  PERFORM init_alv_col_color.
  PERFORM update_transactions.
END-OF-SELECTION.
  PERFORM create_report.
*&      Form  create_fieldcat
*       text
FORM create_fieldcat.
  PERFORM add_fld USING: 'EXTID'     'Order ID'        '20' 1,
                         'PRODID'    'Product ID'         '20' 2,
                         'MSG_TYPE'  'MSG Type'            '8'  9,
                         'MESSAGE'   'Message Description' '100' 10.
ENDFORM.                    "CREATE_FIELDCAT
*&      Form  add_fld
*       text
*      -->P_FIELDNAME  text
*      -->P_SELTEXT_M  text
*      -->P_OUTPUTLEN  text
*      -->P_COL_POS    text
FORM add_fld USING p_fieldname
                   p_seltext_m
                   p_outputlen
                   p_col_pos.
  DATA: ls_fieldcat TYPE slis_fieldcat_alv.
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = p_fieldname.
  ls_fieldcat-ref_fieldname = p_fieldname.
  ls_fieldcat-seltext_m     = p_seltext_m.
  ls_fieldcat-outputlen     = p_outputlen.
  ls_fieldcat-col_pos       = p_col_pos.
  APPEND ls_fieldcat TO gt_fieldcat.
ENDFORM.                    "add_fld
*&      Form  create_report
*       text
FORM create_report.
  CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
      text = 'Creating output ...'.
* Get the field headers into an internal table
  PERFORM create_fieldcat.
  gt_layout-coltab_fieldname = 'LAYOUT'.
  gt_layout-colwidth_optimize = 'X'.
  gt_layout-zebra = ' '.
* Call ABAP/4 Grid Viewer
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_top_of_page = 'TOP-OF-PAGE'
      i_callback_program     = sy-repid
      it_fieldcat            = gt_fieldcat[]
      is_layout              = gt_layout
    TABLES
      t_outtab               = gt_output  " it_sort = gt_sort
    EXCEPTIONS
      program_error          = 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.                    " create_report
*&      Form  init_alv_col_color
*       text
FORM init_alv_col_color.
* Red ALV column
  PERFORM add_field_color USING gt_color_red 'MSG_TYPE' '6' '1' '1'.
  PERFORM add_field_color USING gt_color_red 'MESSAGE' '6' '1' '1'.
* Green ALV column
  PERFORM add_field_color USING gt_color_green 'MSG_TYPE' '5' '1' '1'.
  PERFORM add_field_color USING gt_color_green 'MESSAGE' '5' '1' '1'.
* Yellow ALV column
  PERFORM add_field_color USING gt_color_yellow 'MSG_TYPE' '3' '1' '1'.
  PERFORM add_field_color USING gt_color_yellow 'MESSAGE' '3' '1' '1'.
ENDFORM.                    "init_alv_col_color
*&      Form  add_field_color
*       text
*      -->PT_COLOR   text
*      -->FIELDNAME  text
*      -->COL        text
*      -->INT        text
*      -->INV        text
FORM add_field_color USING pt_color TYPE slis_t_specialcol_alv
                           fieldname col int inv.
  DATA: ls_color TYPE slis_specialcol_alv.
  ls_color-fieldname = fieldname.
  ls_color-color-col = col.
  ls_color-color-int = int.
  ls_color-color-inv = inv.
  APPEND ls_color TO pt_color.
ENDFORM.                    "add_field_color
* Form  TOP-OF-PAGE                                                 *
* ALV Report Header                                                 *
FORM top-of-page.
*ALV Header declarations
  DATA: t_header TYPE slis_t_listheader,
        wa_header TYPE slis_listheader,
        t_line LIKE wa_header-info,
        ld_lines TYPE i,
        ld_linesc(10) TYPE c.
* Title
  wa_header-typ  = 'H'.
  wa_header-info = 'Data Migration'.
  APPEND wa_header TO t_header.
  CLEAR wa_header.
* Date
  wa_header-typ  = 'S'.
  wa_header-key = 'Date: '.
  CONCATENATE  sy-datum+6(2) '.'
               sy-datum+4(2) '.'
               sy-datum(4) INTO wa_header-info.   "todays date
  APPEND wa_header TO t_header.
  CLEAR: wa_header.
* Time
  wa_header-typ  = 'S'.
  wa_header-key  = 'Time: '.
  CONCATENATE  sy-uzeit(2) ':'
               sy-uzeit+2(2) ':'
               sy-uzeit+4(2) INTO wa_header-info.   "time
  APPEND wa_header TO t_header.
  CLEAR: wa_header.
* File Path
  wa_header-typ  = 'S'.
  wa_header-key  = 'File Path: '.
  wa_header-info = ''.
  APPEND wa_header TO t_header.
  CLEAR: wa_header.
* Test Mode
  wa_header-typ  = 'S'.
  wa_header-key  = 'Test Mode: '.
  IF p_test = 'X'.
    wa_header-info = 'Yes'.
  ENDIF.
  APPEND wa_header TO t_header.
  CLEAR: wa_header.
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = t_header.
ENDFORM.                    "top-of-page
*&      Form  UPDATE_TRANSACTIONS
*       text
*  -->  p1        text
*  <--  p2        text
FORM update_transactions .
  SELECT guid INTO TABLE lt_header_guid FROM crmd_orderadm_h WHERE object_id IN p_trans.
  IF sy-subrc EQ 0.
    LOOP AT lt_header_guid INTO ls_header_guid.
      CLEAR: lt_guid, lt_req_obj, lt_partner, lt_input_fields.
      ls_req_obj = 'PARTNER'.
      APPEND ls_req_obj TO lt_req_obj.
      APPEND ls_header_guid TO lt_guid.
      CALL FUNCTION 'CRM_ORDER_READ'
        EXPORTING
          it_header_guid       = lt_guid
          it_requested_objects = lt_req_obj
        IMPORTING
          et_partner           = lt_partner
        EXCEPTIONS
          document_not_found   = 1
          error_occurred       = 2
          document_locked      = 3
          no_change_authority  = 4
          no_display_authority = 5
          no_change_allowed    = 6
          OTHERS               = 7.
      lv_partner_fct = p_pf.
      lv_partner_no = p_frombp.
      SHIFT p_frombp LEFT DELETING LEADING '0'.
      READ TABLE lt_partner INTO ls_partner WITH KEY partner_fct = p_pf partner_no = p_frombp.
      IF sy-subrc EQ 0.
        LOOP AT lt_partner INTO ls_partner WHERE partner_fct = p_pf AND partner_no = p_frombp.
          lv_partner_no = p_tobp.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = lv_partner_no
            IMPORTING
              output = lv_partner_no.
          REFRESH lt_input_fields.
          CLEAR   ls_partner_com.
          ls_partner_com-ref_guid     = ls_partner-ref_guid.
          ls_partner_com-ref_kind     = ls_partner-ref_kind.
          ls_partner_com-ref_partner_handle = ls_partner-ref_partner_handle.
          ls_partner_com-kind_of_entry = 'C'.
          ls_partner_com-partner_fct  = ls_partner-partner_fct.
          ls_partner_com-partner_no   = lv_partner_no.
          ls_partner_com-display_type = 'BP'.
          ls_partner_com-no_type      = 'BP'.
          ls_partner_com-ref_partner_no = ls_partner-ref_partner_no.
          ls_partner_com-ref_partner_fct = ls_partner-ref_partner_fct.
          ls_partner_com-ref_no_type     

Similar Messages

  • Partner function updation

    hi,
    There is a BDC program for creating an outbound delivery.
    it has to update the partner function field and few other fields. it works fine in sap and the shipment is complete.
    But in the third party system the shipment is not complete.
    the log shows an error message in partner function updation.
    The partner fucntion used is 'SP' - Forwarding agent.
    sy-subrc for the call transaction statement is coming as 1001.
    Can anyone suggest me where the problem can be.

    the screen where you enter partner involves Tablecontrol, so you need to take care of the tablecontrol. that is the reason it is giving the error.
    Run it foreground mode, and see how it behaving at that particular partners screen.
    I suspect it is not identifying the Tablecontrol fields where you insert the partner. it is because of your coding, you didn't handle the table control properly...

  • Partner Function Upload using BAPI function BAPIBUSISM007_CREATEFROMDATA

    Hi Guys,
    I can able to create Business Partner in SAP using BAPI function module BAPIBUSISM007_CREATEFROMDATA but i don't able to upload partner function (i.e. It will come under Sales Area)  using this BAPI. I don't want to go for BDC method.Is there any function modules. Is there any function modules or BAPI to upload partner function. Please suggest me.
    Thanks in Advance.
    Regards,
    Anil.

    Dear Anil,
    Few days back even i faced similar problem to upload partner function through BAPI.
    Later i created LSMW for XD02 and uploaded partner functions for those BPs.
    You can try the same.
    Regards,
    Rajesh

  • BAPI_EQUI_CHANGE - Update Partner Function

    Hello,
    We are trying to update equipment partner function by using BAPI_EQUI_CHANGE, but its not happening.
    Please provide your valuable inputs on this.
    Thanks,
    Amit.

    Hi,
    I think these will work for your scenario,
    BAPI_BPCONTACT_CHANGE
    SD_SALES_PARTNER_MAINTAIN.
    Regards,
    Ravi shankar

  • Send Invoice by email using email address of partner function

    Hi everybody,
    I am facing a problem with sending invoices by email. In particular I have created in customizing a new partner function of type contact person, namely "email address recipient". This partner function is used to get the correct email address which is different from the one stored in customer master data.
    The problem is that when i print the messagge, the email address used is exactly the one of the customer master data and not the one stored in the partner function "email address recipient".
    Example:
    customer xxx email address yyy,
    for xxx it is defined a partner function email address recipient zzz with email jjj.
    The invoice message is always sent to yyy.
    Do you have any suggestions to solve this issue?
    Thanks,

    Issue caused by custom program.

  • Partner function upload-lsmw

    Dear Experts,
    how to upload partner functions by using LSMW. I developed LSMW and if i go to partner function tab there is only one partner function field is available I need to upload 4 partner functions. Can any one help me out in this regard.
    regards,
    siva

    Hello Sivasai Myneni,
    Demo Example 1
    LSMW to Update Customer Master Records with Transaction Recording
    Call Legacy System Migration Workbench by entering transaction code LSMW. Every conversion task is grouped together as
    Project / Subproject / Object structure. Create a Project called LSMW_DEMO and a Subproject as CUSTOMERS and Object as
    CUST_obj as shown in Figure 1.
    Figure 1 Conversion Task with Project, Subproject and Object
    The main screen of LSMW provides wizard-like step-by-step tasks, as shown in Figure 2. To complete your data conversion, you
    need to execute these steps in sequence. Once a step is executed, the cursor is automatically positioned to the next step.
    Note that these steps may look different depending upon your Personal menu settings. You could make step numbers visible by
    ‘Numbers on’ icon or hidden by ‘Numbers off’ icon. You can execute a step by double-clicking on the row. Toggle icon
    ‘Doubleclick=Display’ or ‘Doubleclick=Edit’, makes the step in ‘display’ mode or ‘change’ mode.
    Figure 2 LSMW Wizard – initial screen
    Step 1: Maintain Object attributes
    In this example, you will be updating the customer master records with the help of recording a transaction (XD02). Choose radio
    button Batch Input Recording and click on the recording overview icon to record the R/3 transaction. Enter the Recording name as
    XD02_REC, the description as Customer Master Updates Recording, and the transaction code as XD02.
    Figure 3 Object type ‘Transaction Recording’
    The system calls the transaction code XD02 and prompts you to complete the Change
    Customer transaction, as shown in Figure 4. Enter the key customer information (I entered customer number 1000, sales
    organization 1000, distribution channel 01, and division 00) and choose ‘Sales’ view within ‘Sales area data’. Make changes to
    these three fields (I entered, sales office 1010, sales group 110, and customer group 01) and save the transaction.
    Figure 4 Transaction recording for Transaction Code ‘XD02’
    Once the transaction is completed, R/3 records the flow of screens and fields and saves the information, as shown in Figure 5.
    Figure 5 Transaction recording overview
    Note that the fields are populated with default values. The values you entered when you recorded the transaction are set by
    default.
    Note that if you have more fields in the recording than needed, you can remove them by clicking ‘Remove Screen field’ icon.
    Observe that the transaction-recording process stores field names in a technical format. By pressing the F1 key on individual
    screen fields and then pressing the F9 key, the system displays technical names. You then can replace the technical names with
    descriptive names. Double-click on the field RF02D-KUNNR and enter the name as KUNNR and the description as Customer
    Account Number and remove the default value. (See Figure 6.)
    Figure 6 Field attributes
    Similarly, double-click on all other fields with default values and make appropriate changes. Once you have made changes, the
    recording overview screen looks like what you see in Figure 7.
    Figure 7 Transaction Recording Overview – with screen field attributes
    Save your changes. When you go back to the initial screen, you will see that the initial screen steps have changed. Since you want
    to import data via the BDC method, the Direct Input and IDoc-related steps are hidden, as they are not relevant.
    Step 2. Maintain Source Structures
    Give a name and a description to the source structure (Figure 8).
    Figure 8 Source Structure
    Step 3. Maintain Source Fields
    In this step, you need to list what fields are present in the source structure. The easiest way is to click on ‘Table Maintenance’ icon
    to enter Fieldname, Type and Length for each field as shown in Figure 9.
    Figure 9 Source fields of source Structure
    Note that your input file will have four fields as key fields and you need to update three fields in the system.
    Step 4: Maintain Structure Relations
    Execute a step to ‘Maintain Structure Relations’. (See Figure 10.) Since, there is only one Source and Target Structure, the
    relationship is defaulted automatically.
    Figure 10 Structure Relation
    Step 5: Maintain field mapping and conversion rules
    Field RF02D-D0310 represents that you chose ‘Sales view’ for the customer Master screen accordingly its value should be set to
    X. Keep your cursor on field RF02D-D0310 and click on Constant rule icon to choose the constant value of ‘X’.
    If your source file already has the field value, you choose rule ‘Source Field’.
    Keep cursor on field ‘KUNNR’ and click on ‘Assign Source field’ icon to choose source field CUSTOMER from structure XD02S as
    shown in Figure 11.
    Figure 11 Assign source fields
    Similarly, assign ‘Source Field’ rules to the remaining fields.
    Once all the fields are mapped, you should have an overview screen as shown in Figure 12.
    Figure 12 Field mapping and Conversion rules overview
    Step 6: Maintain fixed values, translations, user-defined routines
    You can also maintain re-usable translations and user-defined routines, which can be used across conversion tasks. In this case,
    that step is not required.
    Step 7: Specify files
    In this step, we define how the layout of the input file is. The input file is a [Tab] delimited with the first row as field names. It is
    present on my PC (local drive) as C:\XD02.txt. (See Figure 13.)
    Figure 13 File attributes
    Create an Excel file (Figure 14) with your data and save it as a Tab-delimited text file on your local drive (C:\) and name it XD02.
    txt.
    Figure 14 Source data in Excel file (saved as Tab delimited file)
    Step 8: Assign files
    Execute step ‘Assign Files’ (Figure 15) and the system automatically defaults the filename to the source structure.
    Figure 15 Assign file to Source Structure
    Step 9: Read data
    In this step, LSMW reads the data (Figure 16) from the source file (from your PC’s local drive). You have the option to read only
    selected rows and convert data values to Internal format.
    Figure 16 Read Data
    Step 10: Display read data
    This step (Figure 17) is optional. If required, you can review the field contents for the rows of data read.
    Figure 17 Display Read Data
    Step 11: Convert data
    This is the step that actually converts the source data (in source format) to a target format. Based on the conversion rules defined,
    source fields are mapped to target fields.
    Step 12: Display Converted data
    Again this is an optional step to view how the source data is converted to internal SAP format (Figure 18).
    Figure 18 Display Converted Data
    Step 13: Create batch input session
    Once the source data is converted in an internal format, you can create a batch session to process updates (Figure 19).
    Figure 19 Create Batch Input Session
    Step 14: Run Batch Input Session
    You can execute the BDC session by Run Batch input session. Executing a batch input session is a standard SM35 transaction for
    managing BDC sessions. Once you have successfully executed the batch input session, the customer master records are updated in
    the system. You can confirm this by viewing the customer master records (XD03).
    Note! Browsing thru these 14 steps, you may get a feeling that this is a very lengthy and time-consuming activity. However, for
    the purposes of demonstration, I have made it detailed. Although it looks lengthy, actually it takes hardly few hours from start-to-
    finish! After playing around with few simple LSMW scripts, you will find it so easy to change and create more complex ones.
    Demo Example 2
    LSMW to Update Customer Master Records with Standard Object
    As an alternative to using ‘Transaction Recording’, you could also use a standard SAP object to update Customer Master Records.
    Business Object ‘0050’ is already pre-defined in the system with standard Batch Input Interface Program ‘RFBIDE00’.
    Create an Object CUST_OBJ within Project as LSMW_DEMO and Subproject as CUSTOMERS as shown in Figure 20.
    Figure 20 LSMW Object with Standard SAP Object
    Note! For the Demo example 2, I will list only those steps that are different from the first demo example.
    Step 1: Maintain Object attributes
    You will be updating the customer master records with the help of Standard Batch Input; therefore, choose radio-button Standard
    Batch/Direct Input as shown in Figure 21. Enter Object ‘0050’ for Customer Master records and default method ‘0000’ and click
    on Save.
    Figure 21 Standard Batch/Direct Input Object Attributes
    Step 4: Maintain Structure Relations
    Sales view of Customer Master is stored in table KNVV. Accordingly, you need to update structure BKNVV. However, in addition,
    the Standard Object ‘0050’ also requires updates to BGR00, BKN00 and BKNA1 structures. (If you do not maintain Structure
    relations for mandatory entries, you might get a message such as ‘Target structure BKNA1 needs a relation to a source structure’.)
    Even though you don’t want to update any fields in these structures, you need to create a relationship with source structures. In
    all, you need to create relationship for four target structures.
    Create relationship between source structures XD02S with these target structures with icon ‘Create Relationship’ .
    Keep Cursor on these four target structures and click on icon ‘Create Relation’ and structure relations are maintained as shown in
    Figure 22.
    Figure 22 Structure Relation
    Step 5: Maintain field mapping and conversion rules
    – Keep your cursor on ‘TCODE’ field and click on ‘Insert Rule’ icon
    Figure 23 LSMW Conversion Rules
    Choose radio button ‘Constant’ (Figure 23) to enter value ‘XD02’ transaction code.
    – Keep your cursor on field ‘KUNNR’ and click on ‘Assign source field’ icon
    Choose source field ‘Customer’ from source structure ‘XD02S’. (See Figure 24.)
    Figure 24 Assign Source fields
    – Similarly, choose source fields for Sales Organization, Distribution Channel, and Division. (See Figure 25.)
    Figure 25 Field Mapping and Conversion Rules
    – Scroll down to structure BKNVV fields and assign source fields to three fields Sales Office, Sales Group, and Customer Group
    (Figure 26).
    Figure 26 Field Mapping and Conversion Rules
    Save and go back to main screen.
    Step 12: Display Converted data
    When you convert data, LSMW automatically converts into the appropriate structure layouts, as required by Standard program
    (RFBIDE00). (See Figure 27).
    Figure 27 Converted data into multiple structures
    Note that if you had only one record in source file, the converted file has four records.
    Earlier, creating this input file, so that the standard interface program can read it, was a big nightmare, the primary reason being
    that it could have multiple record layouts. Even for a simple conversion with one input record, you would have to create this
    complex file with many record layouts. The advantage of LSMW is that it prepares these multi-layout files automatically.
    Step 13: Create batch input session
    Once source data is converted in internal format, you can create a BDC session to process the updates (Figures 28 and 29).
    Figure 28 Create BDC Session
    Figure 29 BDC Session ‘CUST_OBJ’ created
    Regards
    AK

  • Sales order list by Partner Function "Customer Contact"

    Hi, I can see I can get a list of sales orders out of SAP based on Customer, but I want to obtain the same list for the Partner Function "Customer Contact". Any idea how to do this?
    Regards

    Hi,
    You can get a list of sales order by any type of partner, by making the configuration / customizing changes.
    This since you can select the partner function to use in transaction VA05.
    In SPRO there is a function for reports (sorry if I'm wrong on that), where you need to maintain the index per function (either inquiry, sales order, delivery or billing document) and the partner function (sold-to, ship-to, etc).
    Once the customizing change has been made you might have to execute a report to update the appropriate indexes. I believe the help function in the customizing transaction tells you which report to execute (RVV50 IB or something in that nature).
    Regards,
    Jan Pel

  • RE:Business partner functions in customer Master creation

    Do we need to send the Business partner functions while creating record in R3 thru MDM.
    For any account group i pass the Idoc is expecting all Business partner functions to be defined for the account group to which am trying to create Customer.(As SH,BP,PY..)
    Can anyone please explain me in brief the Business partner function -Problem in my scenerio............................Concept of  Business Partner function while creating Customer.

    In ECC partner functions are used when you have multiple addresses for the same customer.  The partner function links those address records together.  You could have multiple unique customer numbers on the KNA1 table, but in the KNVVP table (partner functions) you maintain the linkage between the main table records. 
    Partner functions are not recommended in MDM.  These are generally not considered to be "enterprise level attributes" and therefore shouldn't reside in your customer repository in a central create scenario.  Additionally, some of the complexity required to model partner functions can't be modeled in MDM at this time.  When 7.1 comes out, there is a new data type called "tuples" which supports deeply nested structures, and therefore you could model a true partner function table inside the sales area table.

  • How can I add customer partner function entries in LSMW?

    I am using SAP ECC 6.0 with best practices installed. I am able to create sold-to customers using the batch input program RFBIDE00. 
    When I try to add partner function entries using structure BKNVP, it appears that the partner ID stored in KTONR is not populating SAPMF02D screen 324 after it is entered on screen 2324. I receive a “Data is incomplete; check” error.  I could not find an SAP note or other solution to correct this problem. 
    While searching for a solution, I found a few recommendations to use the IDOC message DEBMAS to create the partners function entries instead of batch input.  When I try to use this approach, I am receiving an error “Deletion is not allowed: SP is mandatory function”.  I was trying to add an SH (WE Ship-To) at the time. I found a reference that explained that all partners were replaced when this IDOC message is used.  It further explained that this should work if all partner references were included in the message.  This approach did not work either. I still receive this error if I omit or include an SP (AG Sold-To) record.
    Does anyone have a solution to either problem or another approach?

    Hi
       You can use LSMW :-
    1) Create a project , sub project and an object.
    2) execute it from 1 st screen to enter the object.
    3) You will find proces steps.
    4) In Maintain Object Attributes  choose Program Name RFBIDE00.
    or I-DOC or the way you want the input to be.
    5) You can proceed from there following the instruction..

  • Confusion on partner function of ALE process

    Hi experts,
    Now I am developing the ALE for message type ORDERS in inbounding process for testing purpose. Our customer is running their business in SAP and her company code is 6000 in her SAP system, and our company is vendor in her system, the vendor number is 1100. She create a purchase order and run the transaction code ME9F then the IDOC will send to our SAP system, and then the sales order is created in our system. Actually the whole process is OK. But I am really confused by the partner function setting and sales area setting in VOE4 and VOE2.
    In VOE4, the setting is below:
    Customer          Ext.Function         Name                            Exnternal partner          Int.no
    6000                 SP                       Sold-to party                  6000                            6000
    6000                 BP                       Bill-to party                    6000                            6000
    6000                 PY                       Payer                            6000                            6000
    6000                 SP                       Ship-to Party                  6000                            6000
    In VOE2, the setting just like below:
    Customer       Vendor number     Sorg.                   Dchl              Dv             Saty
    6000              0000001100          1000                   12                 00              OR
    We had to create a customer number 6000 in order to make the ALE process smoothly. So I just want to know:
    1) We really need to make our customer number same as company code of customer in her SAP system if we use ALE ??
    2) If answer of 1) is yes, then in our production system, the customer numbers are different from their company codes, what and how do you suggest to mapping the is relationship?? Use a user-exit in IDOC??
    3) if answer of 1) is no, how can we make the ALE go next smothly??
    Can any one give me a suggestion on above??? Thanks in advance.
    Joe
    Edited by: Joe.GR Chen on Jun 19, 2009 11:23 AM

    hi,
    to add partner function sales employee follow these steps:
    1. img>S & D>basic functions>go to partner determination screen and select customer master and select your partner proceedure.
    2. now double click on partners in partner proceedure and add partner function SE using new entries and save.
    3. now assign the partner function to you account group and save
    to create a sales employee goto t code PAL1 and create sales representative.
    to add sales rep to your customer master goto your customer master using XD02 and in sales area tab goto partner tab and add the partner function SE and the sales rep number and save
    regards,
    krishna prasad

  • Partner function....of Sales employee..

    Hi, i want to create a partner function of sales employee in my customer master. there is no HR role in the organinazion...how will i go for it? The requirement is, that partner function has to flow in the order document as well. Can anyone plz tell me the process for the same? i am on client's site..
    Regards.
    amit.

    hi,
    to add partner function sales employee follow these steps:
    1. img>S & D>basic functions>go to partner determination screen and select customer master and select your partner proceedure.
    2. now double click on partners in partner proceedure and add partner function SE using new entries and save.
    3. now assign the partner function to you account group and save
    to create a sales employee goto t code PAL1 and create sales representative.
    to add sales rep to your customer master goto your customer master using XD02 and in sales area tab goto partner tab and add the partner function SE and the sales rep number and save
    regards,
    krishna prasad

  • What is difference between partner function & Vendor subrange

    Hi Can anybody tell What is difference between partner function & Vendor subrange?
    Amit

    Hi,
    Vendor subrange is a way to group materials of a vendor after certain criteria.
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/e2/f3333956bd9f05e10000000a11402f/frameset.htm
    Partner functions are used to connect vendors to each other in several ways.
    regards, Paul.

  • Update partner function in KNVP table using FM sd_customer-maintain_all

    Hi All,
    I have to update Partner Function ‘PARVW’  in KNVP table using FM sd_customer_maintain_all.
    I had already created a BDC program for updating which is running successfully.
    But  my requirement is to create a BAPI using FM customermaintain_all.
    Ex:  Tcode VD02
              KUNNR          PARVW             KUNN2
    Old data      123          Z1          70006666
              123          Z2          70007777
    Req. output      123          Z1          70006666
              123          Z1          70007777
    PARVW ‘Z2’  should not exist after updation.
    When updating, I am getting the error message to my inbox as
    “ Error Info...   F2 802: System error in table KNVP ”
    The above error is triggered while committing work after execution of  ‘SD_CUSTOMER_MAINTAIN_ALL’.
    The options I tried while looping at internal table containing kunnr, parvw & kunn2
    CALL FUNCTION 'SD_CUSTOMER_MAINTAIN_ALL'
    EXPORTING
        I_KNA1                              = w_kna1
      I_KNB1                              =
        I_KNVV                              = w_knvv
      I_BAPIADDR1                         =
      I_BAPIADDR2                         =
      I_MAINTAIN_ADDRESS_BY_KNA1          = ' '
      I_KNB1_REFERENCE                    = ' '
      I_FORCE_EXTERNAL_NUMBER_RANGE       = ' '
      I_NO_BANK_MASTER_UPDATE             = ' '
      I_CUSTOMER_IS_CONSUMER              = ' '
      I_RAISE_NO_BTE                      = ' '
        PI_POSTFLAG                         = 'X'
      PI_CAM_CHANGED                      = ' '
      PI_ADD_ON_DATA                      =
      I_FROM_CUSTOMERMASTER               = ' '
    IMPORTING
      E_KUNNR                             =
      O_KNA1                              =
      E_SD_CUST_1321_DONE                 =
    TABLES
      T_XKNAS                             =
      T_XKNBK                             =
      T_XKNB5                             =
      T_XKNEX                             =
      T_XKNVA                             =
      T_XKNVD                             =
      T_XKNVI                             =
      T_XKNVK                             =
      T_XKNVL                             =
        T_XKNVP                             = I_XKNVP
      T_XKNZA                             =
      T_YKNAS                             =
      T_YKNBK                             =
      T_YKNB5                             =
      T_YKNEX                             =
      T_YKNVA                             =
      T_YKNVD                             =
      T_YKNVI                             =
      T_YKNVK                             =
      T_YKNVL                             =
        T_YKNVP                             = i_yknvp ***
      T_YKNZA                             =
      T_UPD_TXT                           =
    EXCEPTIONS
        CLIENT_ERROR                        = 1
      KNA1_INCOMPLETE                     = 2
      KNB1_INCOMPLETE                     = 3
      KNB5_INCOMPLETE                     = 4
      KNVV_INCOMPLETE                     = 5
      KUNNR_NOT_UNIQUE                    = 6
      SALES_AREA_NOT_UNIQUE               = 7
      SALES_AREA_NOT_VALID                = 8
      INSERT_UPDATE_CONFLICT              = 9
      NUMBER_ASSIGNMENT_ERROR             = 10
      NUMBER_NOT_IN_RANGE                 = 11
      NUMBER_RANGE_NOT_EXTERN             = 12
      NUMBER_RANGE_NOT_INTERN             = 13
      ACCOUNT_GROUP_NOT_VALID             = 14
      PARNR_INVALID                       = 15
      BANK_ADDRESS_INVALID                = 16
      TAX_DATA_NOT_VALID                  = 17
      NO_AUTHORITY                        = 18
      COMPANY_CODE_NOT_UNIQUE             = 19
      DUNNING_DATA_NOT_VALID              = 20
      KNB1_REFERENCE_INVALID              = 21
      CAM_ERROR                           = 22
        OTHERS                              = 23.
    IF sy-subrc eq ‘0’.
    Commit work and wait.
    Endif.
    All above tables have a field called ‘KZ’ which has options
    U-update
    D-delete
    I-insert
    E-………(I don’t know)
    Ex: T_XKNVP structure = KNVP Structure + Field ‘KZ’.
    Documentation for this FM is not Available in English or German
    1.  I tried sending Z2  KZ as ‘D’ first &  Z1 with KZ as ‘I’ with business partner of Z2 (KUNN2)
         as single update.
    Ex: T_XKNP table
    KUNNR          PARVW             KUNN2          KZ
    123          Z2          70007777     D
    123          Z1          70007777     I
    2.  I tried it as a separate delete record and insert record i.e calling the FM twice .
    3.  I tried passing table  T_YKNVP with old partner data + TXKNVP table new partner data
    Ex: T_YKNP table
    KUNNR          PARVW             KUNN2          KZ
    123          Z2          70007777     U or space (I tried both one after another)
    4. All combinations for field ‘KZ’  are tried.
    Please help me to overcome this problem.
    I )   I need which parameters are to be passed to FM for updating partner function in KNVP table .
    II)   Do I need to pass structure I_KNA1 or I_KNVV to FM ? (Blank or with values corresponding to   
         partner function ).
    III)  Any sample code which can guide me.
    Even a small hint or clue from you will certainly help me.
    Thanks in Advance.
    AJAX

    i have the same problem. I need to update the partner function PARVW thru a program that i created. I tried to use this FM but it didn't work. Anyone knows another FM that i can use to update the KNVP table?

  • Problem in update PO's partner function using BAPI_PO_CHANGE

    Hi All,
    I have some problem when i try to update PO partner function using BAPI_PO_CHANGE.
    If i update partner function where business partner number is vendor (eg. GS) , it run successfully. But when I try to update partner function where business partner number is personnel number (eg. CS, VW, etc) , it was failed. And BAPI return message is "Please enter a partner role".
    Please advice.
    Thanks

    Hi,
             are you executing BAPI_TRANSACTION_COMMIT after BAPI_PO_CHANGE?
    Check this code for PO update..
    PARAMETERS: p_ebeln LIKE ekko-ebeln.
    DATA: t_poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE.
    DATA: t_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
    DATA: t_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    t_poitem-po_item = '00010'.
    t_poitem-net_price = '17.00'.
    APPEND t_poitem.
    t_poitemx-po_item = '00010'.
    t_poitemx-net_price = 'X'.
    t_poitemx-po_itemx = 'X'.
    APPEND t_poitemx.
    CALL FUNCTION 'BAPI_PO_CHANGE'
    EXPORTING
    purchaseorder = p_ebeln
    TABLES
    return = t_return
    poitem = t_poitem
    poitemx = t_poitemx.
    COMMIT WORK.
    <b>Reward points</b>
    Regards

  • Regarding sample code to update partner function using SD_PARTNER_UPDATE

    Hi All,
    Please provide some sample code to update/add partner function using FM 'SD_PARTNER_UPDATE'.
    regards
    Vishnu

    A better option would be to use a break point on this FM while creating a sales order. That way you will know how standard uses this FM.
    Thanks,
    Vikram.M

Maybe you are looking for

  • I have problem with storage on my iphone.

    I have problem with storage on my iphone 6. Before i uppgrade to the newest ios. I had 100 Gb free. Now i have nothing free. and iphone keeps saying that my storage is full. And does not work propperly Need help fast thanx

  • How to keep a Role in it's current place after selecting it's content?

    Hello, I am using NW 04 Patch 11. My Portal contain many Roles and because of that in order to see a certain Role I need to use the built-in arrows in order to slide the Roles. The problem is that if I slide to a certain Role and click on it to view

  • Ultra 10 problems

    ok this is a add on from "ultra 10 not displaying anything on monitor" Ive got the problem down to being either the motherboard or the power unit.. Ive got it to this because when i managed to continue installing solaris 10 i recieved a post message

  • Approval for Payments

    Need to have Approval only for Payment through Wire Transfer only for the new/non-recurring vendors Any pointers to acvhieve this ... Thank you .

  • ORA-12560 error in VS2010

    I'm getting "ORA-12560 TNS:protocol adapter error" when trying to Add Connection in VS2010 (Server Explorer > Add Connection > Username: hr, Password: hr, Data source name: Local Database). This is sample HR database in Oracle XE 10g. I'm guessing th