on ‎2012 Jan 19 11:11 AM
Hi ,
I need to upload the contracts to SRM using the BAPI BBP_PD_CTR_CREATE.Can anybody please tell me what are the parameters that have to be passed to this FM for successful creation of contracts.
Thanks and Regards,
Rohini
Request clarification before answering.
Hi,
I have researched about it and I would like provide you some information in order to help you.
You would have to call the below functions to create the contract:
BBP_PD_CTR_CREATE
BBP_PD_CTR_SAVE
COMMIT WORK
You can upload (Tab Delimited) Excel file having contract data using GUI_UPLOAD function with following parameters. That is an example, I have no tested it.
**********************************************************************************************
*-- Convert filename to a string
w_filename = p_file.
*-- Upload data from file to an internal table
*-- File must be saved as TXT Comma Delimited
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = w_filename
has_field_separator = 'X'
dat_mode = 'X'
TABLES
data_tab = t_input_data
EXCEPTIONS
file_open_error = 1
file_read_error = 2
invalid_type = 5
OTHERS = 17.
file browsing option can be provide on selection-screen using following FM call.
DATA: wl_filediag_fil1(200) VALUE 'C:\test.csv', "Infile name
wl_filediag_path_1(200) VALUE 'C:\',
wl_filediag_mask_1(200) VALUE ',.,..',
wl_filediag_title_1(40) VALUE 'File to upload'.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = wl_filediag_fil1
def_path = wl_filediag_path_1
mask = wl_filediag_mask_1
title = wl_filediag_title_1
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
Once data will be there in ITAB- t_input_data you can go for following FM calls,
*--Reset Buffer Tables
CALL FUNCTION 'BBP_PROCDOC_RESET_BUFFER'.
*-- Creat Contracts using FM
CALL FUNCTION 'BBP_PD_CTR_CREATE'
EXPORTING
i_header = wa_header
IMPORTING
e_header = wa_ret_hdr
TABLES
i_item = t_item
i_partner = t_partner
i_longtext = t_longtext
i_orgdata = t_orgdata
e_messages = t_messages.
*--Set 'Contract Status' --. 'Released' I1141
CALL FUNCTION 'BBP_PROCDOC_STATUS_CHANGE'
EXPORTING
i_guid = wa_ret_hdr-guid "--> Cntr-Header-GUID
i_activity = c_release_contract "--> 'CTRE'
i_object_type = c_contract "--> 'BUS2000113'
TABLES
e_messages = t_m_status "Message Log
CHANGING
e_changed = w_changing. "Flag
*--Reset Buffer Tables
CALL FUNCTION 'BBP_PROCDOC_RESET_BUFFER'.
*--Commit work
COMMIT WORK AND WAIT.
IMPORTANT -
Reseting of BUFFER tables before and after making call to FM - BBP_PD_CTR_CREATE is mandatory to avoid any discrepancy during CONTRACT Creation.
**********************************************************************************************
I hope it help you.
Cheers,
Rafael Rhoden
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rafael,
i wanted only the status of the contract to be changed to Released for a contract in any status, say, saved,complete etc.
i tried using
*--Set 'Contract Status' --. 'Released' I1141
CALL FUNCTION 'BBP_PROCDOC_STATUS_CHANGE'
EXPORTING
i_guid = wa_ret_hdr-guid "--> Cntr-Header-GUID
i_activity = c_release_contract "--> 'CTRE'
i_object_type = c_contract "--> 'BUS2000113'
TABLES
e_messages = t_m_status "Message Log
CHANGING
e_changed = w_changing. "Flag
after executing this FM, also executed the BAPI_TRANSACTION_COMMIT,
The status of the contract is not changing, is there anything that i am missing. what are the steps to change the status of the document using a FM ?
regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.