Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

empty field is not being read as "INITIAL"

Former Member
0 Kudos

I am debugging my code and for some reason, when a field is blank/empty/devoid of any characters what so ever

hexadecimal value is: 20002000200020002000200020002000 it is still not dropping into the code...


IF NOT it_actual[] IS INITIAL.
 LOOP AT it_actual INTO lw_actual.

 IF lw_actual-strdt IS INITIAL.                                  *this does not work on empty field! *

        READ TABLE it_actual INTO ls_actual INDEX 1.
        lw_actual-strdt = ls_actual-strdt.
        lw_actual-enddt = ls_actual-enddt.
        MODIFY it_actual FROM lw_actual TRANSPORTING strdt enddt.
      ENDIF.
  ENDLOOP.
ENDIF.

The first loop round is okayu2026 as the field is populatedu2026

But on the second loop, the field is empty, but it does not drop into the codeu2026. 

I am just trying to copy the header dates into the line item dates before I call the proxyu2026.

Any ideas? it is probably something obvious...

1 ACCEPTED SOLUTION

former_member194416
Contributor

Hi,

Initial value depends on the data type, if it is a date field initial value should be '00000000' not empty.If it is coming empty from system you should check "if strdt = space" not initial. Check abap documentation for the initial key word.

Regards,

Edited by: Gungor Ozcelebi on May 7, 2010 4:04 PM

5 REPLIES 5

Former Member
0 Kudos

You are reading a table you are looping at, without saving the sy-tabix position before the read, and without using the index clause in the modify.

0 Kudos

i think it has more to do with the data type field.

as it is a date field, if i enter 00000000 it then drops into the code.

former_member194416
Contributor

Hi,

Initial value depends on the data type, if it is a date field initial value should be '00000000' not empty.If it is coming empty from system you should check "if strdt = space" not initial. Check abap documentation for the initial key word.

Regards,

Edited by: Gungor Ozcelebi on May 7, 2010 4:04 PM

0 Kudos

Thank you Gungor.

i shall try that and see! 🐵

0 Kudos

i have opted for:


      IF lw_actual-strdt EQ space
        OR lw_actual-strdt IS INITIAL.