04-26-2006 11:10 AM - last edited on 02-04-2024 6:05 AM by postmig_api_4
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.
04-26-2006 11:12 AM
use the statement:
if itab-field1 is initial.
replace all occurances of space with '0' in itab-field1.
endif.
Regards,
Ravi
04-26-2006 11:14 AM
If they are CHAR fields you can assign '00000000' value to the field.
Regards,
Ravi
04-26-2006 11:23 AM
You can declare it as a field of type N.. which will place zeroes if there is no value!
04-26-2006 11:25 AM
04-26-2006 11:43 AM
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 dont need to worry about the length of the field.
Regards,
Sameena
04-26-2006 11:47 AM
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 dont need to worry about the length of the field.</b>
Regards,
Sameena