Application Development and Automation 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: 
Read only

Set a field to null

Former Member
0 Likes
2,371

Hey guys I have a structure (a workare) which I want to set NULL not 0. I tried it with the command CLEAR WITH NULL but it doesnt work because my structure fields content references. This is not supported by the CLEAR WITH NULL command and I get an error.

Do you have any idea how to solve that problem?

Thans a lot

4 REPLIES 4
Read only

MarcinPciak
Active Contributor
0 Likes
1,921

Null value is set in special cases only by the system. I.e. when you don't use certain fields from table in the view and you do an insert . In this case the system puts null values to all remaining fields in the underlying tables.

CLEAR WITH NULL is obsolete. I would simply suggeest to use CLEAR with no addition. This will initialize your reference variable which means in the field there is nothing stored.

Regards

Marcin

Read only

0 Likes
1,921

The problem is that i have numfields too and they are set to 0 then but I dont want to have 0 in there because my output shall show empty fields and not 0 :). Any other idea?

Thanks for ur post

Marko

Read only

0 Likes
1,921

If you have oupput in ALV formt you can use NO_ZERO = 'X' attribute of fieldcatalog to turn off displaying zeros in tat column.

Regards

Marcin

Read only

0 Likes
1,921

ABAP does not support NULL values. ABAP only supports INITIAL values, but with these you are not able to differ between content and non-contont.

You need to fill your structure with self defined indicater variables indicating if a value contains data or nor. something like this:

TYPES:
  begin of struct,
    a type p decimals 5,
    a_i type apap_bool,
    b type c length 30,
    b_i type abap:bool
  end of struct.

Filling the _i components you have full control if a componet contains NULL values or initial values.