cancel
Showing results for 
Search instead for 
Did you mean: 

Split PO in SRM

nanda_kondagunta
Explorer
0 Kudos

Hi,

Is there a badi to split the PO in EBP based on a cutom field in the shopping cart?

Thanks,

Kumar

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Its working now . thanks a lot

Former Member
0 Kudos

HI ,

I have the similar requirement, based on a different ship to address  in the shopping cart item details, we need to split the SC line item into multiple PO's .


if anyone has done , please help me .


we are using extenal classic scenario .



Regards,

Krishna

Former Member
0 Kudos

Hi Nanda,

I have the similar requirement, based on a particular custom field in the shopping cart item details, we need to split the SC line item into multiple PO's if the value in the custom field differs.

Please can you let me know how have you achieved the same.
I am using SRM 713, with Extended Classic Scenario.

Code snippet will help.

Thank You

Regards,

Aakash Awasthi

Former Member
0 Kudos

Hi,

For this purpose, use the BADI ZBBP_GROUP_LOC_PO if you are using standard, or extended classic scenario.

If you use classic scenario do as Jayasankar described.

PS: Diego, as soon as the purchaser assigns different SOS in the SC (purchaser completion WF as I described in your thread), you'll have different POs created.

Regards.

Vadim

Former Member
0 Kudos

Hello all,

It depends of the scenario.

