I am using BAPI_CONTRACT_CREATEFROMDATA to create a contract from within a custom ABAP program. However I cannot figure out how to get the contract start and end dates into the contract header. I know that you can enter them into the ONTRACT_DATA_IN table parameter but these dates only appear on the line items and not the header.
Does anyone know which parameters on the function map to the contract header start and end dates.
there are also fields QT_VALID_F and QT_VALID_T for quotation or inquiry. So it looks like for different contract types you need to use different fields. This BAPI calls FM SD_SALESDOCUMENT_CREATE which has subroutine ms_move_header_in which maps from BAPI fields to internal fields. Here is a small part of this routine.
MOVE order_header_in-qt_valid_f TO e_vbakkom-angdt. MOVE order_header_in-qt_valid_t TO e_vbakkom-bnddt. MOVE order_header_in-ct_valid_f TO e_vbakkom-guebg. MOVE order_header_in-ct_valid_t TO e_vbakkom-gueen.
When I check technical fields for the screen fields "Valid from" and "Valid to" in VA43 I get names GUEBG and GUEEN. So it still looks like you should use CT_VALID_F and CT_VALID_T.
I forgot to mention you can still debug BAPI to figure out where the problem is.
Edited by: Martin Voros on Sep 11, 2009 9:57 AM
It would seem that the BAPI is losing certain data on the way through. A MOVE-CORRESPONDING comand seems to ensure that the date gets lost.
This line is where it happens;
In Function SD_SALES_HEADER_MAINTAIN
04. Vertragsdaten aus Schnittstelle zur Verarbeitung übernehmen
MOVE-CORRESPONDING FVBAKKOM TO VEDAKOM.
The first structure contains the dates but after the command executes those dates have not made it into the second structure.
I found that by putting the dates into the second struture (via the debugger) I could get the header dates written correctly.
Doesn't get me round my problem though.
Edited by: AlistairD55 on Sep 11, 2009 2:15 PM
I am trying to use the same fields in quotation BAPI (BAPI_QUOTATION_CREATEFROMDATA2 ) to update contract start and end date, because of start date rule, contract start date and end date are not updating.
We have any rule field here to update, so then how to use this ct_valid_t and ct_valid_f fields to update contract dates.