Hi Ginee,
For my solution to be feasible, i assume that all the possible values of column 2 i.e. Work Week should be finite and known before we execute the program. If yes, then do as follows,
1) Sort the internal table by part workweek.
2) Loop at the internal table and compare the value of Workweek and on the basis of work week populate the quantity value in the field.
Code example.
Suppose you have 5 work weeks,
then
lt_data is
Part | WorkWeek | Qty |
A100 | 1301 | 100 |
B100 | 1302 | 200 |
C100 | 1304 | 300 |
A100 | 1305 | 200 |
A100 | 1306 | 100 |
*-- Final Data Table
data : begin of ty_final,
part type .....
ww1301 type <quantity type>,
ww1302 type <quantity type>,
ww1304 type <quantity type>,
ww1305 type <quantity type>,
ww1306 type <quantity type>,
end of ty_final.
sort lt_data by part workweek.
loop at lt_Data into ls_Data.
if ls_data-workweek = 1301.
ls_final-ww1301 = ls_Data-qty.
elseif ls_data-workweek = 1302.
ls_final-ww1302 = ls_Data-qty.
elseif ......
.
.
.
.
<Continue till all the work weeks>
at end of part.
append ls_final to lt_final.
clear : ls_final.
endat.
endloop.
Revert if something is not clear.
BR,
Ankit