cancel
Showing results for 
Search instead for 
Did you mean: 

BBPV_CONTRACT_CREATE

0 Kudos

Hi!! any body have documentation about FM BBPV_CONTRACT_CREATE.

Thank!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

This function module BBPV_CONTRACT_CREATE is not called directly. SAP has not given any documenattion in this case.

<u>Instead this FM's used inside IDOC Type - BLAORD03.</u>

<u>However there is a<b> BADI -> BBP_CTR</b> Which is triggered when the Function module is called. Use transaction SE18 to refer the details of the BADI interface.

Incase you want to change the contract data, I can provide you the sample code - how to go about it. Do let me know your requirements at the earliest.</u>

<u>Here is the documentation of this BADI.</u>

Using Business Add-In BBP_CTR, you can change the IDoc data and the structure for the contract and the related conditions.


Requirements

You have set up the IDoc communication completely.

Standard settings

The method MODIFY_DATA _CTR of the BADI is called up before the mapping to the IDoc structures. This method take all the data that has reached R/3 and handles it as changeable parameters. You can only change this data before it is mapped to the IDoc structures.

The methods MODIFY_IDOC_DATA_CTR and MODIFY_IDOC_DATA_CND of the BADI are called up after all mappings to the IDoc structures have been made. These methods take all the data that has reached R/3 and handles it as non-changeable input parameters. In addition, the final result of the mappings is transferred to the IDoc structures. You can only modify this result before the IDoc is updated to the database.

The system uses

IDoc BLAORD03 for the contract data
IDoc COND_A02 for the conditions
The BAdI methods are described here in detail:

MODIFY_DATA_CTR
Serves for changing contract data in the IDoc and provides the following parameters:

Importing

IV_USER 
R/3 System, User's log-on name
IV_LANGU
R/3-System (log-on language)
IV_CALLING_LOGSYS
Logical system
Changing
CS_HEADER
Contract communication structure: Header/Org./Partner
CT_ITEMS 
Contract communication structure: Items/Partners
CT_TEXT 
Contract communication structure: Texts
CT_CND_CT 
BAPI Structure for condition tables (corresponds to COND_RECS)
CT_CND_HD 
CT_CND_HD 
BAPI Structure KONH 
CT_CND_IT 
BAPI Structure KONP
CT_CND_QS 
BAPI Structure KONM
CT_CND_VS
BAPI Structure KONW 
MODIFY_IDOC_DATA_CTR
Serves for changing contract data in the IDoc and provides the following parameters:

Importing

IV_USER 
R/3-System, user's log-on name
IV_LANGU
R/3-System (log-on language)
IV_CALLING_LOGSYS
Logical system
IS_HEADER
Contract communication structure: Header/Org./Partner
IT_ITEMS 
Contract communication structure: Items/Partners
IT_TEXT 
Contract communication structure: Texts
Changing

CT_BLAORD
Enterprise Buyer Contract (IDoc data EDIDD)
MODIFY_IDOC_DATA_CND
Serves for changing condition data in the IDoc and provides the following parameters:

Importing

IV_USER 
R/3 System, User's logon name
IV_LANGU
R/3 System (logon language)
IV_CALLING_LOGSYS
Logical system
IS_HEADER
Contract communication structure: Header/Org./Partner
IT_CND_CT 
BAPI Structure for condition tables (corresponds to COND_RECS)
IT_CND_HD 
BAPI Structure KONH 
IT_CND_IT 
BAPI Structure KONP
IT_CND_QS 
BAPI Structure KONM
IT_CND_VS
BAPI Structure KONW 

Changing

CT_DATA_CONDA 
Contract conditions (IDoc data EDIDD)
Recommendation

Ensure that the Idoc is consistent and syntactically correct after the modifications. You could perform a test run to check.

Activities

Implement the BAdI if you wish to change the contract data to be transferred via IDoc and the contract structure.

Hope this will help.

Please reward full points, incase it suits your requirement.

