Exception 'NOT_ALLOWED'.

Hi,
I wrote 'COM_PARTNER_BADI' so stop creating orders against a PROSPECT. When a user enters a PROSPECT in standard order i am prompting the user saying 'Orders cannot be created against PROSPECT' in the status bar thru this BADI. It is working fine. After the user hits enter the control is waiting in sold-to text box to re-enter the customer. When i enter the customer correctly the program 'CRM_ORDER_MAINTAIN_MULTI_OW' gives system dumps with 'Message_type_x' because the recursive counter is not substracted and with the next call of.
I was suggested to raise the exception NOT_ALLOWED in by BADI so that the calling program can catch the exception.
I am new to programming. Could any please suggest how do i implement this BADI in my code to avoid the DUMP?
The following is my code in COM_PARTNER_BADI.
method IF_EX_COM_PARTNER_BADI~COM_PARTNER_CHECK.
  Data: ls_partner_wrk        TYPE COMT_PARTNER_WRK,
        ls_input_fields       TYPE COMT_PARTNER_INPUT_FIELD_NAMES,
        ls_partner_control    TYPE COMT_PARTNER_CONTROL,
        partner_no            TYPE CRMT_PARTNER_NO,
        process_type          TYPE CRMT_PROCESS_TYPE,
        zlv_bu_group           TYPE BU_GROUP.
  ls_partner_wrk        = IS_PARTNER_WRK.
  partner_no            = IS_PARTNER_WRK-partner_no.
  ls_partner_control    = IS_PARTNER_CONTROL.
  process_type          = ls_partner_control-process_type.
  If process_type = 'TA' OR  process_type = 'LP' OR  process_type = 'ZD'.
      select single bu_group from BUT000 into zlv_bu_group where PARTNER_GUID =  partner_no.
      if zlv_bu_group = 'CZ05'.
        if sy-subrc = 0.
           MESSAGE E008(ZZ).
        endif.
      endif.
  endif.
endmethod.
Thank you very much,
Karuna.

Hi Vicky,
I have the same problem with logical attribute "passwordchangerequired", and don't understand how to set up value true instead of value false.
If you resolve it let me me know how.
Thanks in advance
Dmitriy

