cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass Shopping cart currency to local PO currency in SRM 7.0

Former Member
0 Kudos

Hi all,

Currently iam working in SRM 7.0 , extended classic scenario. Can any one help me how to pass shopping cart current to local PO currency created

I mean what ever currency value we will maintain in SC same should reflect in local PO also. Please let me know which BADI is useful to solve this issue.

Thanks in advance !!!

Regards,

Kalyani

Accepted Solutions (0)

Answers (3)

Answers (3)

george_odogu
Discoverer
0 Kudos

Dear all

I found a solution to pass the Shopping Cart currency to local Purchase Order via modification tested in SRM 701 (in my case with activated Public Sector Procurement funct.):

1. Create INSERT modification in include LBBP_PD_SCF0Y line 295ff and change return value LV_VEN_CURRENCY of FORM GET_PO_CURRENCY to LS_SC_ITEM-CURRENCY:

IF NOT lv_be_pur_org IS INITIAL.

  IF {insert your conditions}. " Condition if Shopping Cart item currency should be used

    lv_ven_currency = ls_sc_item-currency.

  ELSE. " SAP Standard

    PERFORM get_po_currency

      TABLES

        lt_orgdata

        lt_partner

      USING

        lv_be_pur_org

        ls_sc_item-logsys_fi

      CHANGING

        lv_ven_currency.

  ENDIF.

ENDIF.

2. Create INSERT modification in function module BBP_PD_PO_CREATE line 239ff and change return value LV_PO_CURRENCY of FORM PO_GET_CURRENCY to I_HEADER-CURRENCY:

IF sy-subrc = 0.

  IF {insert your conditions}. " Condition if Shopping Cart item currency should be used

    lv_po_currency = i_header-currency.

  ELSE. " SAP Standard

    PERFORM po_get_currency

      TABLES

        i_orgdata

        i_partner

      USING

        i_header

      CHANGING

        lv_po_currency.

  ENDIF.

ENDIF.

3. Additionally I implemented a verification in Shopping Cart check BAdI (BBP_DOC_CHECK_BADI) to ensure that the splitted/grouped Shopping Cart items for Purchase Orders have the same currency:

DATA: lo_pdo_sc            TYPE REF TO /sapsrm/if_pdo_bo_sc,

            lo_sourcing_split TYPE REF TO /sapsrm/cl_bbp_sc_transfer_sourcing,

            lt_sc_item            TYPE bbp_pdt_sc_item_d,

            lt_items_guids     TYPE /sapsrm/t_pdo_soco_ref_tab,

            lt_split_po            TYPE bbpt_bs_object_pack,

            ls_items_guids    TYPE /sapsrm/s_pdo_soco_ref_tab,

            lv_first_itm_curr   TYPE waers.

FIELD-SYMBOLS:

            <fs_sc_item>           TYPE bbp_pds_sc_item_d,

            <fs_split_po>           TYPE bbps_bs_object_pack,

            <fs_split_po_items> TYPE bbp_pds_transfer_item.

IF flt_val = 'BUS2121' AND iv_doc_guid IS NOT INITIAL.

  CALL FUNCTION 'BBP_PD_SC_GETDETAIL'

    EXPORTING

      i_guid  = iv_doc_guid

    TABLES

      e_item = lt_sc_item.

  DELETE lt_sc_item WHERE del_ind = 'X'.

  IF lt_sc_item IS NOT INITIAL.

    TRY.

        " Get instance of current Shopping Cart

        lo_pdo_sc ?= /sapsrm/cl_pdo_factory_sc_adv=>get_buffered_instance( iv_header_guid = iv_doc_guid ).

        " If you call check routine via transaction BBP_PD, SC couldn't exist in the buffer
        " Caution: This if statement may only be executed for transaction BBP_PD, otherwise error after copying SC
        IF lo_pdo_sc IS NOT BOUND AND sy-tcode = 'BBP_PD'.
          lo_pdo_sc ?= /sapsrm/cl_pdo_factory_sc_adv=>get_instance( iv_header_guid = iv_doc_guid
                                                                                                              iv_mode        = /sapsrm/if_pdo_constants_gen_c=>gc_mode_display ).
        ENDIF.

        " Only execute when instance of SC exists (no instance exists at SC creation phase)

        IF lo_pdo_sc IS BOUND.

          " Prepare SC item table for PO split preview

          CLEAR lt_items_guids.

          LOOP AT lt_sc_item ASSIGNING <fs_sc_item>.

            CLEAR ls_items_guids.

            MOVE-CORRESPONDING <fs_sc_item> TO ls_items_guids.

            ls_items_guids-ref = lo_pdo_sc.

            APPEND ls_items_guids TO lt_items_guids.

          ENDLOOP.

          " Initialize objects

          CREATE OBJECT lo_sourcing_split.

          " Get PO split preview

          CALL METHOD lo_sourcing_split->preview_po_split

            EXPORTING

              it_items_guids = lt_items_guids

            IMPORTING

              et_split_po       = lt_split_po.

          " Prevent the creation of PO out of SC items with different currencies per item group (splitting; i.e. vendor, contract, etc.)

          LOOP AT lt_split_po ASSIGNING <fs_split_po>.

            LOOP AT <fs_split_po>-items ASSIGNING <fs_split_po_items>.

              IF sy-tabix = 1. " Save the currency of first item...

                lv_first_itm_curr = <fs_split_po_items>-currency.

              ELSE. " ... and compare the currency of first item with the others

                IF lv_first_itm_curr NE <fs_split_po_items>-currency.

* Show Error message; i.e. "Item &: Currency must match to Curr. of item & (same PO group)"

                ENDIF.

              ENDIF.

            ENDLOOP.

          ENDLOOP.

        ENDIF.

    CATCH.

