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: 

Fill fields

Former Member
0 Kudos

Hi,

I have separated every elements of sdata of an idoc to a internal table. and now i want to fill the field that are empty with zeros. for example i have a field with size 8 that is empty, i want to fill it with eight zeros.

6 REPLIES 6

former_member181962
Active Contributor
0 Kudos

use the statement:

if itab-field1 is initial.

replace all occurances of space with '0' in itab-field1.

endif.

Regards,

Ravi

Former Member
0 Kudos

If they are CHAR fields you can assign '00000000' value to the field.

Regards,

Ravi

Former Member
0 Kudos

You can declare it as a field of type N.. which will place zeroes if there is no value!

0 Kudos

hi,

Declare the <b>field as type N</b>

Former Member
0 Kudos

Hi,

Loop at the internal table (ITAB)

If ITAB-FIELD is initial

ITAB-FIELD = '0'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = ITAB-FIELD

IMPORTING

OUTPUT = ITAB-FIELD.

Endif.

Endloop.

This way you don’t need to worry about the length of the field.

Regards,

Sameena

Former Member
0 Kudos

Hi,

Loop at the internal table (ITAB)

If ITAB-FIELD is initial

ITAB-FIELD = '0'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = ITAB-FIELD

IMPORTING

OUTPUT = ITAB-FIELD.

Endif.

Endloop.

<b>This way you don’t need to worry about the length of the field.</b>

Regards,

Sameena