Converting Date into Calweek based on condition
I have following attached scenario,
Based on the condition Linetype flag,I have to derive Calweek either from Ship date or Cancel date
I have written code as below, Could any one correct me where I went wrong,( I am not expert in ABAP)
It giving dump saying attached,
Thanks in advance.
Actual Shipment Date
If Linetype =S
Calweek has to derive from Actual shiment Date
Else If Line Type = X
Calweek has to derive from Cancel date.
I have written following way
DATA: lv_calweek_date TYPE scal-date,
lv_week TYPE scal-week.
IF SOURCE_FIELDS-/bic/z_plintyp EQ 'S'.
lv_calweek_date = SOURCE_FIELDS-/bic/z_pactsdt .
ELSEIF SOURCE_FIELDS-/bic/z_plintyp EQ 'X'.
lv_calweek_date = SOURCE_FIELDS-/bic/z_pcncldt .
CALL FUNCTION 'DATE_GET_WEEK'
date = lv_calweek_date
week = lv_week
result = lv_week.
But when laoding I am getting Following error
Nanda Anantha replied
what is the length of "z_plintyp" and "z_plintyp " two infoobjects.
if length is above two infoobjects is "1" then it should work, if length more than "1" you have to use offset
just like below
IF SOURCE_FIELDS-/bic/z_plintyp+0(1) EQ 'S'.
please attach , error message.