Skip to Content
author's profile photo Former Member
Former Member

PR type

Hello friend

We use SRM server 5.5 with classic scenario.

We will use the BADI BBP_SC_TRANSFER_BE to determine the PR type and number range.

But I’m not sure the following logic is correct.

Could you check this?

We have two PR type in R/3.

1) KGPR (Genernal Buy PR)

2) KTR1 (Tooling PR)

As you know that shopping cart has no shopping cart type. So we add customer field to mapping to PR type in R/3 and CUF has two values.

1) PR01: mapping to KGPR

2) PR02: mapping to KTR1

We will use the method GROUP_RQ to determine the PR type.

If customer field is PR01, PR type is determined KGPR

If customer field is PR002, PR type is determined KTR1.

To determine the PR number range, we will use the method GET_NUMBER_OR_RANGE.

If PR type is KGPR, Choose the No key 12

If PR type is KTR1, Choose the No key 16.

Configuration step:

1. Maintain the PR number range in SRM.

No key: 12 (for KGPR) internal NR

No range: 2520000000 – 2529000000

No key: 16 (for KTR1) internal NR

No range: 2560000000 – 2569000000

2. Maintain the PR number range in R/3

No key: 12 (for KGPR) Ext NR

No range: 2520000000 – 2529000000

No key: 16 (for KTR1) Ext NR

No range: 2560000000 – 2569000000

3. Assign the PR number range to PR type in R/3

KGPR – 12 (EXT)

KTR1 – 16 (EXT)

4. Maintain the attribute in SRM

Document type in R/3

Add KGPR and KTR1

Thank you

Best Regards

