Skip to Content
author's profile photo Former Member
Former Member

ALV: ADD leading ZEROs in a CHAR field

Hello Everybody!

I have a problem and I hope you can help me 😊

What I have:

1. ALV (hier)

2. Char field 'DEBIT' type SAKNR.

3. Field catalog TYPE slis_t_fieldcat_alv,

created by FUNCTION MODULE 'REUSE_ALV_FIELDCATALOG_MERGE'.

The problem is: i need to show leading zeros in ALV.

For example: an account '07110000' (in the inner table) is shown as '7110000'.

What I've done:

1. ls_fieldcat-lzero = 'X'.

ls_fieldcat-no_convext = 'X'.

2. CLEAR ls_fieldcat-ref_tabname.

ls_fieldcat-lzero = 'X'.

( ls_fieldcat-ref_fieldname was clear after filling by the function module)

I'm realy waiting for your advice! 😊

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2008 at 12:24 PM

    Hi

    try this way, you will get.

    SAKNR(10) TYPE n,

    Regs

    Srinivas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2008 at 12:03 PM

    Hi

    LZERO works rlevant only to fields of data type NUMC. In the default setting, the ALV Grid Control displays these fields right justified without leading zeros. If you set LZERO, leading zeros are displayed.

    SAKNR is having conversion exit CONVERSION_EXIT_ALPHA_OUTPUT.

    Regards

    Shiva

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 19, 2008 at 12:28 PM

    Hi,

    try to give refernce table name and reference field name for the field after the fieldcatalog merge FM.

    i mean to say modify the fieldcatalog for that particluar field by giving refernce table name and reference field name .

    or use conversion_exit_alpha_input to add zero's to it.

    Regards,

    Nagaraj

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member nagaraj kumar nishtala

      >

      > Hi,

      >

      > The reference table and field name u specified are wrong

      >

      > try this

      >

      > ls_fieldcat-outputlen = 8.

      > ls_fieldcat-lzero = 'X'.

      > ls_fieldcat-no_convext = 'X'.

      > ls_fieldcat-ref_tabname = 'SKA1'.

      > ls_fieldcat-ref_fieldname = 'SAKNR'.

      >

      > Regards,

      > Nagaraj

      😊 Thanks for advice, but I referenced to...

      ls_fieldcat-ref_tabname = 'T599I'.

      ls_fieldcat-ref_fieldname = 'PARAM'.

      ...because I tried to cancel conversion exit CONVERSION_EXIT_ALPHA_OUTPUT.

      Field 'PARAM' doesn't have conversion exit and has the same type like 'SAKNR'.

  • author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2008 at 01:46 PM

    ACTUALLY, I'm very embarrassed now, because ALL YOU, who advised me to use NO_CONVEXT was RIGHT!!!

    This way is correct:

    LOOP AT gt_fieldcat INTO ls_fieldcat
        WHERE fieldname = 'DEBIT' OR fieldname = 'CREDIT'.
          ls_fieldcat-no_convext = 'X'.
        MODIFY gt_fieldcat FROM ls_fieldcat. "TRANSPORTING fieldname lzero outputlen ref_tabname.
      ENDLOOP

    .

    My mistake was: I used TRANSPORTING (you can see it from my code) and I had forgoten about it. 😔 Sorry! If only I wasn't so absent-minded today...:(

    Thank YOU very very much!!!

    Edited by: Svetlana Bykova on Dec 22, 2008 6:46 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2008 at 01:53 PM

    Use NO_CONVEXT = 'X'.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.