Clear Static Variable in FM 'BAPI_PRICES_CONDITIONS'
I am using 'BAPI_PRICES_CONDITIONS' to upload pricing data. When calling the BAPI repeatedly with different condition types it is giving dump with message 'DATA_OFFSET_TOO_LARGE'. This dump is due to the static variable defined and used to calculate the offset to read data from one of the character fields in include LCND_PRICES_INBOUNDF0G, line number 83. The length of the field VAKEY is 100 characters. When the BAPI is called for the 4th time and tries to get the value based on offset it gives a dump as the value in offset is exceeding 100 characters.
pc_vakey_oldsv_offset_kfrst(1) = ls_konh_old-vakeysv_offset_kfrst(1). - Its giving dump when the value in static variable sv_offset_kfrst exceeds 100.
Is there any way to clear the static variables declared in standard BAPI through our program before calling it recursively?
Darren Barton replied
You can normally get around problems like this by calling the BAPI in a separate session.
e.g. call 'BAPI_PRICES_CONDITIONS' destination 'NONE tables ti_bapicondct = gt_bapicondct ti_bapicondhd = gt_bapicondhd ti_bapicondit = gt_bapicondit ti_bapicondqs = gt_bapicondqs ti_bapicondvs = gt_bapicondvs to_bapiret2 = gt_bapiret2 to_bapiknumhs = gt_bapiknumhs to_mem_initial = gt_mem_initial exceptions update_error = 1 others = 2.
As this BAPI isn't RFC enabled you would have to wrap it in a bespoke version. The bespoke version having exactly the same interface but with the RFC attributes set, the code would simply call the normal BAPI.
Hope this helps.