Quantcast
Channel: SCN: Message List - SAP CRM: Webclient UI - Framework
Viewing all articles
Browse latest Browse all 7775

Re: CRM_ORDER_MAINTAIN not working in badi ORDER_SAVE

$
0
0

Hi,

 

are you getting any error? any exceptions after executing order_maintain.

 

also here you can read the reviewer bp number and keep it in a local variable, and pass it to partner function employee responsible.

 

The code can look like below.

 

 

 

IF iv_guid IS NOT INITIAL.

               lv_bp = '10010237'"read bp no of reviewer and keep it in a local variable



*   fill input fields for partner

    CLEAR ls_input_fields.

    CLEAR ls_input_field_names.

    REFRESH lt_input_field_names.



    ls_orderadm_h-guid = iv_guid.

    ls_orderadm_h-process_type = 'SRVR'.

    APPEND ls_orderadm_h TO lt_orderadm_h.



    ls_input_fields-ref_guid     = iv_guid.

    ls_input_fields-ref_kind     = 'A'.

    ls_input_fields-objectname   = 'PARTNER'.



    ls_input_field_names-fieldname = 'PARTNER_NO'.

    INSERT ls_input_field_names INTO TABLE lt_input_field_names.

    ls_input_field_names-fieldname = 'PARTNER_FCT'.

    INSERT ls_input_field_names INTO TABLE lt_input_field_names.

    ls_input_field_names-fieldname = 'DISPLAY_TYPE'.

    INSERT ls_input_field_names INTO TABLE lt_input_field_names.

    ls_input_field_names-fieldname = 'KIND_OF_ENTRY'.

    INSERT ls_input_field_names INTO TABLE lt_input_field_names.

    ls_input_field_names-fieldname = 'NO_TYPE'.

    INSERT ls_input_field_names INTO TABLE lt_input_field_names.







    ls_input_fields-field_names = lt_input_field_names.



    ls_partner-ref_guid           = iv_guid.

    ls_partner-ref_kind           = 'A'.

    ls_partner-kind_of_entry      = 'C'.

    ls_partner-partner_fct        = '00000014'.

    ls_partner-partner_no         = lv_bp.

    ls_partner-display_type       = 'BP'.

    ls_partner-no_type            = 'BP'.

    APPEND ls_partner TO lt_partner.



    INSERT ls_input_fields INTO TABLE lt_input_fields.

               CALL FUNCTION 'CRM_ORDER_MAINTAIN'

                EXPORTING

                  it_partner                    = lt_partner

                CHANGING

                  ct_orderadm_h                 = lt_orderadm_h

                  ct_input_fields               = lt_input_fields

                EXCEPTIONS

                  error_occurred                = 1

                  document_locked               = 2

                  no_change_allowed             = 3

                  no_authority                  = 4

                  OTHERS                        = 5 .

               IF sy-subrc <> 0.

* Implement suitable error handling here

               ENDIF.



               ls_save = iv_guid.

               APPEND ls_save to it_save.



               CALL FUNCTION 'CRM_ORDER_SAVE'

                 EXPORTING

                   it_objects_to_save           = it_save

                 IMPORTING

                   et_saved_objects             = it_saved_objects

                   et_objects_not_saved         = it_objects_not_saved

                 EXCEPTIONS

                   document_not_saved           = 1

                   OTHERS                       = 2

                         .

               IF sy-subrc <> 0.

* Implement suitable error handling here

               ELSE.

                 CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

               ENDIF.

      ENDIF.

 

Also can you kindly convey in which method of order_save badi you are writing the code.

 

 

Best Regards,

Kiruthika K.


Viewing all articles
Browse latest Browse all 7775

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>