Regards

- Atul

Answers (2)

Answers (2)

0 Kudos

I am using SAP ECC 6.0

yann_bouillut
Active Contributor
0 Kudos

Hi Daniel,

Did you already check the following thread

Kind regards,

Yann

Former Member
0 Kudos

Hi

BADI - BBP_CTR

Here is sample BADI code. Create an Implementation of this BADI say, ZBBP_CTR, using SE19 transaction.

method if_ex_bbp_ctr~modify_data_ctr .
** Local data -----------------------------------------------------------
** Data declaration
  data: lv_ctr_creation        type c.
  data: lv_mm_contract_number  type bbp_bapi_ebeln_k.
  data: lv_error               type xfeld.

  data: ls_t161                type t161.
  data: ls_ekko                type ekko.

  data: lt_ctr_mm_item_map     type bbpt_ctr_mm_item_map.

** Main part ------------------------------------------------------------
** Check whether new contract number has to be created. The criteria are:
** 1. For the combination of SRM contract ID and purch Org no contract
**    exists.
** 2. No failed 'Contract Create' IDOC exists for the mentioned
**    combination
** Then get a new number from the number range of the MM
** contract type
**--- Check if contract exists
  call function 'BBPV_CONTRACT_STATUS_GET'
       exporting
            iv_header_object_id = cs_header-object_id
            iv_calling_logsys   = iv_calling_logsys
            iv_be_ekorg         = cs_header-be_purch_org
       importing
            ev_ctr_creation     = lv_ctr_creation
       tables
            et_ctr_mm_item_map  = lt_ctr_mm_item_map[].

  if lt_ctr_mm_item_map is initial.
** -> No mapping from SRM to R/3 contract exists for the SRM contract ID/
**    Purch org combination
    if lv_ctr_creation = 'E'.
**   -> No 'failed' or ' to be proceesed' IDOC exists
**---  Get new number from the MM contract number range
**     Determine the number range
      select single * from  t161
                      into  ls_t161
                      where bstyp  = 'K' and
                            bsart  = 'GCTR'.


**     Get the external contract number from a customer specific internal
**     number range. This is due to the fact that a IDOC contract can
**     only be created via an external number range.
      do.
        clear lv_error.
        call function 'NUMBER_GET_NEXT'
             exporting
                  nr_range_nr             = '44'
                  object                  = 'ZZCTR_SRM'
             importing
                  number                  = lv_mm_contract_number
             exceptions
                  interval_not_found      = 1
                  number_range_not_intern = 2
                  object_not_found        = 3
                  quantity_is_0           = 4
                  quantity_is_not_1       = 5
                  interval_overflow       = 6
                  buffer_overflow         = 7
                  others                  = 8.

        if sy-subrc <> 0.
          lv_error = 'X'.
          exit.
        endif.

**       Check if the number is in the external number range
        call function 'NUMBER_CHECK'
             exporting
                  nr_range_nr             = ls_t161-numke
                  number                  = lv_mm_contract_number
                  object                  = 'EINKBELEG'
             exceptions
                  interval_not_found      = 1
                  number_range_not_extern = 2
                  object_not_found        = 3
                  others                  = 4.

        if sy-subrc <> 0.
          lv_error = 'X'.
          exit.
        endif.

**       Check if number does not already exists
        select single *
         from  ekko
         into  ls_ekko
         where ebeln = lv_mm_contract_number.
        if sy-subrc = 0.
**       -> Contract number already allocated. Next try.
         continue.
        else.
**       -> Contract number ok
         exit.
        endif.
      enddo.

**     Set the new backend contract number
      check lv_error is initial.
      cs_header-be_object_id = lv_mm_contract_number.
      cs_header-process_type = 'GCTR'.
    endif.
  endif.

endmethod.

Hope this will help.

Please reward full points, incase it suits your requirement.

Regards

- Atul

Former Member
0 Kudos

Hi

Which SAP Version are you using ?

Regards

- Atul