Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to force contract start and end date while creating it using a BAPI

Former Member
0 Likes
1,776

Hi Experts,

I am using one BAPI BAPI_CONTRACT_CREATEFROMDATA to create contracts from reference of an existing contract.

VA43 Contracts are getting created, however, I am unable to force contract start and end dates in them, the start and end dates are being taken automatically from start date and end date determination rule, when I try not to pass these rules, the contract is having the dates determined based on these rules only.

Example the rules are as below-

Rule Description

01   Today's Date
04   Acceptance Date
05   Installation Date
06   Date Contract Signed
07   Billing Date
09   Contract End Date
14   Contract Ende (Contract header)
19   End of Contract - 1 Month
21   First of Current Month
31   Last of Current Month
33   Last of Month of Contract End
40   End of Current Quarter
50   Monthly on First of Month
51   Monthly on Last of Month
52   Horizon 1 Year
53   Monthly

I am clearing the rules from being passed to "contract_data_in" parameter of the BAPI. Kindly help.

Thanks

Mohit

Hi Experts,

I am using one BAPI BAPI_CONTRACT_CREATEFROMDATA to create contracts from reference of an existing contract.

VA43 Contracts are getting created, however, I am unable to force contract start and end dates in them, the start and end dates are being taken automatically from start date and end date determination rule, when I try not to pass these rules, the contract is having the dates determined based on these rules only.

Example the rules are as below-

Rule Description

01   Today's Date
04   Acceptance Date
05   Installation Date
06   Date Contract Signed
07   Billing Date
09   Contract End Date
14   Contract Ende (Contract header)
19   End of Contract - 1 Month
21   First of Current Month
31   Last of Current Month
33   Last of Month of Contract End
40   End of Current Quarter
50   Monthly on First of Month
51   Monthly on Last of Month
52   Horizon 1 Year
53   Monthly

I am clearing the rules from being passed to "contract_data_in" parameter of the BAPI. Kindly help.

Thanks

Mohit

1 REPLY 1
Read only

Former Member
0 Likes
969

Hello Kumar,

I hope this help:

To add the start and end date to the contract using this BAPI you need add item "POSNR" 000000 to filed the date on the header of the contract.

Try this:

wa_contract_data_in-itm_number   = '000000'.

         PERFORM f_convert_date_to_internal USING ls_header_data-value_0009

                                       CHANGING wa_contract_data_in-con_st_dat.

         PERFORM f_convert_date_to_internal USING ls_header_data-value_0010

                                       CHANGING wa_contract_data_in-con_en_dat.

         IF wa_contract_data_in IS NOT INITIAL.

           APPEND wa_contract_data_in TO bapi-contract_data_in.

           FREE   wa_contract_data_in.

           wa_contract_data_inx-con_st_dat = abap_true.

           wa_contract_data_inx-con_en_dat = abap_true.

           APPEND wa_contract_data_inx TO bapi-contract_data_inx.

           FREE   wa_contract_data_inx.