cancel
Showing results for 
Search instead for 
Did you mean: 

Uploading contracts into SRM from flat file...

Former Member
0 Kudos

I am asked to develop this program but I am not sure what transactions are involved and what approach to take.

I know how to upload the file but not sure how to upload the contracts to SRM.

Thanks for the help.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Emir,

you can upload (Tab Delimited) [Excel file] having contract data using GUI_UPLOAD function with following parameters.

*-- 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.

Reward points if needful.

Regards,

Rakesh B Bhagat.

[Infosys Technologis Ltd., India]

Email : rakesh_bhagat@infosys.com

0 Kudos

Hi Rakesh,

I have encountered the same difficulty in creating the contract as well. Thanks for your code sample. I have tried to follow it closely but still i am not successful. Is it possible for you to take a look at my code?

data: pc_id like CRMD_ORDERADM_H-OBJECT_ID.

data: pc_header_out like BBP_PDS_CTR_HEADER_IC.

data: pc_header_in like BBP_PDS_CTR_HEADER_D.

*data: pc_item type table of BBP_PDS_CTR_ITEM_D with header line.

data: pc_item type table of BBP_PDS_CTR_ITEM_ICU with header line.

data: pc_text type table of BBP_PDS_LONGTEXT.

data: pc_partner type table of BBP_PDS_PARTNER.

data: wa_part like line of pc_partner.

data: pc_org type table of BBP_PDS_ORG with header line.

data: pc_message type table of BBP_PDS_MESSAGES with header line.

Insert dummy data*****************************************************

pc_header_out-CURRENCY = 'SGD'.

pc_header_out-PROCESS_TYPE = 'PCTR'.

  • Insert Purchase Org data *********************************************

pc_org-PROC_ORG_RESP_ID = 'O 50000026'.

pc_org-PROC_ORG_ID = 'O 50000025'.

pc_org-PROC_GROUP_ID = 'O 50000026'.

  • Insert BP data - vendor, employee Purch Org and DSTA******************

*DSTA

wa_part-PARTNER_ID = '0000000001'.

wa_part-PARTNER_GUID = '4BD22A16AFA2B74D844E1595998AE7E5'.

wa_part-PARTNER_FCT = '00000038'.

wa_part-ADDR_TYPE = '1'.

wa_part-ADDR_NO = '0000010469'.

append wa_part to pc_partner.

clear wa_part.

*employee

wa_part-PARTNER_ID = '0000000006'.

wa_part-PARTNER_GUID = 'E3D4AAE842930D41B7B107F3CC60B44D'.

wa_part-PARTNER_FCT = '00000026'.

wa_part-ADDR_TYPE = '3'.

wa_part-ADDR_NO = '0000010472'.

wa_part-PERS_NO = '0000010474'.

append wa_part to pc_partner.

clear wa_part.

*vendor

wa_part-PARTNER_ID = '0000000311'.

wa_part-PARTNER_GUID = 'F0BC646129BE2D4BB7E301F8F3708B1E'.

wa_part-PARTNER_FCT = '00000019'.

wa_part-ADDR_TYPE = '1'.

append wa_part to pc_partner.

clear wa_part.

*purch org

wa_part-PARTNER_ID = '0000000002'.

wa_part-PARTNER_GUID = '48459C575651D04091BAF1B9A554CF51'.

wa_part-PARTNER_FCT = '00000051'.

wa_part-ADDR_TYPE = '1'.

wa_part-ADDR_NO = '0000010470'.

append wa_part to pc_partner.

clear wa_part.

  • Item data

pc_item-CATEGORY_ID = 'ARMOUR'.

pc_item-QUANTITY = '233'.

pc_item-PRICE = '1234'.

pc_item-VALUE = '4321'.

pc_item-UNIT = 'EA'.

pc_item-PRODUCT = 'B78A60018B6018418F6D0F1632E10F69'.

pc_item-DESCRIPTION = 'Russian T72 Tanks'.

*--Reset Buffer Tables

CALL FUNCTION 'BBP_PROCDOC_RESET_BUFFER'.

Create PC*************************************************************

call function 'BBP_PD_CTR_CREATE'

exporting

I_HEADER = pc_header_out

importing

E_HEADER = pc_header_in

tables

I_ITEM = pc_item

E_PARTNER = pc_partner

I_ORGDATA = pc_org

I_LONGTEXT = pc_text

E_MESSAGES = pc_message.

write: pc_header_in-guid.

the guid return all 0s. The error message in pc_message is supply only one type of vendor and one type of responsible employee. Thanks for taking time to read this. I will really appreciate if anyone is able to help me solve this. Of course point will be rewarded. Thanks again!

Former Member
0 Kudos

This approach is giving me tons of errors.

Do anyone else has good idea?

Fileupload

BBP_PD_CTR_CREATE

BBP_PD_CTR_SAVE

and COMMIT.

Former Member
0 Kudos

hai emir,

can you guide me how to upload purchase order in srm?.

thanks .. vj

yann_bouillut
Active Contributor
0 Kudos

Hi Emir,

For flat files, please read former post :

Kind regards,

Yann

yann_bouillut
Active Contributor
0 Kudos

Hi Emir,

Report BBP_CONTRACT_INITIAL_UPLOAD enable you to do an initial report from R/3 to SRM.

As of SRM 5.0 , you get transaction MECCM in ECC 5.0 to do an extraction of contracts reading EKKO and EKPO tables.

File is sent in XML format to XI.

This feature was designed to send contract data to SAP CCM.

Kind regards,

Yann