Similar Messages

  • Change Pricing Condition for an item with CRM_ORDER_MAINTAIN

    Hi community,
    I try to change an existing condition with the function module crm_order_maintain.
    Everything looks fine, no error no dump, but no success
    The condition stays the same!
    Can anybody find a solution for this?
    Heres my report so far:
    *& Report  ZTEST_PRICING2
    REPORT  ztest_pricing2.
    DATA: lt_guid      TYPE crmt_object_guid_tab,
          lt_item      TYPE crmt_object_guid_tab,
          lt_saved     TYPE crmt_return_objects,
          lt_pridoc    TYPE crmt_pric_cond_t,
          ls_pridoc    TYPE crmt_pric_cond,
          lt_pricom    TYPE crmt_pridoc_comt,
          ls_pricom    TYPE crmt_pridoc_com,
          lt_header    TYPE crmt_orderadm_h_comt,
          lt_input     TYPE crmt_input_field_tab,
          ls_input     TYPE crmt_input_field,
          ls_input_fn  TYPE CRMT_INPUT_FIELD_NAMES,
          ls_cond_chg  TYPE prct_cond_external_change,
          ls_cond      TYPE PRCT_COND_DU,
          lt_pricing_i TYPE CRMT_PRICING_I_WRKT.
    PARAMETERS: lv_head TYPE crmt_object_guid DEFAULT 'C4C61C4E35DDF306E10000000A024089'.
    PARAMETERS: lv_item TYPE crmt_object_guid DEFAULT '09C71C4E35DDF306E10000000A024089'.
    PARAMETERS: lv_kbetr TYPE prct_cond_rate DEFAULT '100'.
    INSERT lv_head INTO TABLE lt_guid.
    INSERT lv_item INTO TABLE lt_item.
    CALL FUNCTION 'CRM_ORDER_READ'
      EXPORTING
        it_header_guid                    = lt_guid
        it_item_guid                      = lt_item
    *   IV_MODE                           =
    *   IV_ONLY_SPEC_ITEMS                =
    *   IT_REQUESTED_OBJECTS              =
    *   IV_NO_AUTH_CHECK                  =
    *   IT_ITEM_USAGE_RANGE               =
    *   IV_SUBITEM_DEPTH                  = -1
    *   IT_OBJECT_FILTER                  =
    *   IV_ONLY_CHANGED_OBJ               = FALSE
    *   IV_STATUS_H_CHECK_RELEVANCE       = FALSE
      IMPORTING
        et_pridoc                         = lt_pridoc
        et_pricing_i                      = lt_pricing_i
    * CHANGING
    *   CV_LOG_HANDLE                     =
    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 AND lt_pridoc IS NOT INITIAL.
      WRITE: / 'ERROR'.
      EXIT.
    ENDIF.
    READ TABLE lt_pridoc INDEX 1 INTO ls_pridoc.
    IF sy-subrc <> 0.
      WRITE: / 'ERROR'.
      EXIT.
    ENDIF.
    READ TABLE ls_pridoc-pric_cond INTO ls_cond WITH KEY kschl = 'PB00'.
    IF sy-subrc <> 0.
      WRITE: / 'ERROR'.
      EXIT.
    ENDIF.
    ls_input-ref_guid   = lv_head.
    ls_input-ref_kind   = 'A'.
    ls_input-objectname = 'PRIDOC'.
    ls_input_fn-fieldname = 'WAERS'.
    INSERT ls_input_fn INTO TABLE ls_input-field_names.
    ls_input_fn-fieldname = 'KBETR'.
    INSERT ls_input_fn INTO TABLE ls_input-field_names.
    INSERT ls_input INTO TABLE lt_input.
    ls_pricom-ref_guid   = lv_head.
    ls_pricom-ref_kind   = 'A'.
    *ls_pricom-PRICING_TYPE  = 'B'.
    *ls_pricom-pricing_procedure = 'ZZMTA'.
    ls_pricom-pric_cond[] = ls_pridoc-pric_cond[].
    MOVE-CORRESPONDING ls_cond TO ls_cond_chg.
    ls_cond_chg-waers = 'EUR'.
    ls_cond_chg-kbetr = lv_kbetr.
    INSERT ls_cond_chg INTO TABLE ls_pricom-cond_change.
    APPEND ls_pricom TO lt_pricom.
    CALL FUNCTION 'CRM_ORDER_MAINTAIN'
      EXPORTING
        it_pridoc         = lt_pricom
      CHANGING
    *    ct_orderadm_h     = lt_header
        ct_input_fields   = lt_input
      EXCEPTIONS
        error_occurred    = 1
        document_locked   = 2
        no_change_allowed = 3
        no_authority      = 4
        OTHERS            = 5.
    IF sy-subrc <> 0.
      EXIT.
    ENDIF.
    CALL FUNCTION 'CRM_ORDER_SAVE'
      EXPORTING
        it_objects_to_save         = lt_guid
      IMPORTING
        et_saved_objects           = lt_saved
    *   ET_EXCEPTION               =
    *   ET_OBJECTS_NOT_SAVED       =
    EXCEPTIONS
       document_not_saved         = 1
       OTHERS                     = 2.
    IF sy-subrc EQ 0.
      COMMIT WORK AND WAIT.
    ELSE.
      ROLLBACK WORK.
    ENDIF.
    regards
    Markus

    Hello Jordi,
    The example below is whereby i was trying to copy all the pricing condition on one document to another and deleting what's not present on the source document.
    You can used this piece of code to adapt your requirement.
    CALL FUNCTION 'ZCRC_FM_COPY_PRICE_COND_ALL'
              EXPORTING
    id_object_guid_src    = <fs_el_con_guid>
    id_object_guid_dest = <fs_el_so_guid>
    id_commit                  = abap_false
              EXCEPTIONS
    not_allowed         = 1
    error_occured     = 2
    OTHERS                 = 3.
      PERFORM f_recup_donnees USING     id_object_guid_src
                                                              id_object_guid_dest.
    PERFORM f_modif_condition_prix USING id_object_guid_src
                                                                                      id_object_guid_dest.
    PERFORM f_header_copy_pricing using id_object_guid_src
                                                                            id_object_guid_dest.
    FORM f_recup_donnees   USING      pd_object_guid_src TYPE crmt_object_guid
                                                                           pd_object_guid_dest TYPE crmt_object_guid.
      DATA:
         lt_header_guid        TYPE crmt_object_guid_tab.
      INSERT pd_object_guid_src  INTO TABLE lt_header_guid.
      INSERT pd_object_guid_dest INTO TABLE  lt_header_guid.
      CLEAR: gt_orderadm_i, gt_doc_flow.
      CALL FUNCTION 'CRM_ORDER_READ'
        EXPORTING
          it_header_guid       = lt_header_guid
        IMPORTING
          et_doc_flow          = gt_doc_flow            
          et_orderadm_i        = gt_orderadm_i
        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 NE 0.
        RAISE error_occured.
      ENDIF.
    " F_RECUP_DONNEES
    FORM f_modif_condition_prix USING pd_guid_src TYPE crmt_object_guid
                                      pd_guid_dest TYPE crmt_object_guid.
      DATA : ld_pd_handle_src     TYPE prct_handle,
              ld_pd_handle_dest    TYPE prct_handle,
              lt_komv_print_src    TYPE prct_cond_print_t,
    lt_komv_print_dest   TYPE prct_cond_print_t,
              ls_komv_print_dest   LIKE LINE OF lt_komv_print_dest,
              ls_komv_print_src    LIKE LINE OF lt_komv_print_src,
              lt_cond_chg          TYPE prct_cond_print_t,
              lt_cond_chg_insert   TYPE prct_cond_print_t,
              ls_cond_chg          TYPE prct_cond_print,
              ls_cond_chg_tmp      TYPE prct_cond_print,
              ls_input_fields      TYPE crmt_input_field,
              lt_input_fields      TYPE crmt_input_field_tab.
      DATA : bal_log         TYPE balloghndl,
             lt_item_ret     TYPE prct_item_ret_t,
             lt_cond_ret     TYPE prct_cond_print_t,
             ld_data_changed TYPE xfeld,
             gv_decimal      TYPE usdefaults-dcpfm,
             ld_lines        TYPE i,
             ld_ajout_cond   TYPE abap_bool.
      FIELD-SYMBOLS : <fs_orderadm_i_dest>  TYPE crmt_orderadm_i_wrk,
    <fs_orderadm_i_src>   TYPE crmt_orderadm_i_wrk,
                      <fs_cond_chg>         TYPE prct_cond_print,
    <fs_cond_chg_insert>  TYPE prct_cond_print.
    * Début Ajout CD1K904313-001.
      DATA: ld_guid_src  TYPE crmt_object_guid.
      FIELD-SYMBOLS: <fs_doc_flow>  TYPE crmt_doc_flow_wrk.
    * Début Ajout CD1K904313-001.
    * Verrouillage des documents source et destinataire
      PERFORM f_lock_document USING pd_guid_src.
      PERFORM f_lock_document USING pd_guid_dest.
    *Récupérer le pricing handle des documents
    * Document source
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
    iv_header_guid             = pd_guid_src
        IMPORTING
    ev_pd_handle               = ld_pd_handle_src
        EXCEPTIONS
    error_occurred             = 1
    handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    * Document destinataire
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
          iv_header_guid             = pd_guid_dest
        IMPORTING
          ev_pd_handle               = ld_pd_handle_dest
        EXCEPTIONS
          error_occurred             = 1
          handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    * A ne pas traiter les postes de type ZPDF
      DELETE  gt_orderadm_i WHERE itm_type = 'ZPDF'.
      LOOP AT gt_orderadm_i ASSIGNING <fs_orderadm_i_dest> WHERE header = pd_guid_dest.
        REFRESH : lt_komv_print_src,
                  lt_komv_print_dest,
    lt_cond_chg,
    lt_cond_chg_insert.
    * Début Modif CD1K904313-001.
    * Récupérer le guid de l'item liée au item destinataire.
        READ TABLE gt_doc_flow ASSIGNING <fs_doc_flow> WITH KEY objkey_b = <fs_orderadm_i_dest>-guid.
        CHECK sy-subrc EQ 0.
        ld_guid_src = <fs_doc_flow>-objkey_a.
    *    READ TABLE gt_orderadm_i ASSIGNING <fs_orderadm_i_src> WITH KEY header = pd_guid_src
    * number_int = <fs_orderadm_i_dest>-number_int.
    * Fin Modif CD1K904313-001.
    * Récupérer les pricing document
        IF sy-subrc EQ 0.
    *     Document source
          CALL FUNCTION 'PRC_PD_ITEM_SHOW'
            EXPORTING
              iv_pd_handle        = ld_pd_handle_src
    *         iv_item_no          = <fs_orderadm_i_src>-guid    "Supression CD1K904313-001
              iv_item_no          = ld_guid_src                 "Addition CD1K904313-001
            IMPORTING
              et_komv_print       = lt_komv_print_src
            EXCEPTIONS
              non_existing_handle = 1
              non_existing_item   = 2
              ipc_error           = 3
              OTHERS              = 4.
        ENDIF.
    *   Document destinataire
        CALL FUNCTION 'PRC_PD_ITEM_SHOW'
          EXPORTING
            iv_pd_handle        = ld_pd_handle_dest
            iv_item_no          = <fs_orderadm_i_dest>-guid
          IMPORTING
    et_komv_print       = lt_komv_print_dest
          EXCEPTIONS
            non_existing_handle = 1
            non_existing_item   = 2
            ipc_error           = 3
            OTHERS              = 4.
    * Modification et Suppression des conditions de prix
        LOOP AT lt_komv_print_dest INTO ls_komv_print_dest .
          CLEAR: ls_cond_chg,
                 ls_komv_print_src.
          MOVE-CORRESPONDING ls_komv_print_dest TO ls_cond_chg.
    * Rechercher la condition sur le document source
          READ TABLE lt_komv_print_src INTO ls_komv_print_src WITH KEY kschl = ls_komv_print_dest-kschl
    zaehk = ls_komv_print_dest-zaehk. "CD1K904313
          IF sy-subrc EQ 0.
            ls_cond_chg-kbetr_prt = ls_komv_print_src-kbetr_prt.
            ls_cond_chg-kwert     = ls_komv_print_src-kwert.
            ls_cond_chg-kinak     = ls_komv_print_src-kinak.
          ELSEIF ls_cond_chg-kschl IS NOT INITIAL.
            CLEAR ls_cond_chg.
            CONTINUE.
          ENDIF.
    *     Format décimal
          CASE gv_decimal.
            WHEN space.       "format N.NNN,NN
              REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
            WHEN 'Y'.         "format N NNN NNN,NN
              REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
          ENDCASE.
          INSERT ls_cond_chg INTO TABLE lt_cond_chg.
          CLEAR ls_cond_chg.
        ENDLOOP.
    * Ajout des conditions de prix
        LOOP AT lt_komv_print_src INTO ls_komv_print_src WHERE kschl IS NOT INITIAL.
          CLEAR: ls_cond_chg, ld_lines, ls_komv_print_dest, ls_cond_chg_tmp, ld_ajout_cond.
    * Vérifier la présence de la condition sur le document destinataire
          READ TABLE lt_komv_print_dest INTO ls_komv_print_dest WITH KEY kschl = ls_komv_print_src-kschl
    zaehk = ls_komv_print_src-zaehk. "CD1K904313.
          IF sy-subrc EQ 0.
            CLEAR: ls_cond_chg, ls_komv_print_dest.
            CONTINUE.
          ELSE.
            DESCRIBE TABLE lt_cond_chg LINES ld_lines.
            READ TABLE lt_cond_chg INTO ls_cond_chg_tmp INDEX ld_lines.
            IF sy-subrc EQ 0.
              ld_ajout_cond = abap_true.
              MOVE-CORRESPONDING ls_komv_print_src TO ls_cond_chg.
              ls_cond_chg-knumv     = ls_cond_chg_tmp-knumv.
              ls_cond_chg-kposn     = ls_cond_chg_tmp-kposn.
              ls_cond_chg-stunr     = ls_cond_chg_tmp-stunr + 10.
            ELSE.
              CLEAR: ls_cond_chg, ld_lines, ls_komv_print_dest, ls_cond_chg_tmp.
              CONTINUE.
            ENDIF.
          ENDIF.
    *     Format décimal
          CASE gv_decimal.
            WHEN space.             "format N.NNN,NN
              REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
            WHEN 'Y'.               "format N NNN NNN,NN
              REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
          ENDCASE.
    * Récupérer les nouvelles conditions qui seront ajouté au document destinataire
          IF ld_ajout_cond EQ abap_true.
            INSERT ls_cond_chg INTO TABLE lt_cond_chg_insert.
          ENDIF.
          INSERT ls_cond_chg INTO TABLE lt_cond_chg.
          CLEAR ls_cond_chg.
        ENDLOOP.
        CALL FUNCTION 'PRC_INT_ITEM_INPUT'
          EXPORTING
            iv_pd_handle        = ld_pd_handle_dest
            iv_item_no          = <fs_orderadm_i_dest>-guid
            it_cond_prt         = lt_cond_chg
            iv_bal_log          = bal_log
            iv_req_ret          = abap_true
            iv_req_cond_prt     = abap_true
          IMPORTING
            et_item_ret         = lt_item_ret
            et_cond_prt         = lt_cond_ret
            ev_data_changed     = ld_data_changed
          EXCEPTIONS
            non_existing_handle = 1
            non_existing_item   = 2
            ipc_error           = 3.
        IF sy-subrc = 0.
    *     En cas d'ajout de nouvelles conditions de prix, appeler le MF PRC_INT_ITEM_INPUT
    *     avec les montants
          IF lt_cond_chg_insert IS NOT INITIAL.
            REFRESH lt_cond_chg[].
            lt_cond_chg[] = lt_cond_ret[].
            LOOP AT lt_cond_chg_insert ASSIGNING <fs_cond_chg_insert>.
              READ TABLE lt_cond_chg ASSIGNING <fs_cond_chg> WITH KEY kschl = <fs_cond_chg_insert>-kschl.
              IF sy-subrc EQ 0.
                <fs_cond_chg>-kwert     = <fs_cond_chg_insert>-kwert.
                <fs_cond_chg>-kbetr_prt = <fs_cond_chg_insert>-kbetr_prt.
              ENDIF.
            ENDLOOP.
            REFRESH lt_cond_ret[].
            CALL FUNCTION 'PRC_INT_ITEM_INPUT'
              EXPORTING
                iv_pd_handle        = ld_pd_handle_dest
                iv_item_no          = <fs_orderadm_i_dest>-guid
                it_cond_prt         = lt_cond_chg
                iv_bal_log          = bal_log
                iv_req_ret          = abap_true
                iv_req_cond_prt     = abap_true
              IMPORTING
                et_item_ret         = lt_item_ret
                et_cond_prt         = lt_cond_ret
                ev_data_changed     = ld_data_changed
              EXCEPTIONS
                non_existing_handle = 1
                non_existing_item   = 2
                ipc_error           = 3.
          ENDIF.
    *   Publish event afin de sauvegarder les conditions de prix
          CALL FUNCTION 'CRM_EVENT_PUBLISH_OW'
            EXPORTING
              iv_obj_name = 'PRIDOC'
              iv_guid_hi  = pd_guid_dest
              iv_kind_hi  = 'A'
              iv_event    = 'SAVE'
            EXCEPTIONS
              OTHERS      = 1.
    *   As no order_maintain will follow implicitly and therefore no
    *   exec times for the events will be set, call CRM_ORDER_MAINTAIN
    *   without any parameters
    *   Then the exec time 'end of document' will be set and with the
    *   group logic also all exec times before
    *   But at least one object is needed in input_fields
    *   --> use PRIDOC
          ls_input_fields-ref_guid   = <fs_orderadm_i_dest>-guid.
          ls_input_fields-ref_kind   = 'B'.
          ls_input_fields-objectname = 'PRIDOC'.
          INSERT ls_input_fields INTO TABLE lt_input_fields.
          CLEAR ls_input_fields.
          CALL FUNCTION 'CRM_ORDER_MAINTAIN'
            CHANGING
              ct_input_fields   = lt_input_fields
            EXCEPTIONS
              error_occurred    = 1
              document_locked   = 2
              no_change_allowed = 3
              no_authority      = 4
              OTHERS            = 5.
        ENDIF.
      ENDLOOP.
    " F_MODIF_CONDITION_PRIX
    *& Form  F_LOCK_DOCUMENT
    * Verrouillage d'un document
    FORM f_lock_document  USING pd_guid TYPE crmt_object_guid.
      CONSTANTS : lc_orderadm_h TYPE  crmt_object_name  VALUE 'ORDERADM_H',
                  lc_orderadm_i TYPE  crmt_object_name  VALUE 'ORDERADM_I'.
      DATA: lv_process_mode      TYPE crmt_mode,
            lv_order_initialized TYPE crmt_boolean,
            lv_process_type      TYPE crmt_process_type,
            lv_already_locked    TYPE abap_bool.
      DATA: ls_admin_ui_status  TYPE crmt_admin_ui_status,
            ls_item_usage_range TYPE crmt_item_usage_range.
      DATA: lt_objects_to_read   TYPE crmt_object_guid_tab,
            lt_requested_objects TYPE crmt_object_name_tab,
            lt_item_usage_range  TYPE crmt_item_usage_range_tab,
            lt_locked_contract   TYPE crmt_object_guid_tab.
      INSERT pd_guid INTO TABLE lt_objects_to_read.
      INSERT lc_orderadm_h INTO TABLE lt_requested_objects.
      INSERT lc_orderadm_i INTO TABLE lt_requested_objects.
      ls_item_usage_range-sign  = 'E'.
      ls_item_usage_range-value = '02'.
      INSERT ls_item_usage_range INTO TABLE lt_item_usage_range.
    * LAM: Financing Options should be viewed in a separate screen:
      ls_item_usage_range-sign  = 'E'.
      ls_item_usage_range-value = '05'.   "Financing options
      INSERT ls_item_usage_range INTO TABLE lt_item_usage_range.
    *-> read document in change mode
      CALL FUNCTION 'CRM_ORDER_READ'
        EXPORTING
          it_header_guid       = lt_objects_to_read
          iv_mode              = 'B'
          it_requested_objects = lt_requested_objects
          it_item_usage_range  = lt_item_usage_range
        EXCEPTIONS
          document_not_found   = 1
          error_occurred       = 2
          document_locked      = 3
          no_change_authority  = 4
          no_display_authority = 5
          OTHERS               = 6.
      PERFORM enqueue_order IN PROGRAM saplcrm_order_ow IF FOUND
        USING pd_guid
              abap_false
              abap_false
              abap_false
    CHANGING sy-subrc
              lv_already_locked
              lt_locked_contract.
    " F_LOCK_DOCUMENT
    * Fin Ajout CD1K904074-001
    FORM f_header_copy_pricing  USING   pd_guid_src
    pd_guid_dest.
      DATA : ld_pd_handle_src     TYPE prct_handle,
              ld_pd_handle_dest    TYPE prct_handle,
              lt_komv_print_src    TYPE prct_cond_print_t,
    lt_komv_print_dest   TYPE prct_cond_print_t,
              ls_komv_print_dest   LIKE LINE OF lt_komv_print_dest,
              ls_komv_print_src    LIKE LINE OF lt_komv_print_src,
              lt_cond_chg          TYPE prct_cond_print_t,
              ls_cond_chg          TYPE prct_cond_print,
              ls_input_fields      TYPE crmt_input_field,
              lt_input_fields      TYPE crmt_input_field_tab.
      DATA : bal_log         TYPE balloghndl,
             lt_cond_ret     TYPE prct_cond_print_t,
             ld_data_changed TYPE xfeld,
             gv_decimal      TYPE usdefaults-dcpfm.
    * Verrouillage des documents source et destinataire
      PERFORM f_lock_document USING pd_guid_src.
      PERFORM f_lock_document USING pd_guid_dest.
    *  Récupérer le pricing handle des documents
    * Document source
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
          iv_header_guid             = pd_guid_src
        IMPORTING
          ev_pd_handle               = ld_pd_handle_src
        EXCEPTIONS
          error_occurred             = 1
          handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    * Document destinataire
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
          iv_header_guid             = pd_guid_dest
        IMPORTING
          ev_pd_handle               = ld_pd_handle_dest
        EXCEPTIONS
          error_occurred             = 1
          handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    *  * Récupérer les pricing document
    *  Document Source
      CALL FUNCTION 'PRC_PD_HEAD_SHOW'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_src
        IMPORTING
          et_komv_print       = lt_komv_print_src
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          OTHERS              = 3.
      CHECK sy-subrc EQ 0.
    *  Document Destinataire
      CALL FUNCTION 'PRC_PD_HEAD_SHOW'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_dest
        IMPORTING
    et_komv_print       = lt_komv_print_dest
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          OTHERS              = 3.
      CHECK sy-subrc EQ 0.
    *  * Modification et Suppression des conditions de prix
      LOOP AT lt_komv_print_src INTO ls_komv_print_src .
        CLEAR: ls_cond_chg,
               ls_komv_print_dest.
        MOVE-CORRESPONDING ls_komv_print_src TO ls_cond_chg.
    * Rechercher la condition sur le document source
        READ TABLE lt_komv_print_dest INTO ls_komv_print_dest WITH KEY kschl = ls_komv_print_src-kschl
    zaehk = ls_komv_print_src-zaehk.
        IF sy-subrc EQ 0.
          IF ls_komv_print_src-kbetr NE ls_komv_print_dest-kbetr.
            ls_cond_chg-kbetr_prt = ls_komv_print_src-kbetr_prt.
            ls_cond_chg-kwert     = ls_komv_print_src-kwert.
            ls_cond_chg-kinak     = ls_komv_print_src-kinak.
            CASE gv_decimal.
              WHEN space.       "format N.NNN,NN
                REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
              WHEN 'Y'.         "format N NNN NNN,NN
                REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
            ENDCASE.
          ENDIF.
        ENDIF.
        CLEAR ls_cond_chg-krech.
        INSERT ls_cond_chg INTO TABLE lt_cond_chg.
        CLEAR ls_cond_chg.
      ENDLOOP.
      CALL FUNCTION 'PRC_INT_HEAD_INPUT'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_dest
          iv_bal_log          = bal_log
          it_cond_prt         = lt_cond_chg
          iv_req_ret          = abap_true
          iv_req_cond_prt     = abap_true
        IMPORTING
          et_cond_prt         = lt_cond_ret
          ev_data_changed     = ld_data_changed
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          not_allowed         = 3
          OTHERS              = 4.
      CHECK sy-subrc EQ 0.
    *    *   Publish event afin de sauvegarder les conditions de prix
      CALL FUNCTION 'CRM_EVENT_PUBLISH_OW'
        EXPORTING
          iv_obj_name = 'PRIDOC'
          iv_guid_hi  = pd_guid_dest
          iv_kind_hi  = 'A'
          iv_event    = 'SAVE'
        EXCEPTIONS
          OTHERS      = 1.
    *   As no order_maintain will follow implicitly and therefore no
    *   exec times for the events will be set, call CRM_ORDER_MAINTAIN
    *   without any parameters
    *   Then the exec time 'end of document' will be set and with the
    *   group logic also all exec times before
    *   But at least one object is needed in input_fields
    *   --> use PRIDOC
      ls_input_fields-ref_guid   = pd_guid_dest.
      ls_input_fields-ref_kind   = 'A'.
      ls_input_fields-objectname = 'PRIDOC'.
      INSERT ls_input_fields INTO TABLE lt_input_fields.
      CLEAR ls_input_fields.
      CALL FUNCTION 'CRM_ORDER_MAINTAIN'
        CHANGING
          ct_input_fields   = lt_input_fields
        EXCEPTIONS
          error_occurred    = 1
          document_locked   = 2
          no_change_allowed = 3
          no_authority      = 4
          OTHERS            = 5.
    ENDFORM.
    FORM f_header_copy_pricing  USING   pd_guid_src
    pd_guid_dest.
      DATA : ld_pd_handle_src     TYPE prct_handle,
              ld_pd_handle_dest    TYPE prct_handle,
              lt_komv_print_src    TYPE prct_cond_print_t,
    lt_komv_print_dest   TYPE prct_cond_print_t,
              ls_komv_print_dest   LIKE LINE OF lt_komv_print_dest,
              ls_komv_print_src    LIKE LINE OF lt_komv_print_src,
              lt_cond_chg          TYPE prct_cond_print_t,
              ls_cond_chg          TYPE prct_cond_print,
              ls_input_fields      TYPE crmt_input_field,
              lt_input_fields      TYPE crmt_input_field_tab.
      DATA : bal_log         TYPE balloghndl,
             lt_cond_ret     TYPE prct_cond_print_t,
             ld_data_changed TYPE xfeld,
             gv_decimal      TYPE usdefaults-dcpfm.
      PERFORM f_lock_document USING pd_guid_src.
      PERFORM f_lock_document USING pd_guid_dest.
    *  Récupérer le pricing handle des documents
    * Document source
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
          iv_header_guid             = pd_guid_src
        IMPORTING
          ev_pd_handle               = ld_pd_handle_src
        EXCEPTIONS
          error_occurred             = 1
          handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    * Document destinataire
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
          iv_header_guid             = pd_guid_dest
        IMPORTING
          ev_pd_handle               = ld_pd_handle_dest
        EXCEPTIONS
          error_occurred             = 1
          handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    *  * Récupérer les pricing document
    *  Document Source
      CALL FUNCTION 'PRC_PD_HEAD_SHOW'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_src
        IMPORTING
          et_komv_print       = lt_komv_print_src
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          OTHERS              = 3.
      CHECK sy-subrc EQ 0.
    *  Document Destinataire
      CALL FUNCTION 'PRC_PD_HEAD_SHOW'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_dest
        IMPORTING
    et_komv_print       = lt_komv_print_dest
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          OTHERS              = 3.
      CHECK sy-subrc EQ 0.
    *  * Modification et Suppression des conditions de prix
      LOOP AT lt_komv_print_src INTO ls_komv_print_src .
        CLEAR: ls_cond_chg,
               ls_komv_print_dest.
        MOVE-CORRESPONDING ls_komv_print_src TO ls_cond_chg.
    * Rechercher la condition sur le document source
        READ TABLE lt_komv_print_dest INTO ls_komv_print_dest WITH KEY kschl = ls_komv_print_src-kschl
    zaehk = ls_komv_print_src-zaehk.
        IF sy-subrc EQ 0.
          IF ls_komv_print_src-kbetr NE ls_komv_print_dest-kbetr.
            ls_cond_chg-kbetr_prt = ls_komv_print_src-kbetr_prt.
            ls_cond_chg-kwert     = ls_komv_print_src-kwert.
            ls_cond_chg-kinak     = ls_komv_print_src-kinak.
            CASE gv_decimal.
              WHEN space.       "format N.NNN,NN
                REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
              WHEN 'Y'.         "format N NNN NNN,NN
                REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
            ENDCASE.
          ENDIF.
        ENDIF.
        CLEAR ls_cond_chg-krech.
        INSERT ls_cond_chg INTO TABLE lt_cond_chg.
        CLEAR ls_cond_chg.
      ENDLOOP.
      CALL FUNCTION 'PRC_INT_HEAD_INPUT'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_dest
          iv_bal_log          = bal_log
          it_cond_prt         = lt_cond_chg
          iv_req_ret          = abap_true
          iv_req_cond_prt     = abap_true
        IMPORTING
          et_cond_prt         = lt_cond_ret
          ev_data_changed     = ld_data_changed
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          not_allowed         = 3
          OTHERS              = 4.
      CHECK sy-subrc EQ 0.
      CALL FUNCTION 'CRM_EVENT_PUBLISH_OW'
        EXPORTING
          iv_obj_name = 'PRIDOC'
          iv_guid_hi  = pd_guid_dest
          iv_kind_hi  = 'A'
          iv_event    = 'SAVE'
        EXCEPTIONS
          OTHERS      = 1.
      ls_input_fields-ref_guid   = pd_guid_dest.
      ls_input_fields-ref_kind   = 'A'.
      ls_input_fields-objectname = 'PRIDOC'.
      INSERT ls_input_fields INTO TABLE lt_input_fields.
      CLEAR ls_input_fields.
      CALL FUNCTION 'CRM_ORDER_MAINTAIN'
        CHANGING
          ct_input_fields   = lt_input_fields
        EXCEPTIONS
          error_occurred    = 1
          document_locked   = 2
          no_change_allowed = 3
          no_authority      = 4
          OTHERS            = 5.

  • A simple ABAP question

    Friends,
    I am intrigued with the following date comparison logic. This is a small snippet that I cut&paste from SAP code and modified to check whether the logic is correct.
    the logic below writes STATUS 68. From SAP point of view and I agree, that it should not write 68.
    Can you please elaborate the problem here.
    Thanks in advance.
    William
    DATA: i_aedat type sy-datum,  " Equipment Change date in the decentral
          l_aedat type sy-datum.  " Equipment Change date in the central.
    I_aedat = '20120119'. "From deployed
    L_aedat = '20120118'. "In central
    * posting in Central
      if l_aedat  is not initial.
    *...change mode
        if I_aedat < L_aedat.
    *.....existing entry is the actual one,
    *.....we don't won't overtake old data
          write: / 'status 68'.
        endif.
      endif.
    Moderator message: please choose more descriptive titles for your posts, everybody here has ABAP questions...
    Edited by: Thomas Zloch on Feb 20, 2012

    Ok, here is the function module
    Please note i_aedat is the change date in the decentral and l_aedat is the changed date in the central
    The function module determine whether the existing central date is before the Decentrla date.
    If so it would update the central data with decentral data.
    Code below produce 68 at our installation and it does not with Vijaj and Patrick. I concur with their reply.
    The code that I have provided is how the function module behaves.
    So is it a kernel issue?
    Any help is much appreciated.
    Thanks
    William
    function /isdfps/etups_maintain_chk.
    ""Lokale Schnittstelle:
    *"  IMPORTING
    *"     REFERENCE(I_EQUNR) TYPE  EQUNR
    *"     REFERENCE(I_AEDAT) TYPE  AEDAT
    *"  EXCEPTIONS
    *"      NOT_ALLOWED
      data: l_aedat  like equi-aedat.
      select single aedat into l_aedat
        from equi
       where equnr = i_equnr.
      if sy-subrc is initial and
         l_aedat  is not initial.
    *...change mode
        if i_aedat < l_aedat.
    *.....existing entry is the actual one,
    *.....we don't won't overtake old data
          raise not_allowed.
        endif.
      endif.
    endfunction.

  • How to disable a Copy Trans Button in Crmd-order

    Hi All,
             I am trying to figure out what is controling my Copy transaction button in <b>Crmd_ Order</b>. Even if I remove Copy Control Config, its still working and creating a copy of transaction. Please give your input.
    Appreciate ur help.
    Regards,
    Umar

    hi Umar,
    there is 2 option to restrict the generation of following document from copy control, that is :
    1. via authorization
    2. via BADI implementation
    the easiest way is the option 1 : via authorization.
    just remove the authorization from the user to generate transaction type for ACTIVITY and TASK.
    but ussually this option is hard to implement due to the business scenario because it is imposible to restrict the user to create an activity or a task.
    if the option 1 is not available, then use the option 2 : via BADI implementation.
    just create a new implementation of BADI class CRM_COPY_BADI and add some validation that if the source of the document is certain transaction type then raise the exception NOT_ALLOWED.
    but before implement this BADI, you need to configure the copy control first for all ACTIVITY and TASK transaction types. if not, the BADI won't works.
    hopes it helps
    cheers

  • How to change status of Campaign

    Hi
    I have writtend following code to change the status of the campaign
    Data : lit_status_comt TYPE crmt_status_comt,
    wa_status_comt LIKE LINE OF lit_status_comt,
    lit_field_names TYPE crmt_input_field_names_tab,
    wa_input_field_names LIKE LINE OF lit_field_names.
    CLEAR wa_status_comt.
    wa_status_comt-ref_guid = 'GUID of the HEADER or Line Item of the Order'.
    wa_status_comt-ref_kind = 'Pass 'A' for Header/ 'B' for Item'.
    wa_status_comt-status = 'E0035'. " Pass the user status
    wa_status_comt-user_stat_proc = 'ZCONTR_H' " Value for the User Status Profile.
    wa_status_comt-activate = 'X'.
    INSERT wa_status_comt INTO TABLE lit_status_comt.
    wa_input_field_names-fieldname = 'ACTIVATE'.
    INSERT wa_input_field_names INTO TABLE lit_field_names.
    IF lit_status_comt IS NOT INITIAL.
    CALL FUNCTION 'CRM_STATUS_MAINTAIN_OW'
    EXPORTING
    it_status_com = lit_status_comt
    CHANGING
    ct_input_field_names = lit_field_names
    EXCEPTIONS
    not_allowed = 1
    error_occurred = 2
    warning_occurred = 3
    OTHERS = 4.
    ENDIF.
    But status is not changing in CRM_JEST table. How to change the status in CRM_JEST.
    I want to change the CREATED status on RELEASED status..
    Could you please help me inthis.
    Thanks & Regards
    Sowmya

    Sowmya,
    you do not need to build custom code. There's the program CRM_MKTPL_COND_IF_R001 that does exactly this work.
    Regards
    C

  • Change sales order user status

    Hello experts,
    I'm trying to update the user status with the following code without success:
    DATA : LIT_STATUS_COMT       TYPE CRMT_STATUS_COMT,
           WA_STATUS_COMT        LIKE LINE OF LIT_STATUS_COMT,
           LIT_FIELD_NAMES       TYPE CRMT_INPUT_FIELD_NAMES_TAB,
           WA_INPUT_FIELD_NAMES  LIKE LINE OF LIT_FIELD_NAMES.
    SELECTION-SCREEN BEGIN OF BLOCK AAA.
    PARAMETERS: P_GUID  TYPE CRMT_STATUS_COM-REF_GUID,
                P_STAT TYPE   CRMT_STATUS_COM-STATUS.
    SELECTION-SCREEN END OF BLOCK AAA.
    CLEAR WA_STATUS_COMT.
    WA_STATUS_COMT-REF_GUID       = P_GUID.
    WA_STATUS_COMT-REF_KIND       = 'A' .
    WA_STATUS_COMT-STATUS         = P_STAT. " Pass the user status
    WA_STATUS_COMT-USER_STAT_PROC = 'ZOR00001'. " Value for the User Status Profile.
    WA_STATUS_COMT-ACTIVATE       = 'X'.
    INSERT WA_STATUS_COMT INTO TABLE LIT_STATUS_COMT.
    WA_INPUT_FIELD_NAMES-FIELDNAME = 'ACTIVATE'.
    APPEND WA_INPUT_FIELD_NAMES TO LIT_FIELD_NAMES.
      CALL FUNCTION 'CRM_STATUS_MAINTAIN_OW'
        EXPORTING
          IT_STATUS_COM        = LIT_STATUS_COMT
        CHANGING
          CT_INPUT_FIELD_NAMES = LIT_FIELD_NAMES
        EXCEPTIONS
          NOT_ALLOWED          = 1
          ERROR_OCCURRED       = 2
          WARNING_OCCURRED     = 3
          OTHERS               = 4.
      DATA: LT_OBJECTS_TO_SAVE  TYPE  CRMT_OBJECT_GUID_TAB,
            LS_OBJECTS_TO_SAVE  LIKE LINE OF LT_OBJECTS_TO_SAVE.
      LS_OBJECTS_TO_SAVE = P_GUID.
      APPEND LS_OBJECTS_TO_SAVE TO LT_OBJECTS_TO_SAVE.
      CALL FUNCTION 'CRM_STATUS_SAVE_OW'
       EXPORTING
         IT_HEADER_GUID           = LT_OBJECTS_TO_SAVE
    best regards,
    Ronen.

    R.R,
    I already tried that without success:
    INCLUDE CRM_STATUS_CON.
    INCLUDE CRM_LOG_STATES_CON.
    SELECTION-SCREEN BEGIN OF BLOCK AAA.
      PARAMETERS: P_OBJNR  TYPE CRM_JSTO-OBJNR,
                  P_STAT TYPE   CRM_JEST-STAT.
      SELECTION-SCREEN END OF BLOCK AAA.
    START-OF-SELECTION.
    CALL FUNCTION 'CRM_STATUS_CHANGE_EXTERN_OW'
      EXPORTING
    *   CHECK_ONLY                = ' '
        OBJNR                     = P_OBJNR
        USER_STATUS               = P_STAT
    *   SET_INACT                 = ' '
    *   IV_REF_KIND               =
    *   IV_OBJECT_TYPE            =
    *   IV_NO_1O_MAINTAIN         =
    * IMPORTING
    *   STONR                     =
    * EXCEPTIONS
    *   OBJECT_NOT_FOUND          = 1
    *   STATUS_INCONSISTENT       = 2
    *   STATUS_NOT_ALLOWED        = 3
    *   OTHERS                    = 4
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
       WAIT          = 'X'
    * IMPORTING
    *   RETURN        =
    any other suggestions?
    Ronen.

  • Validating Internal Order Settlement Rule during creation

    Does anybody know of a user exit, badi, anything, that can be used to validate assignement data when creating/changing the settlement rule on an internal order?
    Appreciate the help...
    Sam

    Hi, I just wanted to come back and add this extra information incase someone else needs it in the future:
    I think we were finally able to come up with an acceptable solution.
    <b>The Problem:
    ============</b>
    SAP does not provide an easy way to validate detail section of a settlement rule for an internal order. The user exits that are available do not import the COBRB structure that contains the screen data entered by user in the detail screen.
    <b>Solution:
    ===========</b>
    Watch out for wrapped lines!
    (1) Implement the BADI: <b>CO_SRULE_CHECK</b>; NO filter; Settlement Rule Custom Validation BADI
    (see current thread for details)
    Inside the <b>DISTRIBUTION_RULE_CHECK</b> method of your BADI, implement your custom validation. You can call out to your standard CO validaton module, or whatever.
    (2) Implement user exit: EXIT_SAPLRKIO_002(include zxaufu02): Call settlement_rule_check.
    (3) Implement a subroutine as shown (adapt to your business environment):
    FORM settlement_rule_check.
    DATA: exit type ref to IF_EX_CO_SRULE_CHECK.
    DATA: lt_cobra LIKE cobra OCCURS 0 WITH HEADER LINE, lt_cobrb LIKE cobrb OCCURS 0 WITH HEADER LINE.
    don't validate in display mode
    CHECK I_ACTVT NE 03.
    Call function to get the current settlement rule from
    memory buffer (this is the crux of the solution)
      call function 'K_SETTLEMENT_RULE_GET'
           EXPORTING
                objnr     = i_aufk-OBJNR
                x_all     = ' '
              TABLES
                e_cobra   = lt_cobra
                e_cobrb   = lt_cobrb
              EXCEPTIONS
                not_found = 1
                others    = 2.
      if SY-SUBRC <> 0.
    raising E_MESSAGE.
      endif.
    Now Prepare/call BADI to check the custom rules
      class CL_EX_CO_SRULE_CHECK definition load.
    create an instance of BADI
      call method cl_exithandler=>get_instance
           changing
            instance = exit.
    call the check method of the BADI
      call method: exit->DISTRIBUTION_RULE_CHECK
           EXPORTING
               DISTRIBUTION_RULE = lt_cobrb
      EXCEPTIONS
         not_allowed                = 1
         not_allowed_with_msg       = 2.
    either use a standard message function or create your
    own
      IF sy-subrc = 1.
        PERFORM message_send
          USING 'KD' 'E' '027' space space space space space.
      ELSEIF sy-subrc = 2.
        PERFORM message_send
          USING sy-msgid sy-msgty sy-msgno
                sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
                space.                   "...
      ENDIF.
    endform.
    (4) Test, Test, Test. Hope it works for you.
    Sam

  • How can i define in which transaction i come to this include!

    hi sap experts.
    i write this code in include ZXQEVU10 :
        CALL FUNCTION 'QAST_PROCESS_ACTIVITY'
             EXPORTING
    *             I_DIALOG             = 'X'
                  I_OBJNR              = I_QALS-OBJNR
                  I_VORGANG            = 'QM68'
             EXCEPTIONS
                  NOT_ALLOWED          = 1
                  ACTIVITY_NOT_ALLOWED = 2
                  OTHERS               = 3.
        E_EXIT_ACTIVE = 'X'.
    but i want this code execute just when im in qa12 or qa14, but know it done in qa11 too, how can i control it?
    how can i define the transaction that come to this.
    thanks for your help.

    Hello Mahdieh ,
    Please check for sy-tcode value.
    You can try like below
    If sy-tcode = 'QA12' or 'QA14'.
    CALL FUNCTION 'QAST_PROCESS_ACTIVITY'
             EXPORTING
    *             I_DIALOG             = 'X'
                  I_OBJNR              = I_QALS-OBJNR
                  I_VORGANG            = 'QM68'
             EXCEPTIONS
                  NOT_ALLOWED          = 1
                  ACTIVITY_NOT_ALLOWED = 2
                  OTHERS               = 3.
        E_EXIT_ACTIVE = 'X'.
    endif.
    thanks

  • Reverse ud

    hi sap experte.
    we want to reverse inseption lots.
    i search and found the program attached to the 175842sap note and implemented it.
    but when  i run and insert inseption lot , the prodram show this message :
    "good movements not possible in mvmt type 322"
    i search and find this answer :
    to "activate" an existing SAP user exit (SAP function EXIT_SAPMQEVA_008, Include ZXQEVU10, Include LXQEVF10). Activating this function causes a new button (Reset Usage Decision) to appear on the toolbar of the QA12 transaction. This means everyone who has authorization to perform QA12 activities also has the ability to reset the usage decision on an inspection lot.
    i do this and copy the include LXQEVF10 to ZXQEVU10 and active this include, but dont have any reset button on qa12 again!
    also i dont have qm68 transaction in my system,what can i do to reverse inseption lots?
    thanks for your helps.   

    hi.
    i dont know why,but i cant upload any image.
    but i do this step by step :
    1. i find   EXIT_SAPMQEVA_008 :
       FUNCTION EXIT_SAPMQEVA_008.
    *"*"Lokale Schnittstelle:
    *"       IMPORTING
    *"             VALUE(I_QALS) LIKE  QALS STRUCTURE  QALS
    *"             VALUE(I_QAVE) LIKE  QAVE STRUCTURE  QAVE
    *"             VALUE(I_RQEVA) LIKE  RQEVA STRUCTURE  RQEVA
    *"       EXPORTING
    *"             VALUE(E_EXIT_ACTIVE) LIKE  QM00-QKZ
    *"       TABLES
    *"              T_CHARACTERISTIC_RESULTS STRUCTURE  QAMKR
      INCLUDE ZXQEVU10.
    ENDFUNCTION.
    2.i copy this code to ZXQEVU10 :
       ***INCLUDE LXQEVF10.
    *-- Example: Reset the Usage decision
    *-- Please add your own authority requirements here or
    *-- use the authority check within the general status management
    *-- by adding a user status profile
    *-- Reset Status Usage Decision by using business transaction QM68.
    CALL FUNCTION 'QAST_PROCESS_ACTIVITY'
         EXPORTING
    *         I_DIALOG             = 'X'
              I_OBJNR              = I_QALS-OBJNR
              I_VORGANG            = 'QM68'
         EXCEPTIONS
              NOT_ALLOWED          = 1
              ACTIVITY_NOT_ALLOWED = 2
              OTHERS               = 3.
    E_EXIT_ACTIVE = 'X'.
    and active it.

  • FM \ BAPI for complaint status.

    Hi Frinds,
    Kindly suggest me FM \ BAPI to update the complaint status..
    Regards,
    Narendra Goyal

    Dear Narendra,
    You can use FMs CRM_STATUS_MAINTAIN_OW and BAPI_TRANSACTION_COMMIT in order to update the status. Below is the sample code:
    wa_status-ref_guid = v_guid.
    wa_status-ref_kind = 'A'.
    wa_status-status = 'XXXXX'.            "Status to be Set
    wa_status-user_stat_proc = 'Z****'.  " Status Profile
    wa_status-activate = 'X'.
    INSERT wa_status INTO TABLE t_status.
    wa_input_field-ref_guid = lv_guid.      " GUID of the Complaint for which status has to be set
    wa_input_field-ref_kind  = 'A'.
    wa_input_field-objectname  = 'STATUS'.
    wa_input_field_names-fieldname = 'ACTIVATE'.
    INSERT wa_input_field_names INTO TABLE wa_input_field-field_names.
    INSERT wa_input_field_names INTO TABLE t_input_field_names_tab.
    INSERT wa_input_field  INTO TABLE  t_input_field.
    CALL FUNCTION 'CRM_STATUS_MAINTAIN_OW'
    EXPORTING
       it_status_com              = t_status
       iv_check_only              = true
      CHANGING
        ct_input_field_names       = t_input_field_names_tab
    EXCEPTIONS
       not_allowed                = 1
       error_occurred             = 2
       warning_occurred           = 3
       OTHERS                     = 4 .
    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 'BAPI_TRANSACTION_COMMIT'.
    ENDIF.

  • Disable Address Check

    Hi,
    I am trying to change the address of the Connection object through a Function Module using BDC of the transaction Code ES57.
    Issue is that on the screen of ES57 there is a subscreen which internally does the Address Validation and a pop up is displayed when there is any inconsistency in the Address passed to the Screen.
    i want to disable this address check function.
    Is there any function Module to do this.
    Regards

    Hi,
    instead of a batch input maybe you should use the function modules to change the connection object, maybe something like:
    FUNCTION zzzzzzzz_connobj_change.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(X_HAUS) LIKE  EHAU-HAUS DEFAULT '6100000004'
    *"     REFERENCE(X_WMODE) LIKE  REGEN-WMODE DEFAULT '2'
    *"  EXCEPTIONS
    *"      SYSTEM_ERROR
      DATA: y_obj TYPE  isu01_connobj,
            y_auto  TYPE  isu01_connobj_auto,
            y_db_update LIKE  regen-db_update.
      CALL FUNCTION 'ISU_O_CONNOBJ_OPEN'
        EXPORTING
          x_haus         = x_haus
          x_wmode        = '1'
          x_upd_online   = 'X'
          x_no_dialog    = 'X'
        IMPORTING
          y_obj          = y_obj
          y_auto         = y_auto
        EXCEPTIONS
          not_found      = 1
          existing       = 2
          foreign_lock   = 3
          invalid_key    = 4
          number_error   = 5
          system_error   = 6
          not_authorized = 7
          not_customized = 8
          status         = 9
          OTHERS         = 10.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      break aaf550.
      y_obj-addr1_data_new-house_num1 = '111111'.
      y_obj-addrobj-auto_addr_data = y_obj-addr1_data_new.
      y_obj-addrobj-changed = 'X'.
      y_obj-contr-upd_online = 'X'.
      y_obj-contr-no_dialog = 'X'.
      y_obj-contr-db_update = 'X'.
      y_obj-contr-wmode = x_wmode.
      y_obj-contr-enq_done = 'X'.
      CALL FUNCTION 'ISU_O_CONNOBJ_ACTION'
        EXPORTING
          x_okcode     = 'SAVE'      "=co_save aus ieokcode
          x_no_message = 'X'
        CHANGING
          xy_obj       = y_obj
        EXCEPTIONS
          not_allowed  = 1
          cancelled    = 2
          open_error   = 3
          duplicate    = 4
          OTHERS       = 5.
      IF    sy-subrc <> 0
         OR y_obj-ehau-haus IS INITIAL.
        RAISE system_error.
      ENDIF.
      COMMIT WORK.
      CALL FUNCTION 'ISU_O_CONNOBJ_CLOSE'
        IMPORTING
          y_db_update = y_db_update
        CHANGING
          xy_obj      = y_obj.
    ENDFUNCTION.
    Cheers,

  • Status sequence: exclude status from the middle of the min/max range

    Dear Experts!
    I have customized status schema and determined the status sequence. Etherything works well, but I need to exclude status from the range of statuses that user can set from the current status. For example, I have statuses:
    10 status1 min-20 max-40
    20 status2 min-10 max-30
    30 status3 min-20 max-40
    40 status4 min-40 max-40
    And I need to let user set from "status1" only statuses "status2" and "status4", but not "status3". How can I do it without changing positions of statuses? Hope for your help.
    Regards,
    Vladimir

    Thank you for your reply, Robert!
    But how exactly can I do this? Should I use an exception NOT_ALLOWED of the method BEFORE_CHANGE? When I was trying to debug this method, I could operate only with one status (from importing parameters) defined by the filter of BADi CRM_ORDER_STATUS. Hope for your reply.
    Regards,
    Vladimir

  • Question on Proxy authentication

    There are two users, schema_A and schema_B
    alter user schema_A grant connect through schema_B
    role all except NOT_ALLOWED
    please correct me if am wrong, the above line means schema_B will get all the roles of schema_A except role NOT_ALLOWED.
    here the privilege on NOT_ALLOWED is let say create table and alter on schema_A.table. which means schema_B is not allowed to create table and alter on schema_A.table right?
    when i connect as proxy, we can still create those and alter which we do not want, please can you help me on this.
    conn schema_B[schema_A]/schema_B
    Appreciate your help. Thanks much.

    can any one please answer?

  • How to raise an exception in the badi

    Hi friends..I've got the badi to be used for my object.Badi workorder_confirm
    requirement is " if data is entered in one field leaving a field emprty,it should give an error message saying "Field is mandatory". I can make use of ERROR_WITH_MESSAGE exception for the message to be generated..
    but dont know the syntax of it..please provide me with the statement how the message needs to be raised

    Looking at the BAdI Documentation it says this:
    Note that in the methods, no system messages may be sent. The only      
    exceptions are the AT_SAVE and AT_CANCEL_CHECK methods. Within these    
    methods, a system message may be issued, but only if you trigger the    
    exception ERROR_WITH_MESSAGE (for AT_SAVE method) or NOT_ALLOWED (for   
    AT_CANCEL_CHECK method) at the same time.                                                                               
    Note also, that within the methods the "commit work" instruction may not
    be carried out because this would lead to incorrect data in the         
    database.                                                               
    So the only thing you can do is use:
    RAISE ERROR_WITH_MESSAGE.

  • If image file not exist in image path crystal report not open and give me exception error problem

    Hi guys my code below show pictures for all employees
    code is working but i have proplem
    if image not exist in path
    crystal report not open and give me exception error image file not exist in path
    although the employee no found in database but if image not exist in path when loop crystal report will not open
    how to ignore image files not exist in path and open report this is actually what i need
    my code below as following
    DataTable dt = new DataTable();
    string connString = "data source=192.168.1.105; initial catalog=hrdata;uid=sa; password=1234";
    using (SqlConnection con = new SqlConnection(connString))
    con.Open();
    SqlCommand cmd = new SqlCommand("ViewEmployeeNoRall", con);
    cmd.CommandType = CommandType.StoredProcedure;
    SqlDataAdapter da = new SqlDataAdapter();
    da.SelectCommand = cmd;
    da.Fill(dt);
    foreach (DataRow dr in dt.Rows)
    FileStream fs = null;
    fs = new FileStream("\\\\192.168.1.105\\Personal Pictures\\" + dr[0] + ".jpg", FileMode.Open);
    BinaryReader br = new BinaryReader(fs);
    byte[] imgbyte = new byte[fs.Length + 1];
    imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
    dr["Image"] = imgbyte;
    fs.Dispose();
    ReportDocument objRpt = new Reports.CrystalReportData2();
    objRpt.SetDataSource(dt);
    crystalReportViewer1.ReportSource = objRpt;
    crystalReportViewer1.Refresh();
    and exception error as below

    First: I created a New Column ("Image") in a datatable of the dataset and change the DataType to System.Byte()
    Second : Drag And drop this image Filed Where I want.
    private void LoadReport()
    frmCheckWeigher rpt = new frmCheckWeigher();
    CryRe_DailyBatch report = new CryRe_DailyBatch();
    DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter ta = new CheckWeigherReportViewer.DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter();
    DataSet1.DataTable_DailyBatch1DataTable table = ta.GetData(clsLogs.strStartDate_rpt, clsLogs.strBatchno_Rpt, clsLogs.cmdeviceid); // Data from Database
    DataTable dt = GetImageRow(table, "Footer.Jpg");
    report.SetDataSource(dt);
    crv1.ReportSource = report;
    crv1.Refresh();
    By this Function I merge My Image data into dataTable
    private DataTable GetImageRow(DataTable dt, string ImageName)
    try
    FileStream fs;
    BinaryReader br;
    if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImageName))
    fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
    else
    // if photo does not exist show the nophoto.jpg file
    fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
    // initialise the binary reader from file streamobject
    br = new BinaryReader(fs);
    // define the byte array of filelength
    byte[] imgbyte = new byte[fs.Length + 1];
    // read the bytes from the binary reader
    imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
    dt.Rows[0]["Image"] = imgbyte;
    br.Close();
    // close the binary reader
    fs.Close();
    // close the file stream
    catch (Exception ex)
    // error handling
    MessageBox.Show("Missing " + ImageName + "or nophoto.jpg in application folder");
    return dt;
    // Return Datatable After Image Row Insertion
    Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP]

Maybe you are looking for