‎2006 Apr 18 10:53 AM
Hi all,
I have got a problem with the alignment of character fields from the database table
I have the a variable "g_activity LIKE afvc-vornr,"
i have to right align this variable to be consistent with other variables output display .But the option "13 g_activity RIGHT-JUSTIFIED " does not right align the data .
Also i do not want to pad leading zeros to the other variables to make it aligned.
Pls give ideas.
Thanks & Regards.
Stock
‎2006 Apr 18 11:06 AM
Hello,
I had tried like this, and I get the result as right justified.
data: g_activity LIKE afvc-vornr value '1'.
write: 13(4) G_ACTIVITY right-justified.
Regards,
Naimesh
‎2006 Apr 18 11:14 AM
Hi Naimesh,
Actually i have to align the field g_activity wrt other fields like l_nplnr ("l_nplnr LIKE aufk-aufnr,")and l_banfn ( l_banfn LIKE ekpo-banfn) and the field length of this fields are 10 chars. so i have to have all these fields right aligned. as
l_nplnr : 30004758
g_activity : 0010
l_banfn : 10007111
But these are not right aligned with the write statement as mentioned earlier.
Thanks & regards.
stock
‎2006 Apr 18 11:30 AM
Hi,
Make the size of all the three fields same and then use right align.
The right align would align depending on the size of variable.
For example if the size of the field is 20 chars and the data in the variable is 10 characters then it would be padded with leading spaces and then right aligned for 20 characters.
Thanks,
Rashmi.
‎2006 Apr 18 11:36 AM
Hello,
Still some confusion,
Do you want a list like this,
XX30004758
XXXXXX0010
XX10007111
(Where X = Space)
write : /(10) l_nplnr right-justified, /(10) g_activity right-justified, /(10) l_banfn right-justified.
OR
30004758
0010
10007111
Write : /l_nplnr, /g_activity, /l_banfn.
Regards,
Naimesh
‎2006 Apr 18 11:36 AM
Hi
I tried with that option by increasing the length . but it does not get aligned .I guess its not aligning the characeter fields from the dtabase tables , while many of the other fields of type CURR and QUAN got aligned.
Thanks & regards.
Stock
‎2006 Apr 18 11:41 AM
Hi Naimesh,
The like the first one
XX30004758
XXXXXX0010
XX10007111
(Where X = Space)
write : /(10) l_nplnr right-justified, /(10) g_activity right-justified, /(10) l_banfn right-justified.
Thanks & regards,
Stock
‎2006 Apr 18 11:52 AM
Hello,
Try this code..
data: l_nplnr LIKE aufk-aufnr value '30004758',
l_banfn LIKE ekpo-banfn value '10007111'.
data: g_activity LIKE afvc-vornr value '0010'.
DATA: TARGET_FIELD1(20),
TARGET_FIELD2 LIKE TARGET_FIELD1,
TARGET_FIELD3 LIKE TARGET_FIELD1.
move : l_nplnr TO TARGET_FIELD1,
g_activity TO TARGET_FIELD2,
l_banfn TO TARGET_FIELD3.
shift TARGET_FIELD1 right deleting trailing space.
shift TARGET_FIELD2 right deleting trailing space.
shift TARGET_FIELD3 right deleting trailing space.
write: / TARGET_FIELD1,
/ TARGET_FIELD2,
/ TARGET_FIELD3.
Regards,
Naimesh
Reward points, if it is helpful..!
‎2006 Apr 18 11:55 AM
Hi Stock,
try putting ur data into type P variables n use that in write statement..
eg : var type P.
var = g_activity.
Hope it helps,
REgards,
Bikash