2013 Aug 01 1:16 PM
Hello dear experts,
I'm having a problem with sorting in VT04 transaction.
I had a requirement to sort the deliveries in shipping document by itinerary from VL52.
I have successfully updated structure I_VTRLK field Data1 => I_VTRLK-USR01_VBLB
from itinerary table.
I used this code:
tables: vark, valw, vawk.
data: zitin like vark-ausl_reih,
zwa_i_vtrlk like line of i_vtrlk.
loop at i_vtrlk into zwa_i_vtrlk.
select single ausl_reih from vark into zitin where vark~kunwe EQ zwa_i_vtrlk-kunnr and vark~vstel EQ zwa_i_vtrlk-vstel and vark~aulwe EQ zwa_i_vtrlk-aulwe.
zwa_i_vtrlk-usr01_vblb = zitin.
modify i_vtrlk from zwa_i_vtrlk transporting usr01_vblb.
endloop.
sort i_vtrlk by usr01_vblb ascending.
Code works great, i_vtrlk is updated successfully and sorted by i_vtrlk-usr01_vblb.
Later, i_vtrlk should be inserted in vtrlk, and then vtrlk-user01_vblb is used as actual criteria in VT04.
I guess that vtrlk isn't getting updated from vtrlk, could anyone help me to determine 100% if
this is true, and possibly help me complete the requirement...
Regards,
Mihailo
2013 Aug 02 1:16 PM
OK, I'll post the solution in case someone else needs this.
It can't be done using the I_VTRLK structure with user exits, but you need to
fill C_VTRLK earlier in the program by enhancing the code.
if sy-tcode EQ 'VT04'.
tables: vark, valw, vawk.
data: zitin like vark-ausl_reih.
data: zwa_c_vtrlk like line of c_vtrlk.
loop at c_vtrlk into zwa_c_vtrlk.
select single ausl_reih from vark into zitin where vark~kunwe EQ zwa_c_vtrlk-kunnr and vark~vstel EQ zwa_c_vtrlk-vstel and vark~aulwe EQ zwa_c_vtrlk-aulwe.
zwa_c_vtrlk-usr01_vblb = zitin.
modify c_vtrlk from zwa_c_vtrlk transporting usr01_vblb.
endloop.
endif.
Regards,
Mihailo
2013 Aug 02 1:16 PM
OK, I'll post the solution in case someone else needs this.
It can't be done using the I_VTRLK structure with user exits, but you need to
fill C_VTRLK earlier in the program by enhancing the code.
if sy-tcode EQ 'VT04'.
tables: vark, valw, vawk.
data: zitin like vark-ausl_reih.
data: zwa_c_vtrlk like line of c_vtrlk.
loop at c_vtrlk into zwa_c_vtrlk.
select single ausl_reih from vark into zitin where vark~kunwe EQ zwa_c_vtrlk-kunnr and vark~vstel EQ zwa_c_vtrlk-vstel and vark~aulwe EQ zwa_c_vtrlk-aulwe.
zwa_c_vtrlk-usr01_vblb = zitin.
modify c_vtrlk from zwa_c_vtrlk transporting usr01_vblb.
endloop.
endif.
Regards,
Mihailo