cancel
Showing results for 
Search instead for 
Did you mean: 

Converting Date into Calweek based on condition

former_member228877
Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

ccc_ccc
Active Contributor
0 Kudos

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

Answers (2)

Answers (2)

former_member228877
Participant
0 Kudos

Hi Phani and Nanda,

Thanks for the reply, Now its working

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

Best Regards

Sree

ccc_ccc
Active Contributor
0 Kudos

Hi Sreekanth,

Could you please close thread by selecting "Correct Answer".

Thank you,

Nanda

KodandaPani_KV
Active Contributor
0 Kudos

HI,

can you write the simple formula.

DATE_GET_WEEK(Actual shiment Date)

map the source fields to target fields.