‎2008 Apr 07 12:28 PM
Hi,
I have a internal table, like this.. i need to type cast all the integer fields of this table to Character/string in order to display the output in letters like "R" "E"...etc if a particular condition is satisfied.
TYPES: BEGIN OF ty_output,
run(3) TYPE c,
iterations TYPE ziteration,
created_on TYPE datum,
created_time TYPE uzeit,
input_recs TYPE int2,
input_trans TYPE int2,
success_cnt TYPE int2,
success_trans TYPE int2,
error_cnt TYPE int2,
error_trans TYPE int2,
session_name(12) TYPE c,
END OF ty_output.
DATA: wa_output TYPE ty_output,
wt_output TYPE STANDARD TABLE OF ty_output.
please tell me how to do it.
Thanks in Advance..
Regards,
Arunsri
‎2008 Apr 07 12:47 PM
Why not just define another internal table like this (very similar, but this time character instead of Integer fields):
TYPES: BEGIN OF ty_output1,
run(3) TYPE c,
iterations TYPE ziteration,
created_on TYPE datum,
created_time TYPE uzeit,
input_recs TYPE char,
input_trans TYPE char,
success_cnt TYPE char,
success_trans TYPE char,
error_cnt TYPE char,
error_trans TYPE char,
session_name(12) TYPE c,
END OF ty_output1.
DATA: wa_output1 TYPE ty_output1,
wt_output1 TYPE STANDARD TABLE OF ty_output1.
Now check condition of field, for example:
if wa_output-input_recs > 1000.
wa_output1-input_recs = 'R'.
endif.
If you are using an ALV grid as output it is not possible to define integer fields and display a character field since character fields can (of course) not be interpreted as numbers.
In general you can move integer fields to character fields as long as character field is defined long enough, but not the other way around.
But in this case (especially when using ALV as output), use another field for representing the data.
‎2008 Apr 07 12:47 PM
Why not just define another internal table like this (very similar, but this time character instead of Integer fields):
TYPES: BEGIN OF ty_output1,
run(3) TYPE c,
iterations TYPE ziteration,
created_on TYPE datum,
created_time TYPE uzeit,
input_recs TYPE char,
input_trans TYPE char,
success_cnt TYPE char,
success_trans TYPE char,
error_cnt TYPE char,
error_trans TYPE char,
session_name(12) TYPE c,
END OF ty_output1.
DATA: wa_output1 TYPE ty_output1,
wt_output1 TYPE STANDARD TABLE OF ty_output1.
Now check condition of field, for example:
if wa_output-input_recs > 1000.
wa_output1-input_recs = 'R'.
endif.
If you are using an ALV grid as output it is not possible to define integer fields and display a character field since character fields can (of course) not be interpreted as numbers.
In general you can move integer fields to character fields as long as character field is defined long enough, but not the other way around.
But in this case (especially when using ALV as output), use another field for representing the data.