09-10-2008 3:14 PM
Hello Friends,
I have one internal table with fields material and plant like...
Material Plant
m1 p1
m2 p1
m3 p1
m4 p2
m5 p2
------------------
------------------
By processing this i_tab for each record I am calculating variable v_version and material (as it is) like....
v_1 m1 " for 1st record process of i_tab
v_1 m2 " for 2nd record process of i_tab
v_2 m3 " for 3rd record process of i_tab
v_3 m4 " for 4th record process of i_tab
v_3 m5 " for 5th record process of i_tab
----------
----------
Now i have one function like call Z_VERSION_UPDATE which is called with in this loop with exporting parameter version and update the values in the tables.
My code is like....
LOOP AT i_tab into wa_tab.
" Calculating version here.
v_version = (some calculation)
CALL FUNCTION 'Z_VERSION_UPDATE'
ENDLOOP.
and I want to make one shot for each version.
When it process for
v_1 m2
Function should update
v_1 m1
v_1 m2
When it process for
v_2 m3
Function should update
v_2 m3
When it process for
v_3 m5
Function should update
v_3 m4
v_3 m5
Means end of same version end it should update both.
Here, version is not field So i cant use AT commands.
Please help me out . Please post the code example.
Regards,
Ronny.
Edited by: Ronny Hanks on Sep 10, 2008 4:14 PM
Edited by: Ronny Hanks on Sep 10, 2008 4:16 PM
Edited by: Ronny Hanks on Sep 10, 2008 4:17 PM
09-10-2008 3:57 PM
Hi,
data temp_version like v_version.
LOOP AT i_tab into wa_tab.
temp_version = v_version
" Calculating version here.
v_version = (some calculation)
Append the version and material details to a temp internal table itab_temp
if sy-tabix ne 1 and temp_version ne v_version.
loop at itab_temp.
CALL FUNCTION 'Z_VERSION_UPDATE'.
endloop.
refresh itab_temp.
endif.
ENDLOOP.
Last set to be executed
loop at itab_temp.
CALL FUNCTION 'Z_VERSION_UPDATE'.
endloop.
refresh itab_temp.
Hope it helps.
Thanks,
Mahesh
09-10-2008 3:57 PM
Hi,
data temp_version like v_version.
LOOP AT i_tab into wa_tab.
temp_version = v_version
" Calculating version here.
v_version = (some calculation)
Append the version and material details to a temp internal table itab_temp
if sy-tabix ne 1 and temp_version ne v_version.
loop at itab_temp.
CALL FUNCTION 'Z_VERSION_UPDATE'.
endloop.
refresh itab_temp.
endif.
ENDLOOP.
Last set to be executed
loop at itab_temp.
CALL FUNCTION 'Z_VERSION_UPDATE'.
endloop.
refresh itab_temp.
Hope it helps.
Thanks,
Mahesh
09-12-2008 3:27 PM