SH

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 06, 2007 at 08:12 AM

    Hi

    <b>I hope you must have read the documentation of the BADI - BBP_BS_GROUP_BE</b>

    <u>Anyways, here it is.</u>

    
    BBP_BS_GROUP_BE
    ____________________________________________________
    Short Text
    Grouping of Shopping Cart Items for Follow-on Documents
    
    Use
    
    The BAdI BBP_BS_GROUP_BE provides the following options:
    
    Alternative to the standard, you can use method GROUP_RQ_BACKEND to define your own grouping for purchase requisitions. The system creates as standard only one purchase requisition for all purchase requisitions with the same backend document type . If the document types are different, then the standard creates one purchase requisition for each document type.
    In the case of purchase orders the following fields are standardly used for grouping:
    Vendor
    Purchasing organization
    Purchasing group
    Contract
    Document type
    Company code
    Using method GROUP_PO_BACKENDyou can take the grouped items and, using criteria you have chosen yourself that is not at document-header level, you can group the items more precisely.
    In the case of reservations, the system creates as standard a separate reservation for each item. You can override this using method GROUP_RS_BACKEND . Depending on item and account assignment data, you control how many reservations are to be created from requirement items. You can create
    a reservation for all items or
    multiple reservations for the items.
    The method also takes into account customer fields in item and account assignment data.
    Alternative to the standard, you can use method
    GET_NUMBER_OR_RANGE
    to override determination of the number range object and the number assignment for the following document types:
    Purchase orders
    Purchase requisitions
    Reservations
    
    Note: 
    Method GET_NUMBER_OR_RANGE can not be used for grouping.
    
    Standard settings
    
    SRM calls the BAdI during data transfer into the backend system.
    
    The interface also takes into account customer fields in item and account assignment data.
    
    The transfer process for requirements always occurs in the following sequence for each backend system:
    
    1. First there is the grouping of purchase requisitions using method GROUP_RQ_BACKEND. As part of purchase requisition processing, the method GET_NUMBER_OR_RANGE is called up for each grouping criterium for number assignment. This also applies to the grouping of
    reservations using method GROUP_RS_BACKEND.
    2. In the case of purchase orders standard group occurs first by way of the fields named above. You can also use method GROUP_PO_BACKEND to determine if a further grouping is to take place.
    Method GET_NUMBER_OR_RANGE can be used for each grouping criteria.
    
    Example
    
    You are using the BAdI, for example, in the following context:
    
    your own number range assignment and standard grouping for purchase requisitions
    (you use only method GET_NUMBER_OR_RANGE)
    number range assignment as in the standard and your own grouping for purchase requisitions.
    (you use only method GROUP_RQ_BACKEND)
    your own number range assignment and your own grouping for
    purchase requisitions.
    (you use both methods GET_NUMBER_OR_RANGE and GROUP_RQ_BACKEND)
    See also
    
    Define Number Ranges for Shopping Carts and Follow-on Documents
    Define Number Ranges per Backend System for Follow-on Documents
    Methods:
    GROUP_RQ_BACKEND
    GROUP_PO_BACKEND
    GROUP_RS_BACKEND
    GET_NUMBER_OR_RANGE

    Hope this will help.

    Please reward suitable points, incase it suits your requirements.

    Regards

    - Atul

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 06, 2007 at 08:13 AM

    Hi

    <b>Please read the docuemntation of this BADI - BBP_SC_TRANSFER_BE</b>

    <u>before making any code changes.</u>

    ----


     
    
    BBP_SC_TRANSFER_BE
    ____________________________________________________
    Short Text
    Determine Number Ranges and Grouping in Backend Documents
    
    Use
    
    The Business Add-In BBP_BS_GROUP_BE offers the following options:
    
    You can, independent of the standard, use the method GROUP_RQ to create a separate grouping for purchase requisitions.
    In the standard, the system creates only one purchase requisition in the backend for all purchase requisitions with the same backend document type . If the document types are different, the standard creates a separate purchase requisition for each document type.
    In the case of purchase orders , the grouping is made by the following fields in this order:
    Vendor
    Purchasing organization
    Purchasing group
    Contract
    Document type
    Item
    Company code
    In the second step, you can use the method GROUP_PO to create further groupings of the grouped items according criteria you have selected yourself and that are not on header level.
    In the case of reservations in the standard, the system creates a separate reservation for each item. You can override this with a BAdI for grouping reservations (BBP_RESERVATION_GRP).
    
    Independent of the standard, you can use the method GET_NUMBER_OR_RANGE to override the determination of the number range object and the number assignment for the following document types:
    Purchase orders
    Purchase requisitions
    Reservations
    
    Note: 
    The method GET_NUMBER_OR_RANGE, cannot be used for the grouping.
    
    Standard settings
    
    Enterprise Buyer calls the BAdI during data transfer into the backend system.
    
    The interface also takes into account customer fields in item data and account assignment data.
    
    The transfer process for requirements always occurs on each back end in the following order:
    
    1. First, the BANFs are grouped according to the method GROUP_RQ. Within BANF processing, there is one call of the method GET_NUMBER_OR_RANGE for number assignment for each of the grouping criteria.
    2. You can override the grouping of reservations using the BAdI Grouping of Reservations (BBP_RESERVATION_GRP) and its method RESERVATION_GRP. In this case there is also one call of the method GET_NUMBER_OR_RANGE for number assignment for each of the grouping criteria.
    3. For purchase orders, first the standard grouping is created according to the fields above. You can then also use the method GROUP_PO to control whether you require further grouping. The method GET_NUMBER_OR_RANGE can be used for each grouping criterion.
    
    Example
    
    You use the BAdI, for example, in the following context:
    
    Separate number range assignment and standard grouping for purchase requisitions
    (You only use method GET_NUMBER_OR_RANGE)
    Number range assignment as in the standard and a separate grouping for purchase requisitions.
    (You only use method GROUP_RQ)
    Separate number range assignment and separate grouping for purchase requisitions.
    (You use both methods, GET_NUMBER_OR_RANGE and GROUP_RQ)
    See also
    
    Define Number Ranges for Shopping Carts and Follow-on Documents
    Define Number Ranges per Backend System for Follow-on Documents
    Methods:
    GET_NUMBER_OR_RANGE
    GROUP_RQ
    GROUP_PO
    

    ----


    
    Method GROUP_RQ
    
    Group Purchase Requisition
    
    Functionality
    The method provides parameters to group purchase requisitions.
    
    If, when determining the number range interval, you use a grouping different from the standard, or if you wish to assign your own number, you must use this method.
    
    
    Parameters
    Importing
    
    IT_ITEM 
    Data of all requisition items including customer fields
    IT_ACCOUNT 
    Account assignment data of all requisition items including customer
    fields
    IT_PROC_ACCOUNT 
    Account data for current item
    IV_OBJECT_TO_GENERATE 
    Check result: Document to be created (purchase order, reservation, purchase requisition)
    Changing 
    
    CT_PROC_ITEM
    Purchasing-relevant item data; contains the field GROUP_1.
    If you wish to group the table again, you must fill GROUP_1 with a numerical value (for example, 001, 002...). All records that belong to the same group have the same value. Using this grouping criteria, the system sorts the table before the number assignment occurs.
    CV_METHOD_ACTIVE
    Flag showing if the BAdI changes the grouping
    X Grouping is changed in BAdI
    If you set this flag, then Enterprise Buyer combines the requisition items according to the grouping criteria defined in the BAdI in one or more purchase requisitions.
    ' ' no change
    grouping takes place as in the standard.
    
    
    Notes
    See the sample coding.
    To use the customer fields, note the following access sequence:
    To access customer fields of requisition items, read changing table CT_PROC_ITEM. Use the value from PREQ_ITEM to read importing table IT_ITEM with key field NUMBER_INT.
    To access customer fields of account assignment data, repeat the step described above for the item. Then, use the value from field GUID to read importing table IT_ACCOUNT with key field P_GUID.
    
    

    ----


    Method GET_NUMBER_OR_RANGE
    
    Determine Number Range Interval or New Number
    
    Functionality
    Dependent on the import parameter data, the method GET_NUMBER_OR_RANGE controls a number range determination that differs from the standard. The method is called only once for each grouping criterion.
    
    Requirements
    If you use a number range interval as a return value in the field CV_NUMBER_RANGE, you must have previously defined this interval in Customizing. For more information, see Determining number ranges for shopping carts and follow-on documents 
    
    
    Parameters
    Importing
    
    IS_ITEM 
    Item data (purchase order examples: account assignment, fixed vendor), including customer-defined fields.
    IS_PROC 
    Enriched, purchasing-relevant data
    IT_PROC_ACCT
    Account assignment data for the current item
    IT_ACCOUNT
    Account assignment data for all request items, including customer-defined fields
    IV_OBJECT_TO_GENERATE
    Check result: Document to be created (purchase order, reservation, purchase requisition)
    IV_LOGICAL_SYSTEM
    Logical system
    Changing 
    
    CV_NUMBER_RANGE
    Number of the standard number range; the number range determined by the SAP standard is transferred as as default.
    CV_NUMBER
    Number of the purchase requisition; transferred empty to the method. If this field remains empty, the system uses CV_NUMBER_RANGE to determine the new number.
    
    
    Notes
    See the sample coding.
    For using customer fields, note the following access sequence:
    To access customer fields of the request items, you also use the import structure IS_ITEM and then, using the value from the GUID field, read the import table IT_ACCOUNT with the key field P_GUID.
    
    

    <b>NOTE -> All the configuration that needs to be is also explained in the Documenatation as well.</b>

    Hope this will help.

    Please reward suitable points, incase it suits your requirements.

    Regards

    - Atul

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 06, 2007 at 08:17 AM

    Hi

    <b>Here is the sample code for the BADI -> BBP_SC_TRANSFER_BE

    (Exit for Transferring Shopping Cart to the Backend).</b>

    method IF_EX_BBP_SC_TRANSFER_BE~GET_NUMBER_OR_RANGE .
    
    * IV_OBJECT_TO_GENERATE
    *   '1' Reservation
    *   '2' Purchase Requsition (BANF)
    *   '3' Purchase Order
    *   '4' Customer Object
    
    
    * 1. current item data are in structures
    *    - IS_ITEM shopping cart item data including Customer Fields
    *    - IS_PROC backend relevant item purchasing data
    
    
    * 2. accounting data in tables
    *    - IT_ACCOUNT all shopping cart account. data with Customer Fields
    *    - IT_PROC_ACCOUNT backend relevant accounting data for current item
    
    *  - key criteria between this tables are
    *    - it_proc_account-preq_item
    *                     -serial_no (numc 2)
    *    - guid from is_item
    *    - it_account-p_guid
    *                -accno(numc 4)
    
    
    
    *--------------------------------------------------------------------
    * A) example to use current item data + item customer fields
    *--------------------------------------------------------------------
    *  if is_proc_item-DOC_TYPE = 'ABCD' AND
    *     is_item-<field of CI_BBP_ITEM> = .
    * set own number range
    *  CV_NUMBER_RANGE = .
    
    
    ** set own number
    ** .. ==> if initial SAP Standard with no.range will be processed
    
    *  CV_NUMBER = .
    
    *  endif. " is_proc_item / is_item
    
    *--------------------------------------------------------------------
    * B) example to use only proc_account no accounting customer fields
    *--------------------------------------------------------------------
    *data:
    *     ls_proc_account   type bbp_bapipogna.
    
    *  loop at it_proc_account
    *            into ls_proc_account.
    *
    *
    *    if ls_proc_account-BUS_AREA = '9988'.
    
    ** set own number range
    *  CV_NUMBER_RANGE = .
    
    
    ** set own number
    ** .. ==> if initial SAP Standard with no.range will be processed
    
    *  CV_NUMBER = .
    
    *     endif. " ls_proc_account
    *
    *  endloop.
    
    
    *--------------------------------------------------------------------
    * C) example to use only accounting customer fields, no other accounting
    *--------------------------------------------------------------------
    *data:
    *     ls_account        type bbp_pds_acc.
    
    *  loop at it_account
    *            into ls_account
    *            where p_guid = is_item-guid.
    
    *    if ls_account-<field of CI_BBP_ACC> = .
    ** set own number range
    *  CV_NUMBER_RANGE = .
    
    
    ** set own number
    ** .. ==> if initial SAP Standard with no.range will be processed
    
    *  CV_NUMBER = .
    
    *   endif. " ls_account
    
    *  endloop.
    
    *--------------------------------------------------------------------
    * D) example to use proc_account + customer fields for accounting
    *--------------------------------------------------------------------
    *data:
    *     lv_serial_no      type bbp_bapipogna-serial_no,  " sequence num 2
    *     lv_acc_no         type bbp_pds_acc-acc_no,       " sequence num 4
    *     ls_proc_account   type bbp_bapipogna,
    *     ls_account        type bbp_pds_acc.
    
    *  loop at it_proc_account
    *            into ls_proc_account.
    *
    *    move ls_proc_account-serial_no to lv_acc_no.
    *    read table it_account
    *         into ls_account
    *         with key p_guid = is_item-guid
    *                  acc_no = lv_acc_no.
    *
    *    if sy-subrc = 0.
    *
    **     if ls_account-<field of CI_BBP_ACC> = .
    *
    ** set own number range
    **  CV_NUMBER_RANGE = .
    *
    *
    ** set own number
    ** .. ==> if initial SAP Standard with no.range will be processed
    *
    **  CV_NUMBER = .
    *
    **      endif. " ls_account
    *
    *    endif. " sy-subrc
    *  endloop.
    
    endmethod.

    ----


    ----

    method IF_EX_BBP_SC_TRANSFER_BE~GROUP_RQ .
    
    * 1. current item data are in structures
    *
    *    - IT_ITEM all shopping cart item data including Customer Fields
    *    - IT_PROC_ITEM backend relevant item data of current log.system
    *
    *    key criteria between this tables are:
    *    - IT_ITEM-NUMBER_INT (numc 10)
    *    - IT_PROC_ITEM       (numc  5)
    
    * 2. accounting data in tables
    *
    *    - IT_ACCOUNT all shopping cart account. data incl. Customer Fields
    *    - IT_PROC_ACCOUNT backend relevant accounting data for current item
    *
    *  - key criteria between this tables are
    *    - it_proc_account-preq_item (numc 5)
    *                     -serial_no (numc 2)
    *    - is_item-guid
    *             -number_int (numc 10)
    *    - it_account-p_guid
    *                -accno(numc 4)
    
    constants:
          lc_on(1)               VALUE 'X'.
    
    
    *--------------------------------------------------------------------
    * A) example to use only proc_item with NO customer fields
    *         group requisitions by backend document type
    *--------------------------------------------------------------------
    *data: lv_doc_type            TYPE esart,
    *      ls_proc_item           type BBPS_PROCUREMENT,
    *      lv_group_counter       type numc5.
    *
    *
    *    clear lv_group_counter.
    *    clear lv_doc_type.
    *    SORT ct_proc_item BY obj_to_gen doc_type.
    *
    *    LOOP AT ct_proc_item
    *            into ls_proc_item
    *            WHERE obj_to_gen EQ iv_object_to_generate.
    
    ** new group criteria?
    *      if lv_doc_type ne ls_proc_item-doc_type.     " backend doc.type
    *
    *        lv_group_counter = lv_group_counter + 1.   " increase counter
    *        lv_doc_type      = ls_proc_item-doc_type.       " save criteria
    *
    *      endif.
    *
    *      ls_proc_item-group_1 = lv_group_counter.
    *
    *      modify ct_proc_item from ls_proc_item
    *             transporting group_1.
    *
    *    ENDLOOP.
    
    *--------------------------------------------------------------------
    * B) example to use item customer fields
    *--------------------------------------------------------------------
    
    * data:
    *      ls_proc_item           type BBPS_PROCUREMENT,
    *      lv_cust_field          type <field of ci_bbp_item>.
    *      lv_number_int          type BBP_ITEM_NO,
    *      ls_item                type BBP_PDS_TRANSFER_ITEM.
    
    *    clear lv_group_counter.
    *    clear lv_cust_field .
    *    SORT ct_proc_item BY obj_to_gen.
    *
    *
    *    LOOP AT ct_proc_item
    *            into ls_proc_item
    *            WHERE obj_to_gen EQ iv_object_to_generate.
    
    ** get item data which includes customer fields
    *      move ls_proc_item-preq_item to lv_number_int. " convert
    *      read table it_item
    *           into ls_item
    *           with key number_int = lv_number_int.
    *
    *      if sy-subrc = 0.
    *
    **       new group criteria?
    *        if lv_cust_field ne 'XYZ'.
    *
    *         lv_group_counter = lv_group_counter + 1.   " increase counter
    *         lv_cust_field = ls_item-<field of ci_bbp_item>."save criteria
    *
    *        endif. " lv_cust_field
    
    *        ls_proc_item-group_1 = lv_group_counter.
    *
    *        modify ct_proc_item from ls_proc_item
    *               transporting group_1.
    *
    *      endif.  " sy-subrc
    *
    *    ENDLOOP.
    
    *--------------------------------------------------------------------
    * C) example to use accounting data with customer fields
    *            group requisitions by backend document type
    *--------------------------------------------------------------------
    *data: lv_doc_type            TYPE esart,
    *      ls_proc_item           type BBPS_PROCUREMENT,
    *      lt_account             type BBPT_PD_ACC,
    *      ls_account             type bbp_pds_acc,
    *      ls_item                type BBP_PDS_TRANSFER_ITEM,
    *      lv_number_int          type BBP_ITEM_NO,
    *      lv_account_flag        type c,
    *      lv_group_counter       type numc5.
    *
    *
    *    clear lv_group_counter.
    *    clear lv_doc_type.
    *    SORT ct_proc_item BY obj_to_gen doc_type.
    *
    *    lt_account[] = it_account[].
    *    SORT lt_account BY p_guid acc_no.
    *
    *    LOOP AT ct_proc_item
    *            into ls_proc_item
    *            WHERE obj_to_gen EQ iv_object_to_generate.
    *
    ** get accounting customer fields for this item
    *    clear lv_account_flag.
    *
    ** ..first get item guid
    *    move ls_proc_item-preq_item to lv_number_int.
    *    read table it_item
    *         into ls_item
    *         with key number_int = lv_number_int.
    *
    *    if sy-subrc = 0.
    *
    *      loop at lt_account
    *           into ls_account
    *           where p_guid = ls_item-guid.
    *
    *        if ls_account-<field of CI_BBP_ACC> = .
    *           lv_account_flag = lc_on.
    *        endif.
    *
    *      endloop.
    *
    *    endif. " sy-subrc it_item
    *
    *
    ** new group criteria?
    *      if lv_doc_type ne ls_proc_item-doc_type OR     " backend doc.type
    *         lv_account_flag = lc_on.                    " accounting
    *
    *        lv_group_counter = lv_group_counter + 1.   " increase counter
    *        lv_doc_type      = ls_proc_item-doc_type.       " save criteria
    *
    *      endif.
    *
    *      ls_proc_item-group_1 = lv_group_counter.
    *
    *      modify ct_proc_item from ls_proc_item
    *             transporting group_1.
    *
    *    ENDLOOP.
    
    
    * !!!! set flag that BADI was processed
    * .. ==> no SAP Standard grouping will be processed
        cv_method_active = lc_on.
    
    endmethod.

    ----


    ----

    Hope this will help.

    Please reward suitable points, incase it suits your requirements.

    Regards

    - Atul

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 06, 2007 at 08:57 AM

    Hi

    Config Settings seems to be OK.

    Let me know, incase you face any difficulties.

    Hope this will help.

    Please reward suitable points, incase it suits your requirements.

    Regards

    - Atul

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.