Skip to Content

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 .

ENDIF.

CALL FUNCTION 'DATE_GET_WEEK'

EXPORTING

date = lv_calweek_date

IMPORTING

week = lv_week

result = lv_week.

clear lv_calweek_date.

clear lv_week.

But when laoding I am getting Following error

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    May 20, 2015 at 04:36 PM

    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,

    Nanda

    Add comment
    10|10000 characters needed characters exceeded

  • May 21, 2015 at 01:52 AM

    HI,

    can you write the simple formula.

    DATE_GET_WEEK(Actual shiment Date)

    map the source fields to target fields.



    Add comment
    10|10000 characters needed characters exceeded

  • May 26, 2015 at 04:52 PM

    Hi Phani and Nanda,

    Thanks for the reply, Now its working

    Thanks a lot for your time for looking into this..

    Best Regards

    Sree

    Add comment
    10|10000 characters needed characters exceeded