Wrong CFOP determination via BAPI BAPI_SALESORDER_CREATEFROMDAT2
I need some help on the following:
When I create a Sales document manually (tcode VA01), CFOP code is determined correctly. But when I try to do the same process, using BAPI BAPI_SALESORDER_CREATEFROMDAT2, with same data ( Sold-To Party and Ship-To Party, material code...), CFOP code is determined wrong.
The SD consultant already checked the configuration in SPRO and everything looks fine.
I went thru debug and found that the FM SD_PARTNER_DATA_GET is called for both process, but internal table GVT_LOCAL_MEMORY is NOT filled when running BAPI and it IS filled when running VA01 (this internal table has VBPA - Partners - data).
This causes a NO_OBJECT_FOUND exception, which makes the program to read the address data from KNA1 (FM J_1B_SD_ADDRESS_READ), with the wrong address number, instead the address form Sales Order, since it's an On Time Customer - WE.
The weirdest thing is that it was working perfectly 3 days ago. We first noticed the problem in QAS environment, but in DEV Sandbox the error is the same now.
The scenario is an Interstate Sales Order. We are about 30 days from Go-Live and now this came thru.
Thanks in advance!