cancel
Showing results for 
Search instead for 
Did you mean: 

How to add conditions when uploading contracts

Former Member
0 Kudos

Hi experts

I'm trying to upload contracts from a text file using BAPI BBP_PD_CTR_CREATE.

I'm not able to create conditions with the contracts. Can anyone tell me the mandatory parameters that have to be passed in the BAPI in its it_conditions table.

This is what I'm doing:

wa_condition-guid = c_dummy_cnd. "Dummy guid

wa_condition-cond_type = l_condtyp.

wa_condition-COND_PRC_UNIT = '0'.

wa_condition-COND_RATE = l_condval.

wa_condition-COND_CURR = l_condcurncy.

wa_condition-COND_TAB = l_condtab.

wa_condition-date_from = l_valstart.

wa_condition-date_to = '99991231'.

APPEND wa_condition to tbl_condition_ex.

Points will be rewarded...

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

Please find the code below:-

LOOP AT lt_item ASSIGNING <fs_item_u>.

CALL FUNCTION 'GUID_CREATE'

IMPORTING

ev_guid_16 = lv_guid.

ls_conditions-guid = lv_guid.

ls_conditions-cond_type = '01CT'.

ls_conditions-p_guid = <fs_item_u>-guid.

ls_conditions-cond_rate = <fs_item_u>-price.

ls_conditions-cond_unit = <fs_item_u>-unit.

ls_conditions-cond_curr = <fs_item_u>-currency.

ls_conditions-cond_prc_unit = <fs_item_u>-price_unit.

ls_conditions-date_from = sy-datum.

ls_conditions-date_to = '99991231'.

ls_conditions-time_from = '000000'.

ls_conditions-time_to = '235959'.

ls_conditions-cond_tab = 'SAP016'.

APPEND ls_conditions TO et_conditions.

ENDLOOP.

Regards,

Neelima

Answers (2)

Answers (2)

Former Member
0 Kudos

Solved

After debugging the BAPI I found that there was an authorisation problem with my user.

Thanks

Former Member
0 Kudos

Hi Neelima

I tried with the code that you had provided but I still couldn't create the discount conditions.

Here is my code in more detail:

IF l_condtyp = '01AG'. "Header discount

l_condtab = 'SAP019'. "Table for header discount

wa_condition-p_guid = c_dummy_hdr. "Dummy guid of header

ELSE.

IF l_condplant IS NOT INITIAL . "Location dependant item discount

wa_condition-INVENT_LOC_ID = l_condplant. "Adding location

l_condtab = 'SAP068'. "Table for location dependant discount

wa_condition-p_guid = c_dummy_itm. "Dummy guid of item

wa_condition-COND_UNIT = l_unit. "Unit of item

ELSE. "Location independant item discount

l_condtab = 'SAP016'. "Location independant discount table

wa_condition-p_guid = c_dummy_itm. "Dummy guid of item

wa_condition-COND_UNIT = l_unit. "Unit of item

ENDIF.

ENDIF.

wa_condition-guid = c_dummy_cnd. "Dummy guid

wa_condition-cond_type = l_condtyp. "(01AG)

wa_condition-COND_RATE = l_condval. "(15-)

wa_condition-COND_CURR = l_condcurncy. "(%)

wa_condition-COND_TAB = l_condtab. "(SAP019)

wa_condition-date_from = sy-datum. "(also tried vper_start ie. start date of contract)

wa_condition-date_to = '99991231'.

wa_condition-time_from = '000000'.

wa_condition-time_to = '235959'.

wa_condition-UOM_DENOMINATOR = '1'.

wa_condition-UOM_NUMERATOR = '1'.

APPEND wa_condition to tbl_condition_ex.

CLEAR wa_condition.

The importing table is still empty after the FM has been executed. There are no messages in the messages table either.

Please help me out here.

This is very urgent.

Thanks