Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Converting Date into Calweek based on condition

Hi All

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.

Line Type

Actual Shipment Date

Cancel 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 .




          date   = lv_calweek_date


          week   = lv_week

       result = lv_week.

       clear lv_calweek_date.

       clear lv_week.

But when laoding I am getting Following error


Hi Sreekanth,

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.

Thank you,


1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question