‎2008 Aug 25 9:32 AM
Hi,
i need to refresh program cache.
My problem is:
- run the program
- call a FM
- change data
- call the FM (again) to refresh data.
The fm gets the old data.
How can I solve?
‎2008 Aug 25 9:36 AM
hi Salvatore,
which FM do you call? I would check in the function group of that FM, if there is any other FM in that group which clears all buffered data.
hope this helps
ec
‎2008 Aug 25 9:37 AM
loop the internal table pass the values to the parameters is one option
‎2008 Aug 25 9:41 AM
Is it a Custom Function, if so Did you clear the Global data in the Function module..if not use CLEAR and REFRESH the global data.
‎2008 Aug 25 9:46 AM
I'm using FM CS_BOM_EXPL_MAT_V2 (get BOM data).
take a look to source code:
FORM bom_carica_modello USING par_matnr
par_stlal
par_stlan
par_werks
CHANGING par_tab LIKE it_tab[]
par_wa LIKE wa_tab.
DATA: it_bom_item OCCURS 0 WITH HEADER LINE.
REFRESH it_bom_item.
DATA: BEGIN OF it_diba OCCURS 0.
INCLUDE STRUCTURE stpox.
DATA: END OF it_diba.
REFRESH it_diba.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'*
EXPORTING
datuv = p_datuv
capid = 'PP01'*
mehrs = ' '
mtnrv = par_matnr
stlal = par_stlal
stlan = par_stlan
werks = par_werks
TABLES
stb = it_diba
MATCAT =*
EXCEPTIONS
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
OTHERS = 9
.
IF sy-subrc <> 0.
MESSAGE ID 'ZM' TYPE 'S' NUMBER 099
WITH 'Alternativa richiesta come modello non valida'.
ENDIF.
ENDFORM. " carica_modello
Edited by: Salvatore Volpe on Aug 25, 2008 10:47 AM
‎2008 Aug 25 9:50 AM
‎2008 Aug 25 9:55 AM
The code you posted is fine. and how are you telling that you are getting the olddata.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'*
EXPORTING
datuv = p_datuv
capid = 'PP01'
mehrs = ' '
mtnrv = par_matnr
stlal = par_stlal
stlan = par_stlan
werks = par_werks
TABLES
stb = it_diba
after the population you are not passing the it_diba to any where .
what is the use of this
CHANGING par_tab LIKE it_tab[]
par_wa LIKE wa_tab.
why are you using par_tab , i mean what purose you are using the parameter.
‎2008 Aug 25 9:56 AM
I would check if the importing parameter MMORY of the FM has any effect (values could be 1 and 0)
‎2008 Aug 25 10:15 AM
‎2008 Aug 25 10:16 AM
This is the full source code...
FORM bom_carica_modello USING par_matnr
par_stlal
par_stlan
par_werks
CHANGING par_tab LIKE it_tab[]
par_wa LIKE wa_tab.
DATA: it_bom_item OCCURS 0 WITH HEADER LINE.
REFRESH it_bom_item.
DATA: BEGIN OF it_diba OCCURS 0.
INCLUDE STRUCTURE stpox.
DATA: END OF it_diba.
REFRESH it_diba.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
datuv = p_datuv
capid = 'PP01'
mehrs = ' '
mtnrv = par_matnr
stlal = par_stlal
stlan = par_stlan
werks = par_werks
TABLES
stb = it_diba
MATCAT =
EXCEPTIONS
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
OTHERS = 9
.
IF sy-subrc <> 0.
MESSAGE ID 'ZM' TYPE 'S' NUMBER 099
WITH 'Alternativa richiesta come modello non valida'.
ENDIF.
REFRESH par_tab.
CLEAR par_wa.
LOOP AT it_diba.
IF it_diba-datub GE p_datub.
Cancella le posizioni scadute
CLEAR: par_wa.
MOVE-CORRESPONDING it_diba TO par_wa.
MOVE it_diba-meins TO par_wa-meins.
Conversione UM
CALL FUNCTION 'CONVERSION_EXIT_RUNIT_OUTPUT'
EXPORTING
input = it_diba-meins
LANGUAGE = SY-LANGU
IMPORTING
output = par_wa-meins.
.
APPEND par_wa TO par_tab.
ENDIF.
ENDLOOP.
ENDFORM. " carica_modello
I have also added a wait command, a commit work... but the problem still the same...