How to display date field in ALV in format 'YYYY-MM-DD'?

Hi experts,
I am not getting displayed the date field in ALV in the format 'YYYY-MM-DD' if it is different than my user setting's format (DD.MM.YYYY).
Tried with the edit mask
LVC_S_FCAT-EDIT_MASK = '____-__-__'  but it does not work.
I could not find the conversion routine for this. Is it possible to write customer conversion routine?
I have to use DATE field, otherwise if I display this format in CHAR10 field , sorting in ALV does not work for this field.
PLEASE ANY HELP!
Kind regards,
Danijela

Hi,
Use FM FORMAT_DATE_4_OUTPUT.
TYPE-POOLS : slis, KKBLO.
TYPES: BEGIN OF t_data,
       sel     TYPE char1,
       matnr   TYPE matnr,
       bldat   type char10,
       END OF t_data.
DATA: it_tab TYPE STANDARD TABLE OF t_data,
      it_fcat TYPE slis_t_fieldcat_alv.
DATA: wa_tab TYPE t_data,
      wa_fcat TYPE slis_fieldcat_alv,
      wa_layout type SLIS_LAYOUT_ALV.
data: lv_repid    TYPE syrepid.
data : lv_date    type NLEI-IBGDT,
       lv_outdate type RN1DATUM-DATEX,
       lv_format  type RN1DATUM-FORMAT value 'YYYY-MM-DD'.
lv_repid = sy-repid.
lv_date = sy-datum.
CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
  EXPORTING
    datin         = lv_date
    format        =  lv_format
IMPORTING
   DATEX         = lv_outdate.
   move lv_outdate to wa_tab-bldat.
wa_tab-matnr = '0000001'.
APPEND wa_tab TO it_tab.
lv_date = sy-datum + 1.
CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
  EXPORTING
    datin         = lv_date
    format        =  lv_format
IMPORTING
   DATEX         = lv_outdate.
   move lv_outdate to wa_tab-bldat.
wa_tab-matnr = '0000002'.
APPEND wa_tab TO it_tab.
lv_date = sy-datum + 2.
CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
  EXPORTING
    datin         = lv_date
    format        =  lv_format
IMPORTING
   DATEX         = lv_outdate.
   move lv_outdate to wa_tab-bldat.
wa_tab-matnr = '0000003'.
APPEND wa_tab TO it_tab.
wa_fcat-fieldname = 'SEL'.
wa_fcat-ref_fieldname = 'XCHPF'.
wa_fcat-ref_tabname = 'MARA'.
wa_fcat-edit = 'X'.
wa_fcat-checkbox = 'X'.
APPEND  wa_fcat TO  it_fcat.
CLEAR :  wa_fcat.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-ref_fieldname = 'MATNR'.
wa_fcat-ref_tabname = 'MARA'.
APPEND  wa_fcat TO  it_fcat.
CLEAR :  wa_fcat.
wa_fcat-fieldname = 'BLDAT'.
wa_fcat-ref_fieldname = 'BLDAT'.
wa_fcat-ref_tabname = 'BKPF'.
APPEND  wa_fcat TO  it_fcat.
call 'REUSE_ALV_GRID_DISPLAY'' after this
Edited by: Ankur Parab on Oct 1, 2009 2:50 PM
Edited by: Ankur Parab on Oct 1, 2009 2:51 PM

