cancel
Showing results for 
Search instead for 
Did you mean: 

order_save

Former Member
0 Kudos

Hi All,

I am implementing the BADI order_save. (the iv_guid present in this BADI is the header field in the table crmd_orderadm_i ).

I want to get the guid of the opportunity which i could pass to the fm CRM_ORDERADM_I_READ_OW and populate the structure ES_ORDERADM_I_WRK. i need the product details from this fm.

i tried to get the guid from the table using a select query by passing the iv_guid of the badi to the table.

But the values are not getting populated.

Are there any other methods using which i could get the guid of the opportunity.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

while implementating BADI order SAve.its very easy to work.for getting data just use Function Module CRM ORDER READ and you will get all data related to ur service order or sales order.

you have to just pass the GUID to this function Module if you want any code related to this BADI please do reply.

Regards,

Amol Tambe

SAP CRM technical Consultant.

Former Member
0 Kudos

Hi Amol,

Thanks for ur reply.

I wrote the code this way. I have a little doubt regarding the flags. can i write it this way.

DATA : LT_IT_HEADER_GUID TYPE CRMT_OBJECT_GUID_TAB ,

LT_ET_PRODUCT_I TYPE CRMT_PRODUCT_I_WRKT,

LT_ET_ORDERADM_I TYPE CRMT_ORDERADM_I_WRKT,

LT_ES_ORDERADM_I_WRK TYPE CRMT_ORDERADM_I_WRK,

FLAG1 TYPE I,

FLAG2 TYPE I.

CLEAR FLAG1.

CLEAR FLAG2.

APPEND IV_GUID TO LT_IT_HEADER_GUID.

CALL FUNCTION 'CRM_ORDER_READ'

EXPORTING

IT_HEADER_GUID = LT_IT_HEADER_GUID

IMPORTING

ET_ORDERADM_I = LT_ET_ORDERADM_I

ET_PRODUCT_I = LT_ET_PRODUCT_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.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LOOP AT LT_ET_ORDERADM_I INTO LT_ES_ORDERADM_I_WRK.

IF LT_ES_ORDERADM_I_WRK-ITM_TYPE EQ 'ZPG*'.

ADD 1 TO FLAG1.

ENDIF.

IF FLAG1 > 1.

MESSAGE 'There can be only one primary generic service offering' TYPE 'E'.

RAISE DO_NOT_SAVE.

ENDIF.

IF LT_ES_ORDERADM_I_WRK-ITM_TYPE EQ 'ZPS*'.

ADD 1 TO FLAG2.

ENDIF.

ENDLOOP.

IF FLAG2 > 1.

MESSAGE 'There can be only one primary specific service offering' TYPE 'E'.

RAISE DO_NOT_SAVE.

ENDIF.

thanks for the reply

Former Member
0 Kudos

Hi,

Your code is fine...But befor rasing the RAISE DO_NOT_SAVE. check that is it affecting the other parametrs of LT_ET_ORDERADM_I ..bcoz it can creat data mis match in ur badi implemntation.

Its somewht risky allwys when ur using flags in Badi implementations. so do it carefully..

Regards,

Amol Tambe

SAP CRM Technical Consultant.

Former Member
0 Kudos

Hi Amol,

I want to implement the same functionality using the BADI CRM_PRODUCT_I_BADI.

but here we get only the current values. how do i check the item type of the entries that are already present in the opportunity.

when i pass the guid to the fm crm_order_read it is returning only the current value which we give. how do i get the values that are already present in the opportunity.

Thanks,

Navitha

Former Member
0 Kudos

Hi,

I am not getting wht exactly wht you want ? Could you pls explain in more detail ????

Do you want data for all line items for by single execution of FM CRM_ORDER_READ ?????? in that Badi CRM_PRODUCT_I_BADI ? Correct ? that is wht i understand ?

Please clarify...?

Regards,

Amol Tambe

SAP CRM Technical Consultant.

Former Member
0 Kudos

Hi,

I want the details of all the products which are already present in the opportunity along with the current one which we are entering.

In order_save badi i am able to get all the values, but in this crm_product_i_badi when the pass the guid i am getting only the current value.

can i use some other fm for this purpose.

Former Member
0 Kudos

Hi navitha,

For this u can use same Badi ORDER_SAVE through this BADI you can get details of all the products which are already present in the opportunity..

Mee too also used the same badi for raising the error msg for wrong price fmly for a particular product.

In this BADI also you have to use Same Function Module

CRM_ORDER_READ.

Through FM CRM ORDERREAD you can get all product details related to that order.

There is one more way to do this for this get sales order no from FM CRM ORDERREAD and then call this Remote Enabled function module BAPISDORDER_GETDETAILEDLIST

in your.

Do u know how to call Remote Enabled function modules in CRM for this u have to get particular R/3 destination for ur CRM server.

ok this FM BAPISDORDER_GETDETAILEDLIST will directly give all data related to that sales order from R/3 itself in which you will get Price famly, item cat, group i.e. each and every data related to every product present in the opportunity.

do all above things in same BADI itself ORDER_SAVE.

If you have any problms regarding how to call Remote Enabled function modules in CRM pls do reply ?

I think this will solve ur problm?

Regards,

Amol Tambe

SAP CRM Technical Consultant.

Former Member
0 Kudos

Hi Navitha,

Ur problm solved or not Related to BADI ORDER_SAVE.

Regards,

Amol Tambe.

SAP CRM Technical Consultant.

Former Member
0 Kudos

Hi Amol,

Thanks for u r replies. My problem is solved using the badi order_save.

I wanted to implement the same functionality using another BADI crm_product_i_badi.

But now it is not required.

Anyways thank you very much.

Regards,

Navitha

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Navitha,

Pass the IV_GUID to the table CRMD_ORDER_INDEX along with OBJECT_TYPE = BUS2000111.

This will fetch you the guid of opportunity.

First check by manually entering values in the table CRMD_ORDER_INDEX using SE16. If it works, implement the same in your BADI.

Also if you need the Product Details, I think function module CRM_ORDER_READ would be good option.

Hope this helps.

Thanks.

Best Regards,

Arun Sankar.