Display amount in ALV Grid with different Decimal Places based on Currency

HI Experts,
Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2.
we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
AED---22.56
KWD---225.65
i need to display values like AED : 22.56

HI Experts,
Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2. we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
AED---22.56
KWD---225.65 (converting this value to 22.565 using BAPI_CURRENCY_GETDECIMALS according to currency in my Report)
i need to display values like AED : 22.56
                                         KWD---22.565 but here field is NETWR with 2 decimal.
Need to Display amount in ALV Grid with different Decimal Places based on Currency
Regards,
Dileep Kumar Reddy

Similar Messages

  • Displaying amounts in ALV grid

    hi,
    iam fetching ESBTR from FEBKO which i have to display using ALV grid.
    but the problem is when there is no value in that field it should display zeros 0.00
    but it is displaying space.
    can somebody help me in this.
    neha

    hi,
    I tried using no_zero property also .Iam sending the sample code . please check it.
    *& Report  ZTEST17                                                     *
    REPORT  ZTEST17                                 .
    type-pools: slis.
    types: begin of x_tab1,
           bukrs type bukrs,
           hbkid type hbkid,
           hktid type hktid,
           bankn type bankn,
           waers type waers,
           hkont type hkont,
           ESBTR type ESBTR_EB,
           AZDAT type AZDAT_EB,
           end of x_tab1,
           begin of x_tab2,
           KUKEY type KUKEY_EB,
           ESBTR type ESBTR_EB,
           AZDAT type AZDAT_EB,
           waers type waers,
           end of x_tab2.
    data: t_tab1 type standard table of x_tab1,
          w_tab1 type x_tAb1,
          t_tab2 type standard table of x_tab2,
          w_tab2 type x_tab2.
    data: g_bukrs type bukrs,
          g_hbkid type hbkid,
          g_hktid type hktid,
          g_kukey type KUKEY_EB.
    DATA: afield     TYPE slis_fieldcat_alv,
          t_fieldcat TYPE slis_t_fieldcat_alv.
    data: l_tabix type sy-tabix.
    select-options: s_bukrs for g_bukrs,
                    s_hbkid for g_hbkid,
                    s_hktid for g_hktid,
                    s_kukey for g_kukey.
      SELECT bukrs hbkid hktid bankn waers hkont
        INTO CORRESPONDING FIELDS OF TABLe t_tab1
        FROM t012k
       WHERE bukrs IN s_bukrs
         AND hbkid IN s_hbkid
         AND hktid IN s_hktid.
    LOOP AT T_TAB1 into w_tab1.
    l_tabix = sy-tabix.
          SELECT kukey esbtr azdat waers
          INTO TABLE t_tab2
          FROM febko
          WHERE anwnd = '0001'
          AND hkont = w_tab1-hkont
          AND bukrs = w_tab1-bukrs
          AND kukey IN s_kukey.
          SORT t_tab2 BY kukey DESCENDING.
          READ TABLE t_tab2 into w_tab2 INDEX 1.
         if sy-subrc eq 0.
         move w_tab2-esbtr TO w_tab1-esbtr .
         modify t_tab1 from w_tab1 index l_tabix.
         endif.
    endloop.
      CLEAR afield.
      afield-fieldname     = 'BUKRS'.
      afield-ref_tabname   = 'BSEG'.
      afield-ref_fieldname = 'BUKRS'.
      afield-col_pos       = '1'.
      APPEND afield TO t_fieldcat.
    House Bank Account
      CLEAR afield.
      afield-fieldname     = 'HBKID'.
      afield-ref_tabname   = 'T012K'.
      afield-ref_fieldname = 'HBKID'.
      afield-col_pos       = '2'.
      APPEND afield TO t_fieldcat.
    House Bank Account ID
      CLEAR afield.
      afield-fieldname     = 'HKTID'.
      afield-ref_tabname   = 'T012K'.
      afield-ref_fieldname = 'HKTID'.
      afield-col_pos       = '3'.
      APPEND afield TO t_fieldcat.
    Bank Name
      CLEAR afield.
      afield-fieldname     = 'BANKN'.
      afield-ref_tabname   = 'BNKA'.
      afield-ref_fieldname = 'BANKN'.
      afield-col_pos       = '4'.
      APPEND afield TO t_fieldcat.
    Currency
      CLEAR afield.
      afield-fieldname     = 'WAERS'.
      afield-ref_tabname   = 'TCURC'.
      afield-ref_fieldname = 'WAERS'.
      afield-col_pos       = '5'.
      APPEND afield TO t_fieldcat.
    G/L Account
      CLEAR afield.
      afield-fieldname     = 'HKONT'.
      afield-ref_tabname   = 'T012K'.
      afield-ref_fieldname = 'HKONT'.
      afield-col_pos       = '6'.
      APPEND afield TO t_fieldcat.
    Bank Account Balance
      CLEAR afield.
      afield-fieldname     = 'ESBTR'.
      afield-no_zero       = ' '.
      afield-reptext_ddic  = 'Bank Statement Balance'.
      afield-just          = 'L'.
      afield-cfieldname    = 'KRW'.
      afield-ref_fieldname = 'ESBTR'.
      afield-ref_tabname   = 'FEBKO'.
      afield-col_pos       = '7'.
      APPEND afield TO t_fieldcat.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM             = sy-repid
       IT_FIELDCAT                    = t_fieldcat
      TABLES
        t_outtab                       = t_tab1[]
    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.

  • ALV grid with editable fields

    Dear Colleagues,
    I develop an ALV grid with OO standard methods. Before the first display of the table I define the editable fields. It works fine.
    I have a problem : if the table is empty and I press the standard icons "Append a line" or "Insert a line", the new line don't have the defined editable characteristics.for fields. Is there a standard method which I have forgotten ?
    Thanks a lot and kind regards
    Peter

    vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_delete_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_append_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_insert_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_cut.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_undo.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
    * Displaying the output in ALV Grid
        vs_layout_grid-no_rowmark = 'X'.
        vs_layout_grid-zebra      = 'X'.
        vs_layout_grid-cwidth_opt = 'X'.
        vs_layout_grid-edit       = 'X'.
        vs_layout_grid-ctab_fname = 'CT'.
        vs_layout_grid-stylefname = 'CELLTAB'.
        CALL METHOD v_grid->set_table_for_first_display
          EXPORTING
            i_save                        = 'X'
            is_layout                     = vs_layout_grid
            it_toolbar_excluding          = i_toolbar_excluding[]
          CHANGING
            it_outtab                     = itab[]
            it_fieldcatalog               = it_fieldcat[]
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc NE 0.
          MESSAGE 'ALV Grid display unsuccessful' TYPE 'I'.
          STOP.
        ENDIF.                             " IF sy-subrc NE 0
      ELSE.                                " IF w_custom_container...
    * Refresh the container if it already exists
        CALL METHOD v_grid->refresh_table_display
          EXCEPTIONS
            finished = 1
            OTHERS   = 2.
        IF sy-subrc NE 0.
          MESSAGE 'Refreshing the container is not successful' TYPE 'I'.
          STOP.
        ENDIF.                            

  • ALV grid with 2 labels on the output

    Hi,
    I am trying ALV  Grid with two labels using Function modules.
    in the output, it should appear like...
    Header1 | Header2 | Header3 | Header4 |
    T21
    T22
    T31
    T32
    First line is for Header lable and second line is for item lable under corresponding Header labels.
    Pls. can any suggest me a solution for this..
    Thanks
    PRa

    Using the Gird Functions it is not possible, you can get the with the help of ALV list function.
    If you use this aproach you will loose some Functionalities, Your Report Output will Distorted.
    cehck this image..
    http://img100.imageshack.us/img100/3846/output6ef.th.gif
    REPORT ZTEST_ALV message-id zz .
    TYPE-POOLS: SLIS.
    DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
    IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    L_LAYOUT type slis_layout_alv,
    x_events type slis_alv_event,
    it_events type SLIS_T_EVENT.
    DATA: BEGIN OF ITAB OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    MALE type i,
    female type i,
    END OF ITAB.
    SELECT VBELN
    POSNR
    FROM VBAP
    UP TO 20 ROWS
    INTO TABLE ITAB.
    X_FIELDCAT-FIELDNAME = 'VBELN'.
    X_FIELDCAT-SELTEXT_L = 'VBELN'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 1.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'POSNR'.
    X_FIELDCAT-SELTEXT_L = 'POSNR'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 2.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'MALE'.
    X_FIELDCAT-SELTEXT_L = 'MALE'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 3.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'FEMALE'.
    X_FIELDCAT-SELTEXT_L = 'FEMALE'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 3.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    x_events-NAME = SLIS_EV_TOP_OF_PAGE.
    x_events-FORM = 'TOP_OF_PAGE'.
    APPEND x_events TO iT_EVENTS.
    CLEAR x_events .
    L_LAYOUT-NO_COLHEAD = 'X'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = L_LAYOUT
    IT_FIELDCAT = IT_FIELDCAT
    it_events = it_events
    TABLES
    T_OUTTAB = ITAB
    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.
    FORM TOP_OF_PAGE.
    *-To display the headers for main list
    FORMAT COLOR COL_HEADING.
    WRITE: / SY-ULINE(103).
    WRITE: / SY-VLINE,
    (8) ' ' ,
    SY-VLINE,
    (8) ' ' ,
    SY-VLINE,
    (19) '***'(015) centered,
    sy-vline.
    WRITE: / SY-VLINE,
    (8) 'VBELN'(013) ,
    SY-VLINE,
    (8) 'POSNR'(014) ,
    SY-VLINE,
    (8) 'MALE'(016) ,
    sy-vline,
    (8) 'FMALE'(017) ,
    sy-vline.
    FORMAT COLOR OFF.
    ENDFORM.

  • ALV GRID with own EXCEL-Template

    Hallo,
    I have Problem with using ALV-Grid with a own created
    template.
    At First I copy the SAP_OM.XLS template to CUS_OM.XLS.
    Then I update it by deleting all sheets, but not RAWDATA.
    When I use this template in ALV-GRID, it would be the right one, but it his no Data.
    The security settings in Excel are correct.
    Can anyone help me to show the data like the normal
    ALV-GRID??
    thanks Dieter

    Hi
    Check this link...
    How to send data  to different tabs of an excel sheet?

  • OO ALV grid with a header line is this possible?

    Howdy!
    I have a requirement where I need to produce an ALV grid with the following format:
    <b>Text 1     Text 2  Text 3                  Text 4
                              Text 6
    Col_1 Col_2 Col_3 Col_4 Col_5 Col_6 Col_7 Col_8 Col_9 
    Cell conents -
    Cell conents -
    Cell conents -
    Cell conents -
    Cell conents -
    </b>
    Anyone got any idea on how to get the 'TEXT' fields into the ALV grid? These are dynamic texts that would basically display details of data entered in the selection screen.
    The ALV title line is limited to 70 characters and I can't think of another way of doing this.
    The texts need to appear on the ALV grid becasue the user would like to download them to Excel in addition to the ALV cell contents using the standard ALV functionality.
    Any ideas would be appreciated!
    Message was edited by: Robert

    I'm thinking that this may not work because it is not a full screen grid and the grid container does not care about the container on top of it so, it most likely would not print it.   Implement this example program, you can see how this would work for you if you were using the FM.
    report zrich_0001
           no standard page heading.
    * Global ALV Data Declarations
    type-pools slis.
    data: begin of i_alv occurs 0,
          matnr type mara-matnr,
          end of i_alv.
    * Miscellanous Data Declarations
    data: fieldcat type slis_t_fieldcat_alv,
          events   type slis_t_event,
          list_top_of_page type slis_t_listheader,
          top_of_page  type slis_formname value 'TOP_OF_PAGE'.
    start-of-selection.
      perform initialization.
      perform get_data.
      perform call_alv.
    end-of-selection.
    *  Form  Initialization
    form initialization.
      clear i_alv.       refresh i_alv.
      perform eventtab_build using events[].
    endform.
    *  Form  Get_Data
    form  get_data.
      select matnr into table i_alv
                  from mara up to 100 rows.
    endform.
    *  CALL_ALV
    form call_alv.
      data: variant type  disvariant.
      data: repid type sy-repid.
      repid = sy-repid.
      variant-report = sy-repid.
      variant-username = sy-uname.
      perform build_field_catalog.
      perform comment_build using list_top_of_page[].
    * Call ABAP List Viewer (ALV)
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                it_fieldcat        = fieldcat
                i_callback_program = repid
                is_variant         = variant
                it_events          = events[]
                i_save             = 'U'
           tables
                t_outtab           = i_alv.
    endform.
    * EVENTTAB_BUILD
    form eventtab_build using events type slis_t_event.
    * Registration of events to happen during list display
      data: tmp_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = events.
      read table events with key name = slis_ev_top_of_page
                               into tmp_event.
      if sy-subrc = 0.
        move top_of_page to tmp_event-form.
        append tmp_event to events.
      endif.
    endform.
    * BUILD_FIELD_CATALOG
    form build_field_catalog.
      clear: fieldcat. refresh: fieldcat.
      data: tmp_fc type slis_fieldcat_alv.
      tmp_fc-reptext_ddic = 'Material'.
      tmp_fc-fieldname    = 'MATNR'.
      tmp_fc-tabname      = 'I_ALV'.
      tmp_fc-outputlen    = 18.
      append tmp_fc to fieldcat.
    endform.
    * COMMENT_BUILD
    form comment_build using list_top_of_page type
                                            slis_t_listheader.
      data: tmp_line type slis_listheader.
      clear tmp_line.
      tmp_line-typ  = 'H'.
      tmp_line-info = 'Here is a line of text'.
      append tmp_line to list_top_of_page.
      clear tmp_line.
      tmp_line-typ  = 'S'.
      tmp_line-key  = 'Key1'.
      tmp_line-info = 'Here is a value'.
      append tmp_line to list_top_of_page.
      clear tmp_line.
      tmp_line-typ  = 'S'.
      tmp_line-key  = 'Key2'.
      tmp_line-info = 'Here is another value'.
      append tmp_line to list_top_of_page.
    endform.
    * TOP_OF_PAGE
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                i_logo             = 'ENJOYSAP_LOGO'
                it_list_commentary = list_top_of_page.
    endform.
    Regards,
    Rich Heilman

  • Group feature at ALV grid with editable columns

    Am I right ?
    Group function by using a sorted layout is disabled while having one (or more) editable columns, isn't it ?
    ... or is there a possibility to use gouped rows ?
    Greetings
    Markus

    Also...
    *& Report ZDEMO_ALVGRID_EDIT *
    *& Example of a simple ALV Grid Report *
    *& The basic ALV grid, Enhanced to display specific fields as *
    *& editable depending on field value *
    REPORT ZDEMO_ALVGRID_EDIT .
    TABLES: ekko.
    TYPE-POOLS: slis. "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekpo-ebeln,
    ebelp TYPE ekpo-ebelp,
    statu TYPE ekpo-statu,
    aedat TYPE ekpo-aedat,
    matnr TYPE ekpo-matnr,
    menge TYPE ekpo-menge,
    meins TYPE ekpo-meins,
    netpr TYPE ekpo-netpr,
    peinh TYPE ekpo-peinh,
    field_style TYPE lvc_t_styl, "FOR DISABLE
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    DATA: it_fieldcat TYPE lvc_t_fcat, "slis_t_fieldcat_alv WITH HEADER LINE,
    wa_fieldcat TYPE lvc_s_fcat,
    gd_tab_group TYPE slis_t_sp_group_alv,
    gd_layout TYPE lvc_s_layo, "slis_layout_alv,
    gd_repid LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    PERFORM data_retrieval.
    PERFORM set_specific_field_attributes.
    PERFORM build_fieldcatalog.
    PERFORM build_layout.
    PERFORM display_alv_report.
    *& Form BUILD_FIELDCATALOG
    Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
    wa_fieldcat-fieldname = 'EBELN'.
    wa_fieldcat-scrtext_m = 'Purchase Order'.
    wa_fieldcat-col_pos = 0.
    wa_fieldcat-outputlen = 10.
    wa_fieldcat-emphasize = 'X'.
    wa_fieldcat-key = 'X'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'EBELP'.
    wa_fieldcat-scrtext_m = 'PO Item'.
    wa_fieldcat-col_pos = 1.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'STATU'.
    wa_fieldcat-scrtext_m = 'Status'.
    wa_fieldcat-col_pos = 2.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'AEDAT'.
    wa_fieldcat-scrtext_m = 'Item change date'.
    wa_fieldcat-col_pos = 3.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'MATNR'.
    wa_fieldcat-scrtext_m = 'Material Number'.
    wa_fieldcat-col_pos = 4.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'MENGE'.
    wa_fieldcat-scrtext_m = 'PO quantity'.
    wa_fieldcat-col_pos = 5.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'MEINS'.
    wa_fieldcat-scrtext_m = 'Order Unit'.
    wa_fieldcat-col_pos = 6.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'NETPR'.
    wa_fieldcat-scrtext_m = 'Net Price'.
    wa_fieldcat-edit = 'X'. "sets whole column to be editable
    wa_fieldcat-col_pos = 7.
    wa_fieldcat-outputlen = 15.
    wa_fieldcat-datatype = 'CURR'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'PEINH'.
    wa_fieldcat-scrtext_m = 'Price Unit'.
    wa_fieldcat-col_pos = 8.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    ENDFORM. " BUILD_FIELDCATALOG
    *& Form BUILD_LAYOUT
    Build layout for ALV grid report
    FORM build_layout.
    Set layout field for field attributes(i.e. input/output)
    gd_layout-stylefname = 'FIELD_STYLE'.
    gd_layout-zebra = 'X'.
    ENDFORM. " BUILD_LAYOUT
    *& Form DISPLAY_ALV_REPORT
    Display report using ALV grid
    FORM display_alv_report.
    gd_repid = sy-repid.
    call function 'REUSE_ALV_GRID_DISPLAY'
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
    i_callback_program = gd_repid
    i_callback_user_command = 'USER_COMMAND'
    is_layout_lvc = gd_layout
    it_fieldcat_lvc = it_fieldcat
    i_save = 'X'
    TABLES
    t_outtab = it_ekko
    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.
    ENDFORM. " DISPLAY_ALV_REPORT
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
    SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
    UP TO 10 ROWS
    FROM ekpo
    INTO CORRESPONDING FIELDS OF TABLE it_ekko.
    ENDFORM. " DATA_RETRIEVAL
    *& Form set_specific_field_attributes
    populate FIELD_STYLE table with specific field attributes
    form set_specific_field_attributes .
    DATA ls_stylerow TYPE lvc_s_styl .
    DATA lt_styletab TYPE lvc_t_styl .
    Populate style variable (FIELD_STYLE) with style properties
    The NETPR field/column has been set to editable in the fieldcatalog...
    The following code sets it to be disabled(display only) if 'NETPR'
    is gt than 10.
    LOOP AT it_ekko INTO wa_ekko.
    IF wa_ekko-netpr GT 10.
    ls_stylerow-fieldname = 'NETPR' .
    ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
    "set field to disabled
    APPEND ls_stylerow TO wa_ekko-field_style.
    MODIFY it_ekko FROM wa_ekko.
    ENDIF.
    ENDLOOP.
    endform. " set_specific_field_attributes
    REWARD POINTS IF usefful !!

  • Manipulate Layout on ALV Grid with dynamic table

    Dear all
    i'm generating a dynamic table depending of a date selection. That means that I show columns for weeks and the quantity of weeky migh change.
    Now the users wants to have a specific layout of the ALV grid with totals. When he saves the layout, only the weeks at this selection will show the next time he runs the programm with a larger selection.
    a) Is it possible to modify the layout during runtime by programming?
    b) Do you have any other ideas how to solve this problem?
    Thank you

    You don't know the names of your columns? hmm you do, because before you created dynamic table you had to create field catalog, so the structure and column names of newly (dynamically) created table will be the same like defined in the field catalog.
    The last loop also does not look good, in my opinion should be something like:
    LOOP AT lt_datatable +(my first table)+ ASSIGNING <ls_data4>.
        AT NEW pernr.
          APPEND initial line to <fs_1> assigning <fs_2>.
          <fs_2>-pernr = <ls_data4>-pernr.
        ENDAT.
        ASSIGN COMPONENT <ls_data4>-wage_type OF STRUCTURE <fs_2> TO <fs_5>.
        <fs_5> = <ls_data4>-amount.
    ENDLOOP.
    also keep in mind that number of calls of method cl_alv_table_create=>create_dynamic_table is limited to 36 (?) calls within one program session because it uses dynamic subroutine pool behind so you will have short dump if you will execute that 37 times.

  • Not able to display logo on alv grid output

    hi
    can anybody guide me.
    i have written code for displaying logo on alv grid report.
    i uploaded bmp image using OAER
    but even then i am not able to display logo on the report please help me
    i am using 4.7 version..
    code...
    REPORT  ZALVLOGO                                .
    type-pools: slis.
    data: i_sflight type table of sflight.
    *data: begin of i_sflight occurs 10.
    *include structure sflight.
    *data: end of i_sflight.
    data: it_events type slis_t_event,
           wa_events type slis_alv_event.
    select * from sflight into table i_sflight.
    perform form_fill_table.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_TOP_OF_PAGE            = 'top-of-page'
       I_STRUCTURE_NAME                  = 'sflight'
      TABLES
        T_OUTTAB                          = i_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.
    *&      Form  top_of_page
          text
    -->  p1        text
    <--  p2        text
    FORM top-of-page .
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader.
    wa_header-typ = 'h'.
    wa_header-info = 'FLIGHT DETAILS'.
    APPEND wa_header to t_header.
    CLEAR WA_HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = t_header
        I_LOGO                   = 'ENJOY'.
      I_END_OF_LIST_GRID       =.
    ENDFORM.                    " top_of_page
    *&      Form  form_fill_table
          text
    -->  p1        text
    <--  p2        text
    FORM form_fill_table .
    clear wa_events.
    wa_events-name = 'top-op-page1'.
    wa_events-form = 'top-of-page'.
    append wa_events to it_events.
    ENDFORM.                    " form_fill_table

    hi ,
    First upload images  in SAP using transaction se78
    http://www.howforge.com/step-by-step-upload-bitmap-images-to-sap
    Then use that Image name to call using function module 
    in top of -page 
    call function 'REUSE_ALV_COMMENTARY_WRITE'
          exporting
            i_logo             = 'KAL1_LOGO'
            it_list_commentary = lt_top_of_page_no_sel.
    Regards
    Deepak.

  • Default collapsed view in ALV grid with subtotoal lines

    Hallo experts,
    I am displaying a ALV grid with subtotals. Now my requirement to display the Grid with only subtotal lines. Means the grid should be displayed in collapsed mode by default.
    Can any you help me finding this option.
    Thanks.
    Matt.

    Hallo experts,
    I am displaying a ALV grid with subtotals. Now my requirement to display the Grid with only subtotal lines. Means the grid should be displayed in collapsed mode by default.
    Can any you help me finding this option.
    Thanks.
    Matt.
    Hi Matt,
    Whe you call the FM REUSE_ALV_GRID_DISPLAY, you have to fill the table it_sort.
    In this table, you have to fill the field FIELDNAME with the field that you can show with susbstotals and fill the field EXPA with 'X'.
    W_SORT-SPOS = 1.
    W_SORT-FIELDNAME = 'CODIGO'.
    W_SORT-SUBTOT = 'X'.
    W_SORT-EXPA = 'X'.
    APPEND W_SORT TO IT_SORT.
    In the fieldcatalog there must be any with the field DO_SUM = 'X'
    You can maka this directly in the list by creating a variant with susbtotals, colapse them and save as a default variant for all users.
    Regards,
    Pepe
    Regards,
    Pepe

  • Binding ALV GRID with Deep Internal Table

    Hello all,
    I am looking for a way to display ALV Grid with the Deep ITAB.
    My ITAB is not too complex.
    It has One Structure which gets whole DB table + One extra field.
    Therefore my Itab looks as follows.
    TYPES: BEGIN OF TY_TRIP,
            ZPM_UPLOAD LIKE ZDBTABLE, "ZDBTABLE is custom database table.
            TDTIME TYPE STRING,
           END OF TY_TRIP.
    DATA: ITAB TYPE TABLE OF TY_TRIP,
          WA_ITAB LIKE LINE OF ITAB.
    Now i am able to populate data into Deep ITAB.
    If i call ALV Grid with ITAB then i get error. So how to call 'REUSE_ALV_GRID_DISPLAY' with this ITAB?
    Thanks in advance.

    Hello,
    My senior asked me to use the below definition.
    TYPES: BEGIN OF TY_TRIP.
            INCLUDE STRUCTURE ZDBTABLE.
    TYPES:  TDTIME TYPE STRING,
           END OF TY_TRIP.
    DATA: ITAB TYPE TABLE OF TY_TRIP,
          WA_ITAB LIKE LINE OF ITAB.
    If anyone else is looking to print in ALV, they can use this type of ITAB definition though it gives you the flexiblity to create ITAB and also making it FLAT and not DEEP.
    But i am still looking for an answer for my first post.
    Thanks.

  • ALV Grid with Popup Window

    Hey @all,
    I want to make a ALV Grid with a Popup Window. The idea is that there is a field for notes and when you click on this field a popup window should be opened where you can insert more text or if text already exists only the first column of the text is shown in field until you click on the field.
    Is there any possibility to do it this way? Do I have to make a second Grid for this Popup Window? Do anybody have an example how to solve this problem?
    Thank you in advance for your answers!
    Greetings,
    Alexander

    *& Report  Z_VISHVAS_ALV1
    report  z_vishvas_alv1.
    type-pools: slis.
    data: begin of i_outtab occurs 0.
            include structure sflight.
    data:   w_chk type c.                  "For multiple selection
    data: end of i_outtab.
          I_OUTTAB TYPE SFLIGHT OCCURS 0,
    data: i_private type slis_data_caller_exit,
          i_selfield type slis_selfield,
          w_exit(1) type c.
    parameters: p_title type sy-title.
    start-of-selection.
      select * from sflight into table i_outtab.
      call function 'REUSE_ALV_POPUP_TO_SELECT'
           exporting
                i_title                 = p_title
                i_selection             = 'X'
                i_zebra                 = 'X'
              I_SCREEN_START_COLUMN   = 0
              I_SCREEN_START_LINE     = 0
              I_SCREEN_END_COLUMN     = 0
              I_SCREEN_END_LINE       = 0
                i_checkbox_fieldname    = 'W_CHK'
              I_LINEMARK_FIELDNAME    =
              I_SCROLL_TO_SEL_LINE    = 'X'
                i_tabname               = 'I_OUTTAB'
                i_structure_name        = 'SFLIGHT'
              IT_FIELDCAT             =
              IT_EXCLUDING            =
              I_CALLBACK_PROGRAM      =
              I_CALLBACK_USER_COMMAND =
               IS_PRIVATE             = I_PRIVATE
         importing
                es_selfield             = i_selfield
                e_exit                  = w_exit
           tables
                t_outtab                = i_outtab
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
       MESSAGE i000(0k) WITH sy-subrc.
      endif.
    *****the internal table is modified with a cross sign for marking the
    ***rows selected
      loop at i_outtab where w_chk = 'X'.
        write: /  i_outtab-carrid, i_outtab-price.
      endloop.

  • ALV GRID with icon fields. When exports to Excel, icon fields are emtpy.

    Hi all,
    In our SAP system (6.0 ECC) we've noticed the following behaviour:
    In ALV GRID with icons (color lights for example...) when we export the list to Excel format with the standard button bat, the icon column is always empty.
    We think that in previous SAP version (4.7), the code corresponding to the icon appeared (For example @08@ for green light).
    It's possible to have tha same functionality in this new version like in 4.7?
    Regards.
    Edited by: Ole ES on Nov 17, 2010 6:05 PM

    Hi,
    Check the format in which you export to Excel (MHTML, XML, ...) and try antoher one.
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/66/79ad48157f11d2953700a0c930328a/content.htm
    I think the integrated Excel mode shows '@08@'.
    Best regards,
    Guillaume

  • Convert amount with four decimal places to amount with two decimal places

    Hi,
    for specific reasons we have set the prices to four decimal places. However, in an invoice the staff needs to see all prices with two decimal places. Therefore I have created new user-defined fields which should show the rounded values However, I have not yet found the right formatted search that outputs the value with two decimal places including currency symbol.
    The statement 
    SELECT $[$38.20.NUMBER]
    outputs the value with two decimal places which is fine, but it does not contain the currency.
    The statement
    SELECT $[$38.20.0]
    outputs both value and currency, but the value still has four decimal places as the original price.
    And the statement
    SELECT CAST($[$38.20.NUMBER] AS VARCHAR(20)) + $[$38.20.CURRENCY]
    outputs a value with even six decimal places.
    Did anyone already have the same problem???
    Or does anyone have any idea???
    Thanks and regards
    Corinna

    Hi again,
    the value should be displayed in a user-defined field of the screen.
    The result of the query
    SELECT $[$38.20.NUMBER]
    has already two decimal places, so that I do not need a round here. But the currency is missing.
    When I add the round function to the query
    SELECT $[$38.20.0]
    it does unfortunatly result in an error.
    Any ideas????
    Thanks so much in advance!

  • Displaying all numbers with 2 decimal places

    Hi All,
    We have a requirement in our code where we want that all numbers must be diplayed with 2 decimal places.
    Eg: If a number is 21.234 then it should be displayed as 21.23
    If a number is 21.289 then it should be displayed as 21.28
    If a number is 21 then it should be displayed as 21.00
    Can anyone please help me how to do it in a SQL query.
    Regards,
    Shruti

    Hi, Shruti,
    This shows a couple of things you can do:
    COLUMN     trnc     FORMAT     999999.99
    WITH     got_x     AS
         SELECT     empno / 1000     AS x
         FROM     scott.emp
    SELECT     x
    ,     TO_CHAR (x,            '999999.99')     AS tc
    ,     TO_CHAR (TRUNC (x, 2), '999999.99')     AS trnc_tc
    ,     TRUNC (x, 2)                              AS trnc
    FROM     got_x
    ;Output:
    `        X TC         TRNC_TC          TRNC
         7.369       7.37       7.36       7.36
         7.499       7.50       7.49       7.49
         7.521       7.52       7.52       7.52
         7.566       7.57       7.56       7.56
         7.654       7.65       7.65       7.65
         7.698       7.70       7.69       7.69
         7.782       7.78       7.78       7.78
         7.788       7.79       7.78       7.78
         7.839       7.84       7.83       7.83
         7.844       7.84       7.84       7.84
         7.876       7.88       7.87       7.87
           7.9       7.90       7.90       7.90
         7.902       7.90       7.90       7.90
         7.934       7.93       7.93       7.93Column x is the number, as SQL*Plus displays it by default. Note there are as many digits after the decimal point as are needed.
    Column tc shows how TO_CHAR can format the number, with exactly 2 digits after the decimal point. This automatically rounds the number to the nearest multiple of .01, so on the first row (for example) 7.369 gets displayed as 7.37.
    user11272043 wrote:
    ... If a number is 21.289 then it should be displayed as 21.28You (apparantly) always want the number rounded toward 0, so column tc isn't quite what you want.
    Column trnc_tc is exacly what you requested, with the numbr rounded toward 0 (when any rouning is necessry) and 2 digits after the decimal point.
    Column tc is also exactly what you requested, but it uses SQL*Plus formatting rather than SQL. Also, column trnc is a NUMBER, while column trnc_tc is a VARCHAR2, because TO_CHAR, as its name hints, returns a VARCHAR2.
    The SQL*Plus command
    SET   NUMFORMAT  999999.99changes the default format for all number columns. If you use this, you can override it for individual columns by using TO_CHAR (since it returns a VARCHAR2, the NUMFORMAT doesn't apply),or a COLUMN command. Also, if you use SET NUMFORMAT 999999.99, you'll still have to explicitly TRUNC every number, or else 21.289 will come out as 21.29, not 21.28.

Maybe you are looking for

  • MacBook Pro Retina 15" mid-2012 won't boot in clamshell mode with an external display attached

    I have a 15" MBPr mid-2012 running OS X 10.10.1. The system won't boot in clamshell mode (power is connected, lid shut) with an external display attached via an Apple Thunderbolt->DVI adapter. it boots fine if the lid is open. It isn't the adapter or

  • How do i find the diameter of a ring in an image?

    I'm new to Labview, so i dont know how to use Vision Assistant 7.1 to find the diameter of a ring in the following image. Can someone guide me through the steps? Attachments: whole seal.jpg ‏302 KB

  • Help with my research! Need you!

    I am writing a report on improving performance in relational databases, for my primary research I need to gather information straight from some experienced DBAs. I am going to be visiting a few companies in person but thought some extra research onli

  • Do the fonts in Photoshop CS4 have any restrictions for commercial use?

    I am a  designer and I wanted to know if there were any restrictions in the Photoshop CS4 Extended version concerning font usage?  I have read all the terms but I got confused after awhile.  I wanted to make sure there are no restricted usage if I us

  • Annotation model validation

    Hi, I'm trying to build an annotation based framework and I wonder if there is a way to validate the developers' use of the framework's annotations. For instance : @TCPConnectionHandler(serverHost = "localhost", serverPort = 9595) public class MyConn