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: 

finding blank fields in a record of an internal table

Former Member
0 Kudos

Hi All,

I have one internal table with 20 field.

and in that internal table we have only one record.

In that particular record some of the fields are blank and some are field.

Please help me to provide some steps by which i can find out which fields are blank fields in that record

Manish

5 REPLIES 5

former_member329859
Participant
0 Kudos

loop the table and check records

rainer_hbenthal
Active Contributor
0 Kudos

Use if in combination with is initial.

0 Kudos

Hi,

Thanks for the reply..

Is there any simple way to do this means there is any FM module in which i can just pass the record and can get the blank fields.

The IF or LOOP can be surely used but using this there will be too many if else condition.

0 Kudos

You can write your own with generic datatypes

0 Kudos

Hello,

You can make use of field symbols in order to achieve the same. Check the following code and modify according to your need.


TYPES: BEGIN OF t_itab ,
      f1 TYPE c,
      f2 TYPE i,
      f3(10) TYPE c,
      f4(5) ,
      f5(5) TYPE c,
     END OF t_itab,
     tt_itab TYPE TABLE OF t_itab.
DATA : itab TYPE  tt_itab WITH HEADER LINE.
FIELD-SYMBOLS: <fs> TYPE tt_itab,
               <wa> TYPE t_itab,
               <wa1> TYPE ANY.
DATA dref TYPE REF TO data.
itab-f1 = 'A'.
itab-f2 = 2.
itab-f4 = 'HELLO'.
APPEND itab.
CLEAR itab.
*CREATE DATA dref type tt_itab.
ASSIGN itab[] TO <fs>.
ASSIGN itab TO <wa>.
LOOP AT <fs> ASSIGNING <wa>.
  DO.
    ASSIGN COMPONENT sy-index OF STRUCTURE <wa> TO <wa1>.
    IF sy-subrc NE 0.
      EXIT.
    ENDIF.
    IF <wa1> IS INITIAL.
      WRITE : 'component ', sy-index , ' is initial'.
    ENDIF.
  ENDDO.
ENDLOOP.

Hope this helps.

Regards,

Sachin