06-28-2016 7:38 AM
Hi,
I want to display a sequence of positions in an CL_GUI_ALV_GRID-object. The positions are separated by '-' character.
Type of the sequence column is CHAR49.
How can I desplay leading zeros in this column.
Example: I want 0190-0100-0650 to be desplayed instead of 190-0100-0650.
lvc_s_fcat-lzero = 'X' seems only to work with NUMC.
Kind Regards,
Hubert
06-28-2016 7:56 AM
As usually, what did you try? You just concatenate the values? There is any exit active? How did you declare the fields you are concatenating?
with this code
REPORT zzzzzzzzzzzzzzz.
PARAMETERS: p_char TYPE char05 OBLIGATORY.
DATA: line(49) TYPE c,
t_out TYPE TABLE OF line.
DATA alv TYPE REF TO cl_salv_table.
START-OF-SELECTION.
CONCATENATE p_char '-' p_char '-' p_char '-' p_char INTO line.
APPEND line TO t_out.
cl_salv_table=>factory(
IMPORTING
r_salv_table = alv
CHANGING
t_table = t_out ).
alv->display( ).
i got this result
And the output
It's true i'm using CL_SALV_TABLE, but i do not think behaviour changes (but i'll give a try)
06-28-2016 7:56 AM
As usually, what did you try? You just concatenate the values? There is any exit active? How did you declare the fields you are concatenating?
with this code
REPORT zzzzzzzzzzzzzzz.
PARAMETERS: p_char TYPE char05 OBLIGATORY.
DATA: line(49) TYPE c,
t_out TYPE TABLE OF line.
DATA alv TYPE REF TO cl_salv_table.
START-OF-SELECTION.
CONCATENATE p_char '-' p_char '-' p_char '-' p_char INTO line.
APPEND line TO t_out.
cl_salv_table=>factory(
IMPORTING
r_salv_table = alv
CHANGING
t_table = t_out ).
alv->display( ).
i got this result
And the output
It's true i'm using CL_SALV_TABLE, but i do not think behaviour changes (but i'll give a try)
06-28-2016 8:10 AM
06-28-2016 8:29 AM
Hi Simone,
yes, I just concatenate the values.
Type of the column in table to be desplayed an in fieldcatalog is data element Z_STL_POS_SEQU which is build from domain Z_POS_SEQU_10 (datatype CHAR49, no conversion exit).
I am concatenating as follows:
LOOP ... .
...
CONCATENATE <Z_STL_POS_SEQU> '-' <RESB-POSNR (which is CHAR4)> INTO <Z_STL_POS_SEQU>
...
ENDLOOP.
Do you have any other hints?
Regards,
Hubert
06-28-2016 8:34 AM
And you checked <Z_STL_POS_SEQU> which value contains when you do the CONCATENATE, right? (sorry, it's the only thing coming in mind).
06-28-2016 8:39 AM
Debugger says column of <Z_STL_POS_SEQU> contains
0100
0190-0020-0100
0190-0030-0190-0020-0100
0170-0190-0030-0190-0020-0100
in fieldcatalogue field <Z_STL_POS_SEQU> is described as:
lv_col_pos = lv_col_pos + 1.
ls_fcat-fieldname = 'STL_POS_SEQU'.
ls_fcat-ref_table = 'ZPSPELEM_BEST'. " \ data element
ls_fcat-ref_field = 'STL_POS_SEQU'. " / Z_STL_POS_SEQU
ls_fcat-outputlen = 10.
ls_fcat-coltext = 'Sequenz StlPos'.
ls_fcat-col_pos = lv_col_pos.
ls_fcat-just = 'L'.
ls_fcat-lzero = abap_true.
APPEND ls_fcat TO lt_fcat.
ls_fcat-lzero = abap_false.
06-28-2016 8:43 AM
And field STL_POS_SEQU in your table ZPSPELEM_BEST how is defined?
Try to comment the REF_TABLE and REF_FIELD in your fieldcat, activate your report, run BCALV_BUFFER_DEL_SHARED to delete buffers and re-run your report
Message was edited by: Simone Milesi
06-28-2016 8:47 AM
Transparent table ZPSPELEM_BEST (see field no. 3):
MANDT MANDT CLNT 3 0 Mandant
PS_PSP_PNR PS_PSP_PNR NUMC 8 0 PSP-Element
STL_POS_SEQU Z_STL_POS_SEQU CHAR 49 0 Sequenz 10 StlPos
...
06-28-2016 8:47 AM
Hi,
If every time your field have 4 character then use conversion routine before concatenate the value with separate '-'. I hope it will help you.
Cheers,
John
06-28-2016 8:52 AM
Thanks a lot!
I just had to take out both values for REF_TABLE and REF_FIELD.
Buffer deletion was not necessary.
Best regards,
Hubert