2006 Nov 29 6:15 PM
HELLO ALL,
Iam using FM REUSE_ALV_FIELDCATALOG_MERGE
TO BUILD THE FIELD CATALOG
I HAVE FIELD IN THE INTERNAL OF LENGTH SAY 10
AND MY VALUE IS 0000012345
AND I AM USING SHIFT TO REMOVE LEADING ZEROS
NOW THE VALUE IS INTERNAL TABLE IS 12345
BUT IN THE O/P
12345 LEAVING 5 BLANK SPACES IN FRONT
I WANT LIKE THIS
12345
PLEASE LET ME KNOW
THANKS
2006 Nov 29 6:20 PM
Hi,
In the field catalog internal table for that field use the data type as VBELN.
S_FIELDCATALOG-ROLLNAME = 'VBELN'.
Automatically it will remove the leading zeroes..You don't have to use SHIFT..
Thanks,
Naren
2006 Nov 29 6:20 PM
2006 Nov 29 6:29 PM
Hi,
Narendran,
Iam using FM TO BUILD FIELD CATALOG
Ravi,
Numbers are always right aligned, right?
i don't what your talking about can you be more clear.
Thanks
2006 Nov 29 6:40 PM
Hi,
You need not do any thing else before calling function module REUSE_ALV_FIELDCATALOG_MERGE.
Once you populate the FIELDCTALOG table, go to the respective row in the fieldcatalog table and set T_FIELDCATALOG-JUST = 'L' .
See the below about JUST documentation:
just (justification)
value set: SPACE, 'R', 'L', 'C'
Only relevant for fields of data type CHAR or NUMC
' ' = default justification for this data type
'R' = right-justified output
'L' = left-justified output
'C' = centered output
The justification of the column header always follows the justification of the columns. Independent justification of the column neader is not possible.
Thanks
Ramakrishna
2006 Nov 29 6:35 PM
HI,
If your field is TYPE i, then the type i value will be right aligned, so the space will voe there.
if that is a Charecter type then it will print from the left side, so no spaces will come before the value
Regards
Sudheer
2006 Nov 29 6:36 PM
Hi Preeti,
The field catalogue generated through the FM will refer that particular field to a standard dataelement, hence it displays the data in SAP internal format as 0000012345.
Just modify the data type of that particular field to CHAR size 10 in the field catalogue. This should solve the problem. If that does not help in addition to the abouve steps, instead of SHIFT use CONVERSION_EXIT_ALPHA_OUTPUT fm (i believe) to get this 0000012345 as 12345 and right aligned.
Regards
Kathirvel
2006 Nov 29 6:43 PM
Hi,
Check this example..
TYPE-POOLS: slis.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
DATA: BEGIN OF wa_test,
posnr LIKE vbap-posnr,
END OF wa_test.
DATA: v_repid TYPE syrepid.
v_repid = sy-repid.
DATA it_test LIKE STANDARD TABLE OF wa_test.
wa_test-posnr = '000010'.
SHIFT wa_test-posnr LEFT DELETING LEADING '0'.
APPEND wa_test TO it_test.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_internal_tabname = 'WA_TEST'
i_inclname = v_repid
CHANGING
ct_fieldcat = gt_fieldcat.
s_fieldcatalog-just = 'L'.
MODIFY gt_fieldcat FROM s_fieldcatalog
TRANSPORTING just
WHERE fieldname = 'POSNR'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = gt_fieldcat
TABLES
t_outtab = it_test.
Thanks,
Naren