Similar Messages

  • How to display the fields in ALV Output without using Field catalog?

    How to display the fields in ALV Output without using Field catalog?
    Could you pls tell me the coding?
    Akshitha.

    Hi,
    u mean without building field catalog. is it? I that case, we can use the FM REUSE_ALV_FIELDCATALOG_MERGE.
    data: itab type table of mara.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_structure_name = itab
    CHANGING
    ct_fieldcat = lt_fieldcat[]
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    *Pass that field catalog into the fillowing FM
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_grid_title            = 'REPORTING'
                is_layout              = gt_layout
                it_fieldcat             = lt_fieldcat[]
           tables
                t_outtab                = itab.

  • How to display MANDT field in ALV Grid display?

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = LV_REPID
       I_STRUCTURE_NAME                  = 'ZSTR_TRAIL'
       I_SAVE                            = 'A'
      TABLES
        T_OUTTAB                          = it_output
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2
    In the above code, I m using structure ZSTR_TRAIL, having MANDT field as the first field.
    But I am not able see the MANDT field column in the ALV output, but the internal table it_output is
    is populated with the client number in  MANDT field.
    What should I do to display the MANDT field?
    All the fields in the internal table it_output are displayed properly except the MANDT field.

    Hi Mohana,
    When you directly declare your structure in teh function module it will skip the Mandt field while displaying the out put.
    So if you would like to display the mandt field too then insted of defining it in the stucture parameter, you will have to manually fill the fieldcatalog.
    Ex :
      wa_fieldcat-col_pos = 1.
      wa_fieldcat-row_pos = 1.
      wa_fieldcat-fieldname = 'MANDT'.
      wa_fieldcat-tabname = 'it_final'.
      wa_fieldcat-ref_fieldname = 'MANDT'.
      wa_fieldcat-ref_tabname = 'ZSTR_TRAIL'.
      wa_fieldcat-outputlen = '20'.
      wa_fieldcat-key = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 2.
      wa_fieldcat-row_pos = 2.
      wa_fieldcat-fieldname = 'ERDAT'.
      wa_fieldcat-tabname = 'it_final'.
      wa_fieldcat-ref_fieldname = 'ERDAT'.
      wa_fieldcat-ref_tabname = 'VBAK'.
      wa_fieldcat-reptext_ddic = 'X' .
      wa_fieldcat-key = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
        i_callback_program                = sy-cprog
        it_fieldcat                       = it_fieldcat
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = it_final
    EXCEPTIONS
       program_error                     = 1
       OTHERS                            = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    This will fix your issue.
    Regards,
    Kittu
    Edited by: Kittu on Nov 5, 2009 8:25 AM

  • How to display data in table with specified format?

    Hi,
    Jdev 11.1.1.4, ADF BC and ADF Faces
    In my application I have created a EO based view object which will return data as below.
    Deptid       Loc          seq
       1            Loc1         1
       1            Loc2         2
       2            Loc1         3
       2            Loc2         4
       3            Loc1         5
       3            Loc2         6Now I have to display the data in table like below
                     Loc1
       1                              1st row
                     Loc2                  Loc1
       2                              2nd row
                     Loc2                  Loc1
       3                             3rdrow
                     Loc2 How can I do that? Any help will be appreciated.
    ~Abhijit
    Edited by: Abhijit Dutta on Nov 5, 2011 6:18 PM

    check this thread...
    display the data in chart format

  • How to change font while displaying data through an ALV table in WDA?

    Hi all,
    I am displaying data through and ALV table. Now I want to change the FONT only for few rows. Is this possible?
    If so then do the needful to me..
    Thanks & Regards,
    Yugesh A.

    I believe as you have found 'LVC_FIELDCATALOG_MERGE' would only work with the classic dynpro (SAPGUI based) version of the ALV. 
    You won't be able to control the font the same way in the WDA version of the ALV.  You will need to create a custom cell editor for the column(s) in question.  You can then bind context attributes to the properties of the cell editor. You will need extra attributes in your bound context to control these settings on the row level.  Also you will be restricted by the changing the DESIGN property. This means only the values allowed for the DESIGN of the particluar UI element.  For a TextView that wouldn't be the font directly (the font of course comes from the Theme).
    DATA l_salv_wd_table TYPE REF TO iwci_salv_wd_table.
      l_salv_wd_table = wd_this->wd_cpifc_alv_adv( ).
      DATA l_table TYPE REF TO cl_salv_wd_config_table.
      l_table = l_salv_wd_table->get_model( ).
      data textview type ref to CL_SALV_WD_UIE_TEXT_VIEW.
      l_column = l_table->if_salv_wd_column_settings~get_column( 'ADD_PARTICIPANTS' ).
      create object textview.
      textview->SET_TEXT_FIELDNAME( 'ADD_PARTICIPANTS' ).
      textview->set_design_fieldname( 'ADD_DESIGN' ).
      textview->set_wrapping( abap_true ).
      l_column->set_cell_editor( textview ).
    DESIGN supports the following options:
    Value
    Visual Display
    Description
    emphasized
    Text is highlighted in default size
    groupTitle
    Header for forms
    This enumeration value is deprecated. Instead, use SectionHeader.
    header1
    Text is highlighted with font size +4 in relation to the default font size.
    header2
    Text is highlighted with font size +5.08 cm relation to the default font size.
    header3
    Text is highlighted in default size
    header4
    Text is highlighted in font size -1 (small) in relation to the default font size (like the legend but highlighted)
    label
    Text is display in the default font type. A space is always inserted after the text.
    label_small
    Text is displayed in default font type, as with label, onyl that font size is -1 (like the font size for header4).
    legend
    Text is displayed with default font type in size -1.
    reference
    Text is in italics and in default font size.
    standard
    Text is displayed in default font size. No text attributes are defined for this value.
    monospace
    Text is displayed in no-proportional font type. Each letter takes up the same space.

  • How to display data from a recordset based on data from another recordset

    How to display data from a recordset based on data from
    another recordset.
    What I would like to do is as follows:
    I have a fantasy hockey league website. For each team I have
    a team page (clubhouse) which is generated using PHP/MySQL. The one
    area I would like to clean up is the displaying of the divisional
    standings on the right side. As of right now, I use a URL variable
    (division = id2) to grab the needed data, which works ok. What I
    want to do is clean up the url abit.
    So far the url is
    clubhouse.php?team=Wings&id=DET&id2=Pacific, in the end all
    I want is clubhouse.php?team=Wings.
    I have a separate table, that has the teams entire
    information (full team name, short team, abbreviation, conference,
    division, etc. so I was thinking if I could somehow do this:
    Recordset Team Info is filtered using URL variable team
    (short team). Based on what team equals, it would then insert this
    variable into the Divisional Standings recordset.
    So example: If I type in clubhouse.php?team=Wings, the Team
    Info recordset would bring up the Pacific division. Then 'Pacific'
    would be inserted into the Divisional Standings recordset to
    display the Pacific Division Standings.
    Basically I want this
    SELECT *
    FROM standings
    WHERE division = <teaminfo.division>
    ORDER BY pts DESC
    Could someone help me, thank you.

    Assuming two tables- teamtable and standings:
    teamtable - which has entire info about the team and has a
    field called
    "div" which has the division name say "pacific" and you want
    to use this
    name to get corresponding details from the other table.
    standings - which has a field called "division" which you
    want to use to
    give the standings
    SELECT * FROM standings AS st, teamtable AS t
    WHERE st.division = t.div
    ORDER BY pts DESC
    Instead of * you could be specific on what fields you want to
    select ..
    something like
    SELECT st.id AS id, st.position AS position, st.teamname AS
    team
    You cannot lose until you give up !!!
    "Leburn98" <[email protected]> wrote in
    message
    news:[email protected]...
    > How to display data from a recordset based on data from
    another recordset.
    >
    > What I would like to do is as follows:
    >
    > I have a fantasy hockey league website. For each team I
    have a team page
    > (clubhouse) which is generated using PHP/MySQL. The one
    area I would like
    > to
    > clean up is the displaying of the divisional standings
    on the right side.
    > As of
    > right now, I use a URL variable (division = id2) to grab
    the needed data,
    > which
    > works ok. What I want to do is clean up the url abit.
    >
    > So far the url is
    clubhouse.php?team=Wings&id=DET&id2=Pacific, in the end
    > all
    > I want is clubhouse.php?team=Wings.
    >
    > I have a separate table, that has the teams entire
    information (full team
    > name, short team, abbreviation, conference, division,
    etc. so I was
    > thinking if
    > I could somehow do this:
    >
    > Recordset Team Info is filtered using URL variable team
    (short team).
    > Based on
    > what team equals, it would then insert this variable
    into the Divisional
    > Standings recordset.
    >
    > So example: If I type in clubhouse.php?team=Wings, the
    Team Info recordset
    > would bring up the Pacific division. Then 'Pacific'
    would be inserted into
    > the
    > Divisional Standings recordset to display the Pacific
    Division Standings.
    >
    > Basically I want this
    >
    > SELECT *
    > FROM standings
    > WHERE division = <teaminfo.division>
    > ORDER BY pts DESC
    >
    > Could someone help me, thank you.
    >

  • How to display data in table

    Hi all,
    can any one tell me how to display data in a table when user click on a button. i have created a node with a set of fields from different tables now how to write the logic to display data in that table.
    Thanks & Regards,
    Naveen

    DATA lo_nd_professionaltable TYPE REF TO if_wd_context_node.
      DATA lo_el_professionaltable TYPE REF TO if_wd_context_element.
      DATA ls_professionaltable TYPE wd_this->ElementS_professionaltable. "internaltable
    TYPES: BEGIN OF TY_PFTAB,
           RATEGROUP TYPE /BIC/OIWRATEGRP,
           LEVEL TYPE /BIC/OIWPCSLEVEL,
           FROMDATE TYPE /BI0/OIDATEFROM,
           FROMTO TYPE /BI0/OIDATETO,
           STANDARD TYPE /BIC/OIWSTRATE,
           OVERHEAD1 TYPE /BIC/OIWOHRTE1,
           OVERHEAD2 TYPE /BIC/OIWOHRTE2,
           OVERHEAD3 TYPE /BIC/OIWOHRTE3,
           EXCEPTIONFLAG TYPE /BIC/OIMSECFILER,
           END OF TY_PFTAB.
    DATA : IT_PFTABLE TYPE STANDARD TABLE OF TY_PFTAB,
           WA_PFTAB TYPE TY_PFTAB.
    SELECT /BIC/WRATEGRP /BIC/WPCSLEVEL DATEFROM DATETO /BIC/WSTRATE /BIC/WOHRTE1 /BIC/WOHRTE2 /BIC/WOHRTE3
    FROM /BIC/AGLDCPRTS00 INTO TABLE IT_PFTABLE.
    *TYPES : BEGIN OF TY_EXCEPTION,
           EXCEPTIONFLAG TYPE /BIC/OIMSECFILER,
           END OF TY_EXCEPTION.
    *DATA : IT_EXTABLE TYPE STANDARD TABLE OF TY_EXCEPTION,
          WA_EXTABLE TYPE IT_EXTABLE.
    *SELECT /BIC/MSECFILER FROM /BIC/AGLDCLMLT00 INTO TABLE IT_EXTABLE.
    navigate from <CONTEXT> to <PROFESSIONALTABLE> via lead selection
      lo_nd_professionaltable = wd_context->get_child_node( name = wd_this->wdctx_professionaltable ).
    get element via lead selection
      lo_el_professionaltable = lo_nd_professionaltable->get_element( ).
    @TODO handle not set lead selection
    IF lo_el_professionaltable IS INITIAL.
    ENDIF.
    get all declared attributes
    lo_el_professionaltable->get_static_attributes(
       IMPORTING
         static_attributes = ls_professionaltable ).
    lo_nd_professionaltable->bind_table( new_items = IT_PFTABLE set_initial_elements = abap_false ).

  • How to display data depend upon ListBox value?

    Hi Experts and Particularly Hema,
    As I asked before how to display data in the ListBox, I got an very good response from you all(particularly Hema) .
    Now what my doubt is asked with sample scenario below:
    In Screen Painter -
    Two fields namely : One List Box and other is I/O used only for displaying purpose i.e., only for output, not for input purpose.
    List Box is filled by primary key field(C1) value from one table(T1) when the screen load.(i.e., such code is written in PBO).
    Now what I need is :
    If the user select any one value in the List Box then it automatically display the corresponding C2 value from T1 in the I/O field.
    I think you may all understand what I am trying to ask.Please let me know the solution.
    Thanks in advance,
    Regards,
    Raghu

    Simply attached a function code for the listbox... when the user changes the value, you will be able to pick this up in the PAI and loop back to the PBO and redisplay the corresponding output field.
    Jonathan

  • How to make some fields in ALV tree editable

    Hello All,
    Can any one tell me how to make some fields in ALV tree editable.
    If possible please post some code.
    Regards,
    Lisa.

    Hi Lisa,
    I want to make 3 fields in the ALV tree editable and update the saved values in ztable.
    I tried making the wa_fieldcat-edit = 'X' But in vain.
    Also i made the layout fields  wa_layout-edit = 'X'  and wa_layout-edit_mode = 'X'.
    But still the alv tree field appears as display.
    As you have mentioned in the post as answered, So please guide me to make the field editable.
    I am using oops method.
    Please provide me code if any.
    Thanks & Regards,
    Mozila

  • How to create required field in alv?

    hi friends^^
    how to create required field in alv?
    i don't find required option in fieldcatalog and others.
    is it possible?

    Source code..
    PLANETYPE is key_sel = 'X'.
    But does't required field...
    REPORT  zs32editable1  .
    TYPE-POOLS : slis.
    DATA : gt_sflight  TYPE TABLE OF sflight.
    DATA : gt_fieldcat TYPE slis_t_fieldcat_alv,
           gs_fieldcat LIKE LINE OF gt_fieldcat,
           gs_layout   TYPE slis_layout_alv.
    START-OF-SELECTION.
      SELECT *
        INTO CORRESPONDING FIELDS OF TABLE gt_sflight
        FROM sflight.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-edit = 'X'.
      gs_fieldcat-fieldname = 'PLANETYPE'.
      gs_fieldcat-key_sel = 'X'.
      append gs_fieldcat to gt_fieldcat.
    END-OF-SELECTION.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_STRUCTURE_NAME = 'SFLIGHT'
          is_layout        = gs_layout
          IT_FIELDCAT      = gt_fieldcat
        TABLES
          t_outtab         = gt_sflight
        EXCEPTIONS
          program_error    = 1
          OTHERS           = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.

  • How to show data vertical in ALV

    How to show data vertical in ALV?
    such as :
    [http://img402.imageshack.us/img402/9978/20101230215621.png|http://img402.imageshack.us/img402/9978/20101230215621.png]
    Moderator Message: Search for available information. Keywords - Dynamic Internal Table
    Edited by: kishan P on Dec 30, 2010 7:35 PM

    Transpose the contents of your internal table.
    Original:
    A 1 1 1
    B 2 2 2
    Transposed:
    A B
    1 2
    1 2
    1 2

  • How to display the field "Country" in the Address Book UI ?

    How to display the field "Country" in the Address Book UI ?

    Using an add-on, MoreFunctionsForAddressBook gives you that opportunity.

  • How to display data elements in the tempalte header

    Hello friends
    i've this date_from and date_to parameters which are date parameters that user enters..
    based on these date parameters I want to display them in the header as
    day of date_from(for example if the date_from is 13-nov-2010.then I should display 13)and for date_to it should dispaly as 15 if for example the user enters
    16-nov-2010.(date-1's day)
    so it should break down to
    date_from-13-nov-2010, 13
    date_to- 16-nov-2010, 15
    I want these two values to be displayed in the header of the template how to do this
    pls help
    also let me know how to display data elements in the template header
    Edited by: erp on Dec 22, 2010 12:44 AM

    Hi Ananth..Thanks for ur timely reply
    Can I use it with <? substring(':date_from',1,2)?>
    where date_from is an input parameter which user enters at the run time of the report.
    I've to capture the date entered by the user and print it in the header..
    Pls reply

  • How to display Date Calendar in Oracle BI Answers Prompts (parameter)

    I'm still new to OBIEE.
    How to display Date Calendar in Oracle BI Answers Prompts (parameter)?
    Thanks.

    Hi,
    While creating Dash Board prompt choose the control to 'Calendar'.
    I think it is not possible to provide 'Calendar' control using Prompts tab while creating request.
    It is possible to write Java Script for a Column of data type 'char'. So, cast the date data type to char.
    Go to: Column Properties --> Data Format
    Choose override default data format to view the available options in the drop down list.
    I would be very happy if anybody acknowledge me that I am wrong.
    -Vency

  • How to display date and time on jsf page

    Hi,
    how to display date and time on jsf page
    we are using 11.2.0.0 jdeveloper on windows.
    thanks
    Edited by: user12187801 on 26-Jul-2012 01:42

    Your question is certainly lacking some information.
    If you want a constantly updating date/time - then JavaScript is your best bet, and Google would find you examples like [url http://www.webestools.com/scripts_tutorials-code-source-7-display-date-and-time-in-javascript-real-time-clock-javascript-date-time.html]this
    If you meant something else, then it's back to you to explain.

Maybe you are looking for

  • Video card failure on iMac (aluminum) - Excellent Apple Support

    My iMac (aluminum) 20" (2.4 GHz, 2GB RAM, 500GB HDD) greeted me with a grey / black screen this morning, a reboot resorted in the screen flashing as if the back light was going as it booted up along with static / noise lines and dashes then the scree

  • T430 External Upgrade Query

    Hi , I have T430 Thinkpad Notebook with the following Config : - Processor : Intel(R) Core(TM) i5-3320M CPU @ 2.6ghz -Ram :8GB -Display adapter: Intel(R) HD Graphics 4000. Express Card Slot available . OS : Window 7  enterprise 64 Bit Query : I am no

  • Adding GREP search to FindChangeByList script in CS4

    I'm trying to remove numbers from a baseball box score pulled from the Internet. The file has 10 numbers across separated by tabs and I only need six of the numbers not all 10 St. Lucie Mets Player,Pos         AB     R     H     2B     3B     HR    

  • Oracle Database version support

    My manager was asking about our plans to upgrade our current Oracle database version (10.1.0.4). We're currently humming along nicely, so I thought that I'd use an Obsolescence Policy as a guide to push us forward. I looked all over Metalink, but thi

  • Zipping unpacked OpenDocument in Windows

    Hello, I try to pack unpacked and modified OpenDocument file (specifically .ods), using the java.util.zip package back into .ods. My code works only in Linux, not Windows. For zipping, I use this code: // returns list of all files and dirs String[] f