cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement order_save Badi

Former Member
0 Kudos

Hello All ,

I want to read the transaction before save ,so I am calling crm_order_read FM in check_before_save .

But I am confused how to pass Header Guid in exporting parameter .

If possible please provide source code .

Regards ,

Rasika.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Rasika

If I remember correctly the Parameter you're referring is an Internal Table.

So you'll need to pass the value from a Structure into the Table

DATA lv_guid          TYPE crmt_object_guid.

  DATA lt_header_guid   TYPE crmt_object_guid_tab.

  lv_guid = '123'. " Your Transaction GUID

  INSERT lv_guid INTO TABLE lt_header_guid.

Regards

Arden

Former Member
0 Kudos

Hi Arden ,

The below code I have written in check_before_save and I set the break point on FM .

But this is not working .

please help me .

DATA : ET_ORDERADM_H TYPE CRMT_ORDERADM_H_WRKT ,

       ET_ORDERADM_I TYPE CRMT_ORDERADM_I_WRKT ,

       guid TYPE CRMT_OBJECT_GUID_TAB ,

       lv_guid TYPE crmt_object_guid .

lv_guid = iv_guid .

INSERT lv_guid INTO TABLE guid .

   CALL FUNCTION 'CRM_ORDER_READ'

    EXPORTING

      IT_HEADER_GUID                    = guid

    IMPORTING

      ET_ORDERADM_H                     = ET_ORDERADM_H

     ET_ORDERADM_I                     = eT_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 <> 0.

* Implement suitable error handling here

   ENDIF.

if eT_ORDERADM_I IS INITIAL .

   MESSAGE : 'plz check data before saving prepare.........' TYPE 'I' .

   ENDIF .



Former Member
0 Kudos

Hi Rasika

When you debug this is there a value in iv_guid?

What error are you currently getting?

Regards

Arden

Former Member
0 Kudos

No errors .it is not calling debugger , directly printing the msg even not checking condition .

Former Member
0 Kudos

The problem is I have edited the implementation ,but it is not showing changes .

Former Member
0 Kudos

Thank you Arden.

Can you tell mi how to raise DO_NOT_SAVE exception of method CHECK_BEFORE_SAVE ?

If any source code is available please provide me .

Regards,

Rasika

Answers (2)

Answers (2)

Former Member
0 Kudos

And Rasika do_not_save is an exception in CHECK_BEFORE_SAVE.


Only you have to write RAISE do_not_save if you do not want to save the current processing document.

if iv_error = 'X'.

           RAISE do_not_save.

endif.

Former Member
0 Kudos

Thank You.

I implemented the Badi.

Former Member
0 Kudos

Hi Rasika,

As I found your code is correct.

Can you check the value of sy-subrc after crm_order_read?

and if it is displaying message plz check data before saving prepare......... then please check if any Item is there in your order??


And r u sure badi implementation is active??


means badi implantation  Runtime Behavior  is Implementation will be called?


with regards,

Pramod Kumar Mandal.