Hi Guys,
I need to fetch SD document Flow data into Bw for which I have created an Extractor using function modules. I am using a Standard FM "RV_ORDER_FLOW_INFORMATION" which is called in the LOOP as below.
LOOP AT VIT_VBRK INTO VFL_VBRK.
CLEAR VBCO6.
VBCO6-MANDT = SY-MANDT.
VBCO6-VBELN = VFL_VBRK-VBELN.
REFRESH TVBFA_TAB[].
CLEAR TVBFA_TAB.
CALL FUNCTION 'RV_ORDER_FLOW_INFORMATION'
EXPORTING
AUFBEREITUNG = '2'
BELEGTYP = VFL_VBRK-VBTYP
COMWA = VBCO6
NACHFOLGER = 'X'
N_STUFEN = '50'
VORGAENGER = 'X'
V_STUFEN = '50'
IMPORTING
BELEGTYP_BACK = BELEG_TYP
TABLES
VBFA_TAB = TVBFA_TAB
EXCEPTIONS
NO_VBFA = 1
NO_VBUK_FOUND = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
ENDIF.
*OTHER CODE LOGIC*
ENDLOOP.
Now the problem is if I run this only once, i.e VIT_VBRK having only 1 document, the result I get is correct. However, if this same code is run in a LOOP with many different values in VIT_VBRK, the first Loop gives correct values and all subsequent values (value of TVBFA_TAB- RFMNG to be precise) are incorrect.
I am guessing this is b'coz of some internal tables and work areas specific to the function module are not refreshed and the values of earlier iterations are adding up in the subsequent runs. can any one tell me if theres any specific 'REFRESH' statement or FM to be called before calling this FM.
Thanks in Advance,
Parth Shah.