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: 

to check if itab is empty

Former Member
0 Kudos

hi gurus,

i am storing all the gl accounts which do not go through a validation in an internal table i_saknr,

after validation process is over , if this internal table has any GL accounts, then i should list out these GL accounts.

can some one help me how to check if the i_saknr is empty.

thank you.

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos

Hi,


if not itab[] is initial.
" is not empty
endif.

if itab[] is initial.
" is empty
endif.

3 REPLIES 3

former_member194669
Active Contributor
0 Kudos

Hi,


if not itab[] is initial.
" is not empty
endif.

if itab[] is initial.
" is empty
endif.

Former Member
0 Kudos

Hi Sanjana,

You can write a simple statement.

CHECK I_SAKNR[] is not initial.

Regards,

Satish

naimesh_patel
Active Contributor
0 Kudos

You can do like this:

DATA: BEGIN OF I_SAKNR OCCURS 0,
SAKNR TYPE BSEG-HKONT,
END OF I_SAKNR .

* Option 1
DESRIBE TABLE I_SAKNR  LINE SY-INDEX.
IF SY-INDEX IS INITIAL.
  PERFORM WRITE_ERROR_GL.
ENDIF.

* Option 2
IF NOT I_SAKNR [] IS INITIAL.
  PERFORM WRITE_ERROR_GL.
ENDIF.

FORM WRITE_ERROR_GL.
  WRITE : / 'Validation fails for these GL accounts'.
  LOOP AT I_SAKNR .
     WRITE: / I_SAKNR-SAKNR.
  ENDLOOP.
ENDFORM.

Regards,

Naimesh Patel