* Error handling...

    ENDTRY.

  ENDIF.

ENDIF.

I hope this solution will help you to fulfil your requirments.

Regards

George Odogu

former_member183819
Active Contributor
0 Kudos

i think richardo already informed what is standard and workaround.

muthu

Former Member
0 Kudos

Hi Muthuraman,

I have gone through the Ricardo's reply. It is very helpful. But as per our business requirement what ever the currency we maintain in Shopping cart same currency should reflect in PO also. It should not consider the vendor currency that we maintain in SRM.

Kindly let me know if there is any BADI where we can write the code to meet this requirmnet As per my analysis i understood that this new badi should trigger after the BBP_DOC_CHANGE_BADI . Because after this BBP_DOC_CHANGE_BADI only the system considering the currency from the SRM vendor currency that we maintain.

Thanks

Regards,

Kalyani Dadi

laurent_burtaire
Active Contributor
0 Kudos

Hello Kalyani,

Sorry, i did not see you are in extended classic scenario.

You could try also with BBP_DOC_SAVE_BADI BAdI.

If no BAdI covers your need, maybe enhancement in LBBP_PD_SCF0Y include from BBP_PD_SC_MAP_TO_PO_LOC function module could answer to your request.

If vendor exists, currency is changed to his own:


    MOVE et_po_item-gross_price TO lv_item_price.

    IF lv_no_curr_recalc EQ gc_no AND et_po_item-itm_type <> c_hier.
      PERFORM recalc_vendor_currency TABLES   it_sc_orgdata
                                              it_sc_partner
                                     USING    lv_convert_date
                                              it_sc_item-currency
                                              lv_item_price
                                              lt_h_ref_list-item_guid
                                     CHANGING lv_recalc_price
                                              lv_ven_currency
                                              lv_rcode.

Regards.

Laurent.

Former Member
0 Kudos

Hi Laurent,

Thanks alot for your helpful reply. First I have tried with 'BBP_DOC_SAVE_BADI' but here in this BADI there are export parameters.

After this i have treid withe FM 'BBP_PD_SC_MAP_TO_PO_LOC' but it is not getting triggered.

Actually i have created a SC orderd and approved it. After approval the local PO is automatically getting gnerated . But this FM

'BBP_PD_SC_MAP_TO_PO_LOC' is not getting hit in this process.

Can you please suggest me at what point this FM will get trigger. So that i can wriite the custom code for the same by copying this FM.

Thanks.

Regards,

Kalyani.

laurent_burtaire
Active Contributor
0 Kudos

Hello,

>

(...)

> Actually i have created a SC orderd and approved it. After approval the local PO is automatically getting gnerated . But this FM

> 'BBP_PD_SC_MAP_TO_PO_LOC' is not getting hit in this process.

> (...).

Process is done in background by WF-BATCH user, so if you put a break-point with your own user, you will not be stopped at this break-point.

Create an enhancement with an endless loop, then after ordering your SC, go to SM50 transaction and then start debugging for process concerned.

Regards.

Laurent.

Former Member
0 Kudos

Hi Laurent,

Thanks alot for your wonderful reply. My issue got fixed.

Regards,

Kalyani

laurent_burtaire
Active Contributor
0 Kudos

Hello Kalyani,

So, you can mark this thread as "answered".

Regards.

Laurent.

Former Member
0 Kudos

Hi laurent,

Sorry for my delay in responding back. Busy with lots of other stuff.When we tested this scenario now it is not working.

The Function module 'BBP_PD_SC_MAP_TO_PO_LOC' is triggering first when we are approving the shopping cart and then the BBP_DOC_CHANGE_BADI . In the FM 'BBP_PD_SC_MAP_TO_PO_LOC' system is considering the vendor currency and as per our business scenario we wrote the code in BBP_DOC_CHANGE_BADI implementation to change it to Shopping cart line item currency.

But here the problem was after BBP_DOC_CHANGE_BADI the FM BBP_PROCDOC_CREATE is getting triggered. In this in include 'LBBP_PDF0K' the Shopping cart line item currency is again converting back to vendor currency.

Code :

call function 'BBP_PDBUP_CREATE'

exporting

i_p_guid = i_header-guid

i_new_guid = new_guid

i_new_kind = gc_object_kind-orderadm_h

i_ref_p_guid = p_ref_guid

i_com = l_bup_icom

importing

e_com = l_bup_ecom

tables

i_partner = i_partner.

  • procurement data

if l_bup_ecom-currency is not initial

and l_object_type = c_po

and i_hdrhgp-subtype = c_subtype_ep.

  • i_hdrhgp-currency = l_bup_ecom-currency.

if not p_retained_currency is initial and

p_retained_currency = i_hdrhgp-currency.

  • Do nothing

else.

i_hdrhgp-currency = l_bup_ecom-currency.

endif.

endif.

move-corresponding l_had_ecom to l_hgp_icom.

l_hgp_icom-ev_vendor_changed = l_bup_ecom-ev_vendor_changed.

l_hgp_icom-vendor = l_bup_ecom-vendor.

Can you please help me in this regard.

Thanks in advance.

Regards,

Kalyani

Former Member
0 Kudos

Hi Kalyani,

Are you still looking for some clue. Let me know.

Thanks.

Former Member
0 Kudos

Hi Kalyani,

Are you still looking for solution?

Regards,

Surender

laurent_burtaire
Active Contributor
0 Kudos

Hello Kalyani,

See threads below:

[How to make SC currency as a leading in the PO|;

[PO in R/3 to take SC currency?|;

It is for SRM lower releases than 7.0, but it is equivalent.

Regards.

Laurent.