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

Change document type on follow on document in Classic Scenario

Hi All,

We have the classic scenario of SRM.

We have a requirement that PR with specific document type should be created in the backend,based on some field values in the Shopping cart.

I created an implementation for the BADI, BBP_CREATE_BE_RQ_NEW for this requirement, but it doesnt seem to be working.

Is there any other BADI which lets you change the document type for the follow on document, PR in our case.

Please let me know.

Thanks in Advance,


Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2009 at 06:32 PM

    Hi Binu,

    The BADI you have implemented is correct.Please paste the code here for further analysis.I dont think there is any other BADI available for your requirement.The badi BBP_CREATE_BE_RQ_NEW is BADi to be used.,but may be you have coded it incorrectly due to which you are not getting the correct o/p.

    Another way would be to use the user exit function EXIT_SAPLMEWQ_001 in the BAPI BAPI_REQUISITION_CREATE for document type mapping as mentioned in below thread :





    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2009 at 04:19 AM

    Hi Deepti,

    This is the code:

    DATA: gs_sc_item TYPE bbp_pds_transfer_item," SC Item table

    gs_rq_items TYPE bbps_badi_rq_item, " PR Items table

    gv_tabix TYPE sytabix,

    gv_item_no(5) TYPE n,

    gv_sc_no TYPE crmt_object_id_db, " Shopping Cart No.

    gs_sc_account TYPE bbps_pdext_acc, " SC Account table

    gs_rq_accnt_assignm type BBPS_BADI_RQ_ACCOUNT.

    CONSTANTS: c_doctype TYPE bbsrt VALUE 'GP', " Document Type

    c_item_cat TYPE pstyp VALUE '2', " Item Category

    c_vmi TYPE bbp_acc_cat VALUE 'FI'. " VMI Identifier

    TYPES: BEGIN OF ty_sc_det,

    cart_no TYPE crmt_object_id_db,

    guid TYPE bbp_guid,

    END OF ty_sc_det.

    DATA: gt_sc_det TYPE STANDARD TABLE OF ty_sc_det,

    gs_sc_det type ty_sc_det.

    CLEAR: gs_sc_item.

    LOOP AT is_sc_document-item INTO gs_sc_item.

    gv_tabix = sy-tabix.

    • Read the account table for the SC Line Item

    READ TABLE is_sc_document-account INTO gs_sc_account

    WITH KEY p_guid = gs_sc_item-guid.

    • Check if the Account Assignment Category on SC line item

    • corresponds to VMI

    IF sy-subrc = 0 AND gs_sc_account-acc_cat = c_vmi

    AND NOT gs_sc_account IS INITIAL.

    • Get the PR line item corresponding to SC line item

    READ TABLE cs_rq_document-it_requisition_items index gv_tabix INTO gs_rq_items.

    IF sy-subrc = 0 AND NOT gs_rq_items IS INITIAL.

    • gv_tabix = sy-tabix.

    • Set the item category and document type on PR line item

    gs_rq_items-item_cat = c_item_cat.

    gs_rq_items-doc_type = c_doctype.

    • Get the SC Number using the GUID

    SELECT SINGLE object_id FROM crmd_orderadm_h INTO gv_sc_no

    WHERE guid = gs_sc_item-parent.

    IF sy-subrc = 0 AND NOT gv_sc_no IS INITIAL.

    • Assign the SC number to the tracking number field on PR line item

    gs_rq_items-trackingno = gv_sc_no.


    MODIFY cs_rq_document-it_requisition_items INDEX gv_tabix FROM gs_rq_items

    TRANSPORTING doc_type trackingno item_cat.



    CLEAR: gv_item_no, gs_sc_account,

    gs_rq_items, gv_tabix, gv_sc_no.


    If I attempt to change the doc type or item category, PR no gets relected in transaction, bbp_pd. However the same is not available in r/3 system.

    If i just change fields like tracking no or description and not document type, PR gets successfully created in backend.

    Please let me know your inputs.



    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.