Skip to Content
avatar image
Former Member

Field catalog issue using REUSE_ALV_FIELDCATALOG_MERGE

Hello experts,

I am using FM REUSE_ALV_FIELDCATALOG_MERGE and the field catalog is created fron the program.

The field catalog finds the date field from the program but my internal table has been changed to make the date output YYYY/MM/DD.

When I input the internal table in FM REUSE_ALV_GRID_DISPLAY the output displays the date as DD/MM/YYYY which is not what I want.

How can I get FM REAUSE_ALV_GRID_DISPLAY to output the date in the format YYYY/MM/DD which is in my input table.

I have spent a lot of time researching SDN on this but cannot find a similar solution however I did find some examples of changing the field catalogue. Can anybody suggest this is the way to go and if I would use the edit mask field in the field catalog or is there a better way.

Thanks for any suggestions

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 24, 2010 at 02:55 PM

    The field is type d or dats, right? As a result, the display is by user settings. So, declare the field as char (10). Put your date into it without doing WRITE (concatenate substrings separated by '/').

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 24, 2010 at 02:29 PM

    Hello Neil,

    Thank you for your reply. I am not familiar with field exits but will work through it. I may have further questions going forward.

    Hello Ruchak,

    I do not understand your recommendation. I have already changed the internal table to the required format which I am entering into SAP FM REUSE_ALV_GRID_DISPLAY but that FM changes the output back to the incorrect format so I do not get a second chance of changing the output. Please explain in more detail what you mean.

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 24, 2010 at 02:08 AM

    I think you can use a field exit for this.

    This means creating a field element and a domain in the data dictionary, the domain will need to have a conversion exit set by putting an entry in the 'Convers. Routine' field, eg MYDAT.

    You will need to create two function mdules as below:

    eg, CONVERSION_EXIT_MYDAT_OUTPUT

    and CONVERSION_EXIT_MYDAT_INPUT

    Your internal table will now need to refer to the data element you have created instead of the one you are currently using. ALV should automatically pick up the conversion exits and show the ouitput as you desire.

    FUNCTION CONVERSION_EXIT_MYDAT_OUTPUT.

    *"----


    ""Local Interface:

    *" IMPORTING

    *" REFERENCE(INPUT) TYPE DATS

    *" EXPORTING

    *" REFERENCE(OUTPUT)

    *"----


    concatenate input(4) '/' input4(2) '/' input6

    into output.

    ENDFUNCTION.

    FUNCTION CONVERSION_EXIT_MYDAT_INPUT.

    *"----


    ""Local Interface:

    *" IMPORTING

    *" REFERENCE(INPUT)

    *" EXPORTING

    *" REFERENCE(OUTPUT) TYPE DATS

    *"----


    data l_string type string.

    l_string = input.

    replace all occurrences of '/' in l_string with ' '.

    output = l_string.

    ENDFUNCTION.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 24, 2010 at 02:25 AM

    Hi,

    After executing the function module, you can modify the date field of the internal table.

    data : str type string.

    str = it_tab-date.

    "Now concatenate

    concatentae str+6(4) "Year

    '/'

    str+3(2) " Month

    '/'

    str+0(2) " date

    into str.

    This will give you YYYY/MM/DD

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 24, 2010 at 07:44 PM

    Thank you Breakpoint (and all that replied) problem solved

    Add comment
    10|10000 characters needed characters exceeded