For the shopping cart transfer to external ([How to|http://wiki.sdn.sap.com/wiki/display/SRM/TransferprocessoftheShopping+Cart]) you can use BADI BBP_SC_TRANSFER_BE (Exit for Transferring Shopping Cart to the Backend).

For the shopping cart in classic scenario, you can use BADI BBP_GROUP_LOC_PO (Exit Grouping of Items for Local Purchase Orders).

If you want, I have an example for the local solution:

METHOD if_ex_bbp_group_loc_po~group_po.
*------------------------------------------------------------------------------*
* Exit Grouping of Items for Local Purchase Orders
** Parameters
*ITEM_DATA  TYPE BBP_INT_ITEM_GROUP Item Data for Shopping Basket Item
*It contains the most important item details of the shopping cart and
*additionally in the field REFNUMBER a reference number for further
*processing purposes
*------------------------------------------------------------------------------*
* Method used to group item before PO creation
* How it work ?
* 1/ Select extra colons from table ZPO_SPLIT_CRITER
* 2/ Getting Compoents from existing type BBP_INT_ITEM_GROUP
* 3/ For each line recalcul Refnumber
**********************************************************************
* Declarations
**********************************************************************
*--------------------------------------------------------------------*
* Variable
*--------------------------------------------------------------------*
  DATA: lt_zpo_split_criter TYPE TABLE OF zpo_split_criter
      , ls_zpo_split_criter TYPE zpo_split_criter
      , lo_struct           TYPE REF TO cl_abap_structdescr
      , lt_field_list       TYPE ddfields
      , ls_field_list       TYPE dfies
      .

  DATA:
    lt_item_data     TYPE bbp_int_item_group
  , ls_item_data     TYPE bbp_int_item_groups
  , ls_back_data     TYPE bbp_int_item_groups
  , ls_modi_data     TYPE bbp_int_item_groups
  , l_fname          TYPE fieldname
  , l_refnumber      TYPE refnumber
  , l_tabix          TYPE sytabix
  , l_not_empty      TYPE c
  , l_act_not_empty  TYPE c
  .
*--------------------------------------------------------------------*
* Field symbols
*--------------------------------------------------------------------*
  FIELD-SYMBOLS: <lfs_refnumber>       TYPE bbp_int_item_groups-refnumber
               , <lfs_act_refnumber>   TYPE bbp_int_item_groups-refnumber
               , <lfs_field_value>     TYPE ANY
               , <lfs_act_field_value> TYPE AN
               .
*--------------------------------------------------------------------*
* Constants
*--------------------------------------------------------------------*
*  CONSTANTS:
*  .
**********************************************************************
* Process
**********************************************************************
* 1/ Select extra colons from table ZPO_SPLIT_CRITER
  SELECT * FROM zpo_split_criter INTO TABLE lt_zpo_split_criter
    WHERE split EQ 'X'.
  CHECK NOT lt_zpo_split_criter[] IS INITIAL.
  DELETE lt_zpo_split_criter WHERE fieldname = 'REFNUMBER'.

* 2/ Getting Compoents from existing type
  lo_struct ?= cl_abap_typedescr=>describe_by_name( 'bbp_int_item_groups' ).
  CALL METHOD lo_struct->get_ddic_field_list
    EXPORTING
      p_langu                  = sy-langu
      p_including_substructres = abap_true
    RECEIVING
      p_field_list             = lt_field_list
    EXCEPTIONS
      not_found                = 1
      no_ddic_type             = 2
      OTHERS                   = 3.
  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_zpo_split_criter INTO ls_zpo_split_criter.
*   Verify if field exist in table
    READ TABLE lt_field_list
         TRANSPORTING NO FIELDS
         WITH KEY fieldname = ls_zpo_split_criter-fieldname.
    CHECK sy-subrc EQ 0.

*   Copy table in internal
    lt_item_data[] = item_data[].

*   Sort table by REFNUMBER and fieldname
    SORT lt_item_data
      BY refnumber (ls_zpo_split_criter-fieldname)
      ASCENDING.

*   Clear internal value.
    CLEAR: l_refnumber
         .

    CONCATENATE 'LS_ITEM_DATA-' ls_zpo_split_criter-fieldname
      INTO l_fname.
    ASSIGN (l_fname) TO <lfs_act_field_value>.
    CHECK sy-subrc = 0.
    CONCATENATE 'LS_BACK_DATA-' ls_zpo_split_criter-fieldname
      INTO l_fname.
    ASSIGN (l_fname) TO <lfs_field_value>.
    CHECK sy-subrc = 0.
    CONCATENATE 'LS_ITEM_DATA-' 'REFNUMBER'
      INTO l_fname.
    ASSIGN (l_fname) TO <lfs_act_refnumber>.
    CHECK sy-subrc = 0.
    CONCATENATE 'LS_BACK_DATA-' 'REFNUMBER'
      INTO l_fname.
    ASSIGN (l_fname) TO <lfs_refnumber>.
    CHECK sy-subrc = 0.

    CLEAR: <lfs_refnumber>
         , <lfs_field_value>
         .

*   For each reccord in table, calculate new REFNUMBER
    LOOP AT lt_item_data INTO ls_item_data.
      MOVE sy-tabix TO l_tabix.
      IF <lfs_act_field_value> IS INITIAL.
        MOVE ' ' TO l_act_not_empty.
      ENDIF.

      IF ls_zpo_split_criter-as_not_blank IS INITIAL.
*       Case of each value on field create a new refnumber
        IF <lfs_field_value> NE <lfs_act_field_value> OR
           <lfs_refnumber> NE <lfs_act_refnumber> .
          l_refnumber = l_refnumber + 1.
          MOVE <lfs_act_field_value> TO <lfs_field_value>.
          MOVE <lfs_act_refnumber> TO <lfs_refnumber>.
        ENDIF.
      ELSE.
        IF l_not_empty NE l_act_not_empty OR
           <lfs_refnumber> NE <lfs_act_refnumber> .
          l_refnumber = l_refnumber + 1.
          MOVE l_act_not_empty TO l_not_empty.
          MOVE <lfs_act_refnumber> TO <lfs_refnumber>.
        ENDIF.

      ENDIF.
      ls_modi_data = ls_item_data.
      ls_modi_data-refnumber = l_refnumber.

      MODIFY item_data FROM ls_modi_data INDEX l_tabix
             TRANSPORTING refnumber.
    ENDLOOP.
  ENDLOOP.

ENDMETHOD.

It works with the table ZPO_SPLIT_CRITER as bellow:

CLIENT                 MANDT

FIELDNAME         FIELDNAME

SPLIT                 BOOLE_D

AS_NOT_BLANK BOOLE_D

If you need more information, contact me directly.

Regards,

David BOUTIER<BR>

Consultant technique Sap Netweaver - KALYDIA

www.kalydia.com Paris

Edited by: David BOUTIER on Jun 27, 2011 11:38 AM

Former Member
0 Kudos

Hi Nanda,

Please look at Business Add-In BBP_SC_TRANSFER_BE, its Method GROUP_RQ and GROUP_PO. You can use to overwrite the standard and group SC items based on custom rules to create split the PO or RQ in EBP.

Good Luck.

Thanks,

Jay

diegohs
Active Participant
0 Kudos

Hi Kumar,

Did you solve this ? In my case, the purchaser guy must decide the supplier and as a result, how many PO's are created.

Do you have any clue about it ?

Thanks for your response,

Regards from Mexico,

Diego