Alv out put was truncated while giving print

hi,
I have developed one alv report.
while giving out put for print last columns are truncating.
How to handle this?
Thanks in advance,

Hi,
There can be many reasons. What is the width of your output list? Many printers takes 255 characters width. Check the printer settings in T-code SPAD to see howmuch width you can print.
Other option could be, print in landscape format.
Thanks,
Vinod.

Similar Messages

  • 'Back ground Job' Out put is truncating

    Hi Gurus,
                      I am excecuting the report in background. It's out put is truncating after some length and comes in the next line. It gives the undesirable fromat. I tried with higher spools also. it doesn't do the need.
                      Plese let me know any other options are available for this.
    I appreciate your help and cooperation.
    Regards,
    Mahesh.

    Hi,
    You have to create an output Variant in your report and select it in your selection screen during Execution in Background.
    Secondly, make the output field length as per the screen visibility.
    Run the report using the variant, execute in background mode (this option is available in program menu) which in turn creates background job. In SM37 you can see the output in Spool List similar to foreground.\
    To get the missed fields in the spool, while creating the background job(execute in background option) you can see the printer setting block at the end of the background job settings window, in that check the 'Spool Request Max. Width 255 char' check box and then continue. It will generate the spool list with maximum width and you can see all the fields in the spool output.
    Regards,
    Shamma

  • How to get default lay out set in my ALV out put.

    I need to have default layout in my ALV output.
    My functional consultant idea was to make sure they have an ALV variant selected. 
    When he first run the program, how will need to  get a "/DEFAULT" variant created.
    How can I do that ?
    Initialization - For ALV variant
    INITIALIZATION.
      ws_repid = sy-repid.
      g_save  = 'A'.
      CLEAR g_variant.
      g_variant-report = ws_repid.
    Get default variant.
      gx_variant  = g_variant.
      gx_variant = g_variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
        EXPORTING
          i_save     = g_save
        CHANGING
          cs_variant = gx_variant
        EXCEPTIONS
          not_found  = 2.
      IF sy-subrc = 0.
        p_vari = gx_variant-variant.
      ENDIF.
    &--F4 HELP - FOR ALV VARIANT GET--
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
          EXPORTING
            is_variant = g_variant
            i_save     = g_save
          IMPORTING
            e_exit     = g_exit
            es_variant = gx_variant
          EXCEPTIONS
            not_found  = 2.
        IF sy-subrc = 2.
          MESSAGE ID sy-msgid TYPE 'S'      NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ELSE.
          IF g_exit = space.
            p_vari = gx_variant-variant.
          ENDIF.
       ENDIF.
    &--AT SELECTION-SCREEN.- For ALV Variant--
    AT SELECTION-SCREEN.
    *Getting variant Existence
      PERFORM get_exist_variant.
    *&      Form  GET_EXIST_VARIANT                                        *
          text                                                           *
    FORM get_exist_variant .
      IF NOT p_vari IS INITIAL.
        MOVE g_variant TO gx_variant.
        MOVE p_vari TO gx_variant-variant.
        CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
          EXPORTING
            i_save     = g_save
          CHANGING
            cs_variant = gx_variant.
        g_variant = gx_variant.
      ELSE.
        CLEAR g_variant.
        g_variant-report = ws_repid.
      ENDIF.
    ENDFORM.                    " GET_EXIST_VARIANT
    *&      Form  alv_display                                              *
    This subroutine is to display the out put in ALV.                    *
    FORM alv_display .
    Local data
      DATA: y_x          LIKE boole  VALUE 'X'.
      DATA: lh_index     LIKE lf_fieldcat-col_pos.
    For variant
    DATA: ws_repid LIKE sy-repid,
          g_save TYPE c VALUE 'A',
          g_exit TYPE c,
          g_variant LIKE disvariant,
          gx_variant LIKE disvariant.
      For 1st field.( RPT_LOC )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'RPT_LOC'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZGXMIT'.
        lf_fieldcat-ref_fieldname = 'RPT_LOC'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-key = y_x.
        lf_fieldcat-no_sum = y_x.
        APPEND lf_fieldcat TO lt_fieldcat.
    For 2nd field.( BAL_XMIT )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'BAL_XMIT'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZGXMIT'.
        lf_fieldcat-ref_fieldname = 'BAL_XMIT'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-key = y_x.
        lf_fieldcat-no_sum = y_x.
        APPEND lf_fieldcat TO lt_fieldcat.
    4,5,....fields appening
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program                = ws_repid
          I_CALLBACK_PF_STATUS_SET          = ' '
           i_callback_user_command           = 'USER_COMMAND'
          I_CALLBACK_TOP_OF_PAGE            = ' '
          I_STRUCTURE_NAME                  =
          I_BACKGROUND_ID                   = ' '
          I_GRID_TITLE                      =
          I_GRID_SETTINGS                   =
          IS_LAYOUT                         = v_alv_layout
           it_fieldcat                       = lt_fieldcat
          IT_SORT                           =
          IT_FILTER                         =
          IS_SEL_HIDE                       =
          I_DEFAULT                         = 'X'
           i_save                            = 'A'
          IS_VARIANT                        =
           it_events                         = events[]
          IT_EVENT_EXIT                     =
          IS_PRINT                          =
          IS_REPREP_ID                      =
           TABLES
                t_outtab                 = gt_zgxmit_l
           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.                    " alv_display

    Hello SAm,
    U have to set like   DATA: IT_VARIANT LIKE DISVARIANT,
            G_S_SORT  LIKE LINE OF IT_SORT.
      DATA : G_R_DISP_VARIANT TYPE DISVARIANT.
      SORT G_T_OUTTAB BY PSPID POSID.
      CLEAR: G_R_DISP_VARIANT.
    For storing the variant layout
      IT_VARIANT-REPORT  = SY-REPID.
      IF NOT P_VARIAN IS INITIAL.
        G_R_DISP_VARIANT-VARIANT = P_VARIAN.
      ELSE.
        IT_VARIANT-VARIANT = '/Z48M'.
      ENDIF.
      CLEAR G_T_OUTTAB.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM = IT_VARIANT-REPORT
                I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
                IT_FIELDCAT        = IT_FIELDCAT
                I_SAVE             = 'A'
                IS_VARIANT         = IT_VARIANT
               IS_LAYOUT          = IT_LAYOUT
                IT_SORT            = IT_SORT[]
           TABLES
                T_OUTTAB           = G_T_OUTTAB
           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.
    If u want F4 help in the selection screen then do like this.
    SELECTION-SCREEN BEGIN OF BLOCK VARIANT WITH FRAME TITLE TEXT-013.
    PARAMETERS:  P_VARIAN LIKE DISVARIANT-VARIANT DEFAULT '/STANDARD'.
    SELECTION-SCREEN END OF BLOCK VARIANT.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARIAN.
      PERFORM SHOW_EXISTING_DISPLAY_VARIANTS.
    FORM SHOW_EXISTING_DISPLAY_VARIANTS.
      DATA: G_R_DISP_VARIANT TYPE DISVARIANT.
      G_R_DISP_VARIANT-REPORT = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
           EXPORTING
                IS_VARIANT    = G_R_DISP_VARIANT
                I_SAVE        = 'A'
           IMPORTING
                ES_VARIANT    = G_R_DISP_VARIANT
           EXCEPTIONS
                NOT_FOUND     = 1
                PROGRAM_ERROR = 2
                OTHERS        = 3.
      IF SY-SUBRC = 0.
        P_VARIAN = G_R_DISP_VARIANT-VARIANT.
      ENDIF.
    ENDFORM.                               " SHOW_EXISTING_DISPLAY_VARIANTS
    If useful reward.
    Vasanth

  • Alv out put error

    Hi,
    iam getting out put by alv
    but when i caluclate totlal on quntity field iam getting runtime error like this
    plz tell the solution for correct it.
    error is:
    What happened?
        The current application program detected a situation which really
        should not occur. Therefore, a termination with a short dump was
        triggered on purpose by the key word MESSAGE (type X).
      Short text of error message:
      Long text of error message:
      Technical information about the messag
      Message class....... "0K"
      Number.............. 000
      Variable 1.......... " "
      Variable 2.......... " "
      Variable 3.......... " "
      Variable 4.......... " "

    Hi sivaram,
    after you got a solution to your question  you should close the thread and let us know what the solution was.
    Regards,
    Clemens

  • Creation of pf-status functionality in ALV out put

    Hi experts,
    i created pf-status and made one button to save the ccontents displayed in ALV grid out put.
    But i could not find that button in out put.  Is it possible to create custom functionality in ALV output.
    thank you
    regards
    vijay

    Hi Viajay,
    find the below steps to create the PF-STATUS..
    PF-Status
    1. How to set pf-status
    2. How to set pf-status excluding/including single menu items
    3. How to set pf-status excluding/including several menu items
    4. Setting PF status to the (SAP) system default
    5. How to check for pf-status
    6. Use of SY-PFKEY
    1. How to set pf-status
    set pf-status 'ZZBILSTA'.
    2. How to set pf-status excluding/including single menu items
    You can exclude menus by using exclude :
    set pf-status 'ZZBILSTA' excluding 'PST'.
    Note: Can also be used with include instead of exclude
    3. How to set pf-status excluding/including several menu items
    You have to use an internal table to store the status you wan't to ex- or include:
    DATA:     BEGIN OF I_PF_STATUS_TAB OCCURS 10,
              FCODE(4),
         END OF I_PF_STATUS_TAB.
    FORM SET_PF_STATUS_POSTER.
      REFRESH I_PF_STATUS_TAB.
      MOVE 'PST' TO I_PF_STATUS_TAB.
      APPEND I_PF_STATUS_TAB.
      MOVE 'ART' TO I_PF_STATUS_TAB.
      APPEND I_PF_STATUS_TAB.
      SET PF-STATUS 'ZZBILSTA' EXCLUDING I_PF_STATUS_TAB.
    ENDFORM.
    4. Setting PF status to the (SAP) system default
    set pf-status 'BASIC'.
    5. How to check for pf-status
    AT USER-COMMAND.
      CASE SY-UCOMM.
        WHEN 'ART'.
          PERFORM STYR_ARTSKONTI.
        WHEN 'PST'.
          PERFORM STYR_POSTER.
        WHEN 'BIL'.
          PERFORM VIS_BILAG.
    ENDCASE.
    6. Use of SY-PFKEY
    You can use the system variable sy-pfkey to retrieve the name of the current pf status
    Regards,
    Prabhudas

  • Error while giving print

    i have written a report program using ALV grid output...i'm getting the output but when i'm giving print its giving dump error...
    can anyone let me know the below given code is correct or not....
    the below giving function module is which i used in program...
    CONSTANTS : c_save(1)          TYPE c VALUE 'A'.
    CONSTANTS:
      BEGIN OF cs_callback,
        program       TYPE syrepid VALUE 'ZVEN_SR2',
        pf_status_set TYPE slis_formname VALUE '',
        user_command  TYPE slis_formname VALUE '',
        top_of_page   TYPE slis_formname VALUE '',
      END   OF cs_callback.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_interface_check           = ' '
          i_bypassing_buffer          = ' '
          i_buffer_active             = ' '
          i_callback_program          = cs_callback-program
          i_callback_pf_status_set    = cs_callback-pf_status_set
          i_callback_user_command     = cs_callback-user_command
          i_callback_top_of_page      = cs_callback-top_of_page
          is_layout                   = ls_layout
          it_fieldcat                 = t_fieldcat
         IT_SORT                     =
          i_save                      = c_save
        TABLES
          t_outtab                    = itab
      EXCEPTIONS
        program_error                 = 1
        OTHERS                        = 2.

    Hi,
    Hope,the sample code below will be useful for you.
    DATA: OK_CODE LIKE SY-UCOMM.
    TYPES: BEGIN OF ISQALS1,
    PRUEFLOS LIKE QALS-PRUEFLOS,
    MATNR LIKE QALS-MATNR,
    REVLV LIKE QALS-REVLV,
    KTEXTMAT LIKE QALS-KTEXTMAT,
    EBELN LIKE QALS-EBELN,
    MBLNR LIKE QALS-MBLNR,
    LOSMENGE LIKE QALS-LOSMENGE,
    MENGENEINH LIKE QALS-MENGENEINH,
    PASTRTERM LIKE QALS-PASTRTERM,
    UMDAT LIKE MDTB-UMDAT,
    MNG01 LIKE MDTB-MNG01,
    DELNR LIKE MDTB-DELNR,
    STPRS LIKE MBEW-STPRS,
    TVALUE LIKE MBEW-STPRS.
    TYPES: END OF ISQALS1.
    DATA: ITQALS1 TYPE TABLE OF ISQALS1 WITH HEADER LINE,
    WAQALS1 TYPE ISQALS1.
    G_CONTAINER TYPE SCRFNAME VALUE 'grid_CONT1',
    GRID1 TYPE REF TO CL_GUI_ALV_GRID,
    G_CUSTOM_CONTAINER TYPE REF TO
    CL_GUI_CUSTOM_CONTAINER.
    whole set of code, now data is in ITQALS1.
    MODULE PBO OUTPUT.
    SET PF-STATUS 'MAIN100'.
    IF G_CUSTOM_CONTAINER IS INITIAL.
    CREATE OBJECT G_CUSTOM_CONTAINER
    EXPORTING CONTAINER_NAME = G_CONTAINER.
    CREATE OBJECT GRID1
    EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
    CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING I_STRUCTURE_NAME = 'ISQALS1'
    CHANGING IT_OUTTAB = ITQALS1.
    ENDIF.
    ENDMODULE.
    Thank You.
    Regards,
    Dhanalakshmi L

  • ERROR SHOWS 'VARIANT CASHDE DOES NOT EXIST' WHILE GIVING PRINT in tcod FBCJ

    DEAR ALL,
      MY FI CONSULTANT WHILE PRESSING PRINT BUTTON IN FBCJ TCODE FOR CASH JOURNAL AN ERROR MESSAGE SHOWS 'VARIANT CASHDE DOES NOT EXIST '. AS AN ABAPER I TRIED A LOT AND DEBUG THE STD. PROGRAM BUT I AM UNABLE TO SOLVE THE ISSUE. SO I NEED UR HELP .PLEASE SUGGEST ME TO SOLVE THE ISSUE.
    IT IS VERY URGENT.
    REGARDS
    BANAJA

    Thanks

  • Issue while giving Print out

    Hi all,
             I have a user who has all the administrative rights and also the rights for purchasing. When he tries to take print outs of GRPO, the system gives a message that the user is not permitted to do this action. Also, the user has full authorisations for the print preferences?? Can anyone plesae suggest me how to handle this??  We are on SAP 2005 B PL 26.
    Best Regards,
    Amon

    Hi Jeyakanthan,
                           Thanks for the reply. I checked it and the user has full authorization for the same. But there is no such option for printing in purchase?? How do i handle this now ? Also Jeyakanthan, when i give full authorization to the user, he can take print outs. The moment i give selective authorizations, the problem arises.
    Thanks,
    Amon

  • ALV Out put

    Hi
    Following is my Final internal table
    vbeln    matnr    posnr   Flax 
    123      23         10       X
    124      24         10      
    125      25        10        X
    126      26         10
    I want to display the records in Red colour  where Flag = X
    how to do this. Pls help me

    Hi Sunil,
    Check out with the demo program. Just copy and paste it you will see the coloring is tehre and do some modificatio based on your logic it will defiantly work.
    &************Reward point if helpful***************&
    report zuseofhashedtables.
    ** Program: ZUseOfHashedTables                                        **
    ** Author: Horacio Zapettini                                          **
    ** Versions: 4.6b - 4.6c                                              **
    ** Notes:                                                             **
    **     this program shows how we can use hashed tables to improve     **
    **     the responce time.                                             **
    **     It shows,                                                      **
    **        1. how to declare hashed tables                             **
    **        2. a cache-like technique to improve access to master data  **
    **        3. how to collect data using hashed tables                  **
    **        4. how to avoid deletions of unwanted data                  **
    ** Results: the test we run read about 31000 rows from mkpf, 150000   **
    **          rows from mseg, 500 rows from makt and 400 from lfa1.     **
    **          it filled ht_lst with 24500 rows and displayed them in    **
    **          alv grid format.                                          **
    **          It took about 65 secodns to perform this task (first time **
    **          we run it when all the db buffers are empty.              **
    **          The same program with standard tables needed 140 seconds  **
    **          to run with the same recordset and with buffers filled in **
    **          A simmilar test over more than a million rows
    ** Objetive: show a list that consists of  all the material movements **
    **          '101' - '901' for a certain range of dates in mkpf-budat. **
    ** the columns to be displayed are:                                   **
    **          mkpf-budat,                                               **
    **          mkpf-mblnr,                                               **
    **          mseg-lifnr,                                               **
    **          lfa1-name1,                                               **
    **          mkpf-xblnr,                                               **
    **          mseg-zeile                                                **
    **          mseg-charg,                                               **
    **          mseg-matnr,                                               **
    **          makt-maktx,                                               **
    **          mseg-erfmg,                                               **
    **          mseg-erfme.                                               **
    ** or show a sumary list by matnr - menge                             **
    ** You'll have to create a pf-status called vista -                   **
    ** See form set_pf_status for details                                 **
    ** tables used -
    tables: mkpf,
            mseg,
            lfa1,
            makt.
    ** global hashed tables used
    data: begin of wa_mkpf, "header
          mblnr like mkpf-mblnr,
          mjahr like mkpf-mjahr,
          budat like mkpf-budat,
          xblnr like mkpf-xblnr,
          end of wa_mkpf.
    data: ht_mkpf like hashed table of wa_mkpf
          with unique key mblnr mjahr
          with header line.
    data: st_mkpf like standard table of wa_mkpf
          with header line.
    data: begin of wa_mseg, " line items
          mblnr like mseg-mblnr,
          mjahr like mseg-mjahr,
          zeile like mseg-zeile,
          bwart like mseg-bwart,
          charg like mseg-charg,
          matnr like mseg-matnr,
          lifnr like mseg-lifnr,
          erfmg like mseg-erfmg,
          erfme like mseg-erfme,
          end of wa_mseg.
    data ht_mseg like hashed table of wa_mseg
          with unique key mblnr mjahr zeile
          with header line.
    data st_mseg like standard table of wa_mseg
          with header line.
    ** cache structure for lfa1 records
    data: begin of wa_lfa1,
          lifnr like lfa1-lifnr,
          name1 like lfa1-name1,
          end of wa_lfa1.
    data ht_lfa1 like hashed table of wa_lfa1
          with unique key lifnr
          with header line.
    ** cache structure for material related data
    data: begin of wa_material,
          matnr like makt-matnr,
          maktx like makt-maktx,
          end of wa_material.
    data: ht_material like hashed table of wa_material
            with unique key matnr
            with header line.
    ** result table
    data: begin of wa_lst, "
          budat like mkpf-budat,
          mblnr like mseg-mblnr,
          lifnr like mseg-lifnr,
          name1 like lfa1-name1,   
          xblnr like mkpf-xblnr,
          zeile like mseg-zeile,
          charg like mseg-charg,
          matnr like mseg-matnr,
          maktx like makt-maktx,
          erfmg like mseg-erfmg,
          erfme like mseg-erfme,
          mjahr like mseg-mjahr,
          end of wa_lst.
    data: ht_lst like hashed table of wa_lst
            with unique key mblnr mjahr zeile
            with header line.
    data: begin of wa_lst1, " sumary by material
          matnr like mseg-matnr,
          maktx like makt-maktx,
          erfmg like mseg-erfmg,
          erfme like mseg-erfme,
          color_line(4) TYPE c,           " Line color
          color_cell    TYPE lvc_t_scol,  " Cell color
          celltab type LVC_T_STYL,
          end of wa_lst1.
    data: ht_lst1 like hashed table of wa_lst1
            with unique key matnr
            with header line.
    ** structures for alv grid display.
    ** itabs
    type-pools: slis.
    data: it_lst            like standard table of wa_lst with header line,
          it_fieldcat_lst   type slis_t_fieldcat_alv with header line,
          it_sort_lst       type slis_t_sortinfo_alv,
          it_lst1           like standard table of wa_lst1 with header line,
          it_fieldcat_lst1  type slis_t_fieldcat_alv with header line,
          it_sort_lst1      type slis_t_sortinfo_alv.
    ** structures
    data: wa_sort         type slis_sortinfo_alv,
          ls_layout       type slis_layout_alv.
    ** color management.
    DATA  : wa_color    TYPE lvc_s_scol.
    * Internal table for color management.
    DATA : it_color    TYPE TABLE          OF lvc_s_scol.
    * itab for input enabling.
    DATA: lt_celltab TYPE lvc_t_styl. "
    ** global varialbes
    data: g_lines type i.
    data: g_repid like sy-repid,
          ok_code       like sy-ucomm.
    ** selection-screen
    "text: Dates:
    select-options: so_budat for mkpf-budat default sy-datum.
    "text: Material numbers.
    select-options: so_matnr for mseg-matnr.
    selection-screen uline.
    selection-screen skip 1.
    "Text: show summary by material.
    parameters: gp_bymat as checkbox default ''.
    parameters: gp_hier  as checkbox default 'X'.
    start-of-selection.
      perform get_data.
      perform show_data.
    end-of-selection.
    *       FORM get_data                                                 *
    form get_data.
            select mblnr mjahr budat xblnr
                into table ht_mkpf
               from mkpf
              where budat in so_budat. " make use of std index.
    ** have we retrieved data from mkpf?
      describe table ht_mkpf lines g_lines.
      if g_lines > 0.
    ** if true then retrieve all related records from mseg.
    ** Doing this way we make sure that the access is by primary key
    ** of mseg.
    ** The reason is that is faster to filter them in memory
    ** than to allow the db server to do it.
        select mblnr mjahr zeile bwart charg
                 matnr lifnr erfmg erfme
          into table ht_mseg
          from mseg
            for all entries in ht_mkpf
         where mblnr = ht_mkpf-mblnr
           and mjahr = ht_mkpf-mjahr.
      endif.
    ** fill t_lst or t_lst1 according to user's choice.
      if gp_bymat = ' '.
        perform fill_ht_lst.
      else.
        perform fill_ht_lst1.
      endif.
    endform.
    form fill_ht_lst.
      refresh ht_lst.
    ** Example: how to discard unwanted data in an efficient way.
      loop at ht_mseg.
    *   filter unwanted data
        check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.
        check ht_mseg-matnr in so_matnr.
    *   read header line.
        read table ht_mkpf with table key mblnr = ht_mseg-mblnr
        mjahr = ht_mseg-mjahr.
        clear ht_lst.
    *  * note : this may be faster if you specify field by field.
        move-corresponding ht_mkpf to ht_lst.
        move-corresponding ht_mseg to ht_lst.
        perform read_lfa1 using ht_mseg-lifnr changing ht_lst-name1.
        perform read_material using ht_mseg-matnr changing ht_lst-maktx.
        insert table ht_lst.
      endloop.
    endform.
    form fill_ht_lst1.
    data: colorear.
      refresh ht_lst1.
    ** Example: how to discard unwanted data in an efficient way.
    **          hot to simulate a collect in a faster way
      loop at ht_mseg.
    *   filter unwanted data
        check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.
        check ht_mseg-matnr in so_matnr.
    *  * note : this may be faster if you specify field by field.
        read table ht_lst1 with table key matnr = ht_mseg-matnr
        transporting erfmg.
        if sy-subrc <> 0. " if matnr doesn't exist in sumary table
        " insert a new record
          clear ht_lst1.
          ht_lst1-matnr = ht_mseg-matnr.
          perform read_material using ht_mseg-matnr changing ht_lst1-maktx.
          ht_lst1-erfmg = ht_mseg-erfmg.
          ht_lst1-erfme = ht_mseg-erfme.
          if colorear = ''.
            colorear = 'X'.
            refresh it_color.
            ht_lst1-color_cell[] = it_color[].
            MOVE 'C410' TO ht_lst1-color_line.
          else.
            colorear = ' '.
            refresh it_color. clear it_color.
            MOVE 'MATNR' TO wa_color-fname.
            MOVE '6'         TO wa_color-color-col.
            MOVE '1'         TO wa_color-color-int.
            MOVE '1'         TO wa_color-color-inv.
            APPEND wa_color TO it_color.
            MOVE 'MAKTX' TO wa_color-fname.
            MOVE '3'         TO wa_color-color-col.
            MOVE '1'         TO wa_color-color-int.
            MOVE '1'         TO wa_color-color-inv.
            APPEND wa_color TO it_color.
            MOVE 'ERFMG' TO wa_color-fname.
            MOVE '5'         TO wa_color-color-col.
            MOVE '1'         TO wa_color-color-int.
            MOVE '1'         TO wa_color-color-inv.
            APPEND wa_color TO it_color.
            ht_lst1-color_cell[] = it_color[].
            clear ht_lst1-color_line.
          endif.
          insert table ht_lst1.
        else." a record was found.
        " collect erfmg.  To do so, fill in the unique key and add
        " the numeric fields.
          ht_lst1-matnr = ht_mseg-matnr.
          add ht_mseg-erfmg to ht_lst1-erfmg.
          modify table ht_lst1 transporting erfmg.
        endif.
      endloop.
    endform.
    ** implementation of cache for lfa1.
    form read_lfa1 using p_lifnr changing p_name1.
            read table ht_lfa1 with table key lifnr = p_lifnr
            transporting name1.
      if sy-subrc <> 0.
        clear ht_lfa1.
        ht_lfa1-lifnr = p_lifnr.
        select single name1
           into ht_lfa1-name1
          from lfa1
        where lifnr = p_lifnr.
        if sy-subrc <> 0. ht_lfa1-name1 = 'n/a in lfa1'. endif.
        insert table ht_lfa1.
      endif.
      p_name1 = ht_lfa1-name1.
    endform.
    ** implementation of cache for material data
    form read_material using p_matnr changing p_maktx.
      read table ht_material with table key matnr = p_matnr
      transporting maktx.
      if sy-subrc <> 0.
        ht_material-matnr = p_matnr.
        select single maktx into  ht_material-maktx
          from makt
         where spras = sy-langu
           and matnr = p_matnr.
        if sy-subrc <> 0. ht_material-maktx = 'n/a in makt'. endif.
        insert table ht_material.
      endif.
      p_maktx = ht_material-maktx.
    endform.
    form show_data.
      if gp_hier = 'X'. "no anda.
    *    perform show_hierarchicalALV.
      else.
        if gp_bymat = ' '.
          perform show_ht_lst.
        else.
          perform show_ht_lst1.
        endif.
      endif.
    endform.
    form show_hierarchicalALV.
    st_mkpf[] = ht_mkpf[].
    st_mseg[] = ht_mseg[].
    call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    *  exporting
    *   I_INTERFACE_CHECK              = ' '
    *   I_CALLBACK_PROGRAM             =
    *   I_CALLBACK_PF_STATUS_SET       = ' '
    *   I_CALLBACK_USER_COMMAND        = ' '
    *   IS_LAYOUT                      =
    *   IT_FIELDCAT                    =
    *   IT_EXCLUDING                   =
    *   IT_SPECIAL_GROUPS              =
    *   IT_SORT                        =
    *   IT_FILTER                      =
    *   IS_SEL_HIDE                    =
    *   I_SCREEN_START_COLUMN          = 0
    *   I_SCREEN_START_LINE            = 0
    *   I_SCREEN_END_COLUMN            = 0
    *   I_SCREEN_END_LINE              = 0
    *   I_DEFAULT                      = 'X'
    *   I_SAVE                         = ' '
    *   IS_VARIANT                     =
    *   IT_EVENTS                      =
    *   IT_EVENT_EXIT                  =
    *    i_tabname_header               =
    *    i_tabname_item                 =
    *   I_STRUCTURE_NAME_HEADER        =
    *   I_STRUCTURE_NAME_ITEM          =
    *    is_keyinfo                     =
    *   IS_PRINT                       =
    *   IS_REPREP_ID                   =
    *   I_BUFFER_ACTIVE                =
    *   I_BYPASSING_BUFFER             =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER        =
    *   ES_EXIT_CAUSED_BY_USER         =
      tables
        t_outtab_header                = st_mkpf
        t_outtab_item                  = st_mseg
    * 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.
    form show_ht_lst.
      "needed because the FM can't use a hashed table.
      it_lst[] = ht_lst[].
      perform fill_layout using 'full display'
                           changing ls_layout.
      perform fill_columns_lst.
    *  perform sort_lst.
      g_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program       = g_repid
                i_callback_pf_status_set = 'SET_PF_STATUS'
                is_layout                = ls_layout
                it_fieldcat              = it_fieldcat_lst[]
    *            it_sort                  = it_sort_lst
           tables
                t_outtab                 = it_lst
           exceptions
                program_error            = 1
                others                   = 2.
    endform.
    form show_ht_lst1.
      "needed because the FM can't use a hashed table.
      it_lst1[] = ht_lst1[].
      perform fill_layout using 'Sumary by matnr'
                           changing ls_layout.
      perform fill_columns_lst1.
    *  perform sort_lst.
      g_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program       = g_repid
                i_callback_pf_status_set = 'SET_PF_STATUS'
                is_layout                = ls_layout
                it_fieldcat              = it_fieldcat_lst1[]
    *            it_sort                  = it_sort_lst
           tables
                t_outtab                 = it_lst1
           exceptions
                program_error            = 1
                others                   = 2.
    endform.
    form fill_layout using p_window_titlebar
                   changing cs_layo type slis_layout_alv.
      clear cs_layo.
      cs_layo-window_titlebar        = p_window_titlebar.
      cs_layo-edit                   = 'X'.
      cs_layo-edit_mode              = space.
      MOVE 'COLOR_LINE' TO cs_layo-info_fieldname.
    * Field that identify cell color in inetrnal table
      MOVE 'COLOR_CELL' TO cs_layo-coltab_fieldname.
    *  move 'CELLTAB' TO cs_layo-stylefname.
    endform.                    " armar_layout_stock
    form set_pf_status using rt_extab type slis_t_extab.
    ** create a new status
    ** and then select extras -> adjust template -> listviewer
      set pf-status 'VISTA'.
    endform.        "set_pf_status
    define add_lst.
      clear it_fieldcat_lst.
      it_fieldcat_lst-fieldname     = &1.
      it_fieldcat_lst-outputlen     = &2.
      it_fieldcat_lst-ddictxt       = 'L'.
      it_fieldcat_lst-seltext_l       = &1.
      it_fieldcat_lst-seltext_m       = &1.
      it_fieldcat_lst-seltext_m       = &1.
      if &1 = 'MATNR'.
        it_fieldcat_lst-emphasize = 'C111'.
      endif.
      append it_fieldcat_lst.
    end-of-definition.
    define add_lst1.
      clear it_fieldcat_lst.
      it_fieldcat_lst1-fieldname     = &1.
      it_fieldcat_lst1-outputlen     = &2.
      it_fieldcat_lst1-ddictxt       = 'L'.
      it_fieldcat_lst1-seltext_l       = &1.
      it_fieldcat_lst1-seltext_m       = &1.
      it_fieldcat_lst1-seltext_m       = &1.
      append it_fieldcat_lst1.
    end-of-definition.
    form fill_columns_lst.
    * set columns for output.
      refresh it_fieldcat_lst.
      add_lst 'BUDAT' 10.
      add_lst   'MBLNR' 10.
      add_lst  'LIFNR' 10.
      add_lst  'NAME1' 35.
      add_lst  'XBLNR' 15.
      add_lst    'ZEILE' 5.
      add_lst    'CHARG' 10.
      add_lst   'MATNR' 18.
      add_lst   'MAKTX' 30.
      add_lst   'ERFMG' 17.
      add_lst   'ERFME' 5.
      add_lst   'MJAHR' 4.
    endform.
    form fill_columns_lst1.
    * set columns for output.
      refresh it_fieldcat_lst1.
      add_lst1 'MATNR' 18.
      add_lst1 'MAKTX' 30.
      add_lst1 'ERFMG' 17.
      add_lst1 'ERFME' 5..
    endform.
    Horacio Zapettini
    Program to Calculate FI Opening Balance
    How to find the Opening balance for a given period in FI Module for a Particular GL A/c.
    I was calculated opening balance, code is below maybe it will be helpful.
    *find period.
      CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
        EXPORTING
          i_date         = s_budat-low
          i_periv        = i_tab-periv                          "'K4'
        IMPORTING
          e_buper        = v_donem
          e_gjahr        = v_gjahr
        EXCEPTIONS
          input_false    = 1
          t009_notfound  = 2
          t009b_notfound = 3
          OTHERS         = 4.
    *calc opening balance hesabý
      SELECT * FROM knc1 WHERE kunnr = i_tab-kunnr
                         AND bukrs = i_tab-bukrs " s_bukrs
                         AND gjahr EQ v_gjahr.
        v_dnm = v_donem.
    * opening balance first calc > old year ,
        WHILE v_dnm > 1.
          v_dnm = v_dnm - 1.
          CONCATENATE 'knc1-um' v_dnm 's' INTO v_field_name_borc.
          CONCATENATE 'knc1-um' v_dnm 'h' INTO v_field_name_alacak.
          ASSIGN (v_field_name_borc) TO <fs1> .
          ASSIGN (v_field_name_alacak) TO <fs2> .
          i_tab-dmbtr_s = i_tab-dmbtr_s + ( <fs1>  ). " borc
          i_tab-dmbtr_h = i_tab-dmbtr_h + ( <fs2>  ). " borc
        ENDWHILE.
    *opening balance last calc> old
    * add days which is from selected date-low month
        IF v_donem > 1.
          v_dnm = v_donem - 1.
        ELSE.
          v_dnm = v_donem.
        ENDIF.
        SELECT SINGLE * FROM t009b WHERE periv = i_tab-periv    "'K4'
                                     AND bdatj = s_budat-low+0(4)
                                     AND poper = v_dnm.
        t009b-butag = t009b-butag + 1.
        IF s_budat-low+6(2) NE t009b-butag.
          v_date_high = s_budat-low - 1.
          IF v_donem = 1.
            v_date_low = s_budat-low.
            v_date_low+4(4)  = '0101'.
          ELSE.
            CONCATENATE t009b-bdatj t009b-bumon t009b-butag INTO
            v_date_low.
          ENDIF.
          SELECT *  FROM bsad WHERE bukrs EQ i_tab-bukrs "IN s_bukrs
                                AND kunnr = i_tab-kunnr
                                AND budat BETWEEN v_date_low AND
                                v_date_high
                                AND umskz = space
                                AND blart IN s_blart.
            IF bsad-shkzg = 'S'.
              i_tab-dmbtr_s = i_tab-dmbtr_s + ( bsad-dmbtr ).
            ELSEIF bsad-shkzg = 'H'.
              i_tab-dmbtr_h = i_tab-dmbtr_h + ( bsad-dmbtr   ).
            ENDIF.
          ENDSELECT.
          SELECT *  FROM bsid WHERE bukrs EQ i_tab-bukrs "IN s_bukrs
                               AND kunnr = i_tab-kunnr
                               AND budat BETWEEN v_date_low AND
                               v_date_high
                               AND umskz = space
                               AND blart IN s_blart.
    *                              AND gsber IN gsber.
            IF bsid-shkzg = 'S'.
              i_tab-dmbtr_s = i_tab-dmbtr_s + ( bsid-dmbtr   ).
            ELSEIF bsid-shkzg = 'H'.
              i_tab-dmbtr_h = i_tab-dmbtr_h + ( bsid-dmbtr   ).
            ENDIF.
          ENDSELECT.
        ENDIF.
        "opening balance ( þirket bazlý )z1 degeri
       i_tab-z1 = i_tab-z1 + ( knc1-umsav + i_tab-dmbtr_s - i_tab-dmbtr_h ).
    * for israel
        i_tab-dmbtril_s = i_tab-dmbtr_s .
        i_tab-dmbtril_h = i_tab-dmbtr_h .
      ENDSELECT.

  • ALV out put highlited

    Hi,
       In alv i like to show one row should be high lighted or colored that row. can you tell me how?
    Please send piece of code.
    thanks&regards
    v

    Hi,
    To mke your row bold
    In that case, u gave to set a condition while appending rows in the following internal table (for which you want to do a field bold). Now for making bold, for that perticular field pass 'C410' instead of 'C410'. It control the field Intensified. I guess it will solve ur purpose.
    code*Populate field with color attributes
    loop at it_ekko into wa_ekko.
    Populate color variable with colour properties
    Char 1 = C (This is a color property)
    Char 2 = 3 (Color codes: 1 - 7)
    Char 3 = Intensified on/off ( 1 or 0 )
    Char 4 = Inverse display on/off ( 1 or 0 )
    i.e. wa_ekko-line_color = 'C410'
    ld_color = ld_color + 1.
    Only 7 colours so need to reset color value
    if ld_color = 8.
    ld_color = 1.
    endif.
    concatenate 'C' ld_color '10' into wa_ekko-line_color.
    wa_ekko-line_color = 'C410'.
    modify it_ekko from wa_ekko.
    endloop.[/code]

  • Regarding ALV out put problem

    hi
    i have a internal table with the following structure
    TYPES: begin of  ty_final.
    types: b_bseg type bseg.
    types: k_kna1 type kna1.
    types: l_lfa1 type lfa1.
    types: s_ska1 type ska1.
    types: a_anlu type anlu.
    TYPES:   End of  ty_final.
    DATA: lt_final TYPE STANDARD TABLE OF ty_final ,
          wa_final TYPE ty_final.
    after i fill my final internal table i  need to get the output in ALV grid  , i tried to pass the internal table to ALv Grid function module but I am getting shortdump .
    is it possible to to get the output with this complex structure?
    Moderator message: please choose more descriptive subject lines for your posts.
    Edited by: Thomas Zloch on Jun 8, 2011 4:38 PM

    here is the short dump ,  I think the ALV program doesnt get the internal table value , because the value resides in deep structure .  if i am wrong correct me.
    Short text
    Field symbol has not yet been assigned.
    What happened?
    Error in the ABAP Application Program
    The current ABAP program "SAPLSLVC" had to be terminated because it has
    come across a statement that unfortunately cannot be executed.
    Error analysis
    You attempted to access an unassigned field symbol
    (data segment 32821).
    This error may occur if
    - You address a typed field symbol before it has been set with
    ASSIGN
    - You address a field symbol that pointed to the line of an
    internal table that was deleted
    - You address a field symbol that was previously reset using
    UNASSIGN or that pointed to a local field that no
    longer exists
    - You address a global function interface, although the
    respective function module is not active - that is, is
    not in the list of active calls. The list of active calls
    can be taken from this short dump.
    Trigger Location of Runtime Error
    Program                                 SAPLSLVC
    Include                                 LSLVCF36
    Row                                     3.267
    Module type                             (FORM)
    Module Name                             FILL_DATA_TABLE
    Source Code Extract
    Line
    SourceCde
    3237
    alv_style_align_center_top.
    3238
    endif.
    3239
    3240
    append ls_lvc_data to ct_lvc_data.
    3241
    endif.
    3242
    3243
    3244
    Column per Fieldcat Entry
    3245
    3246
    loop at it_fcat_local assigning <ls_fcat>.
    3247
    clear: ls_lvc_data-href_hndl,
    3248
    ls_lvc_data-drdn_hndl,
    3249
    ls_lvc_data-style,
    3250
    ls_lvc_data-style2,
    3251
    ls_lvc_data-style3,
    3252
    ls_lvc_data-style4,
    3253
    ls_lvc_data-maxlen.
    3254
    3255
    clear: lt_color_lvc, lt_color_slis.
    3256
    3257
    add 1 to ls_lvc_data-col_pos.
    3258
    3259
    if not <ls_fcat>-indx_field is initial.
    3260
    assign component <ls_fcat>-indx_field
    3261
    of structure <ls_data> to <l_field_value>.
    3262
    else.
    3263
    assign component <ls_fcat>-fieldname
    3264
    of structure <ls_data> to <l_field_value>.
    3265
    endif.
    3266
    >>>>>
    macro_cell_data_get
    3268
    <ls_fcat>
    3269
    <ls_data>
    3270
    <l_field_value>
    3271
    ls_lvc_data-value.
    3272
    3273
    *>>> new API
    3274
    if ir_salv_adapter is bound.
    3275
    clear ls_lvc_data-style.
    3276
    3277
    color
    3278
    if g_gui_type ne 1.
    3279
    if <ls_fcat>-key eq abap_true.
    3280
    ls_lvc_data-style = alv_style_color_int_key.
    3281
    elseif l_style_color is initial
    3282
    and ( <ls_fcat>-emphasize is initial or
    3283
    <ls_fcat>-emphasize = '$' ).
    3284
    if <ls_stin>-counter is initial.
    3285
    ls_lvc_data-style = alv_style_color_normal.
    3286
    else.

  • Reg: display the warning message in alv out put

    Hi All,
              i am uloading the flat file data ,display in the alv grid in the edit mode. when i am trying to change the output data in grid, for which are having the blank (no value for the field) , i want to display warning message the selected cell is blank.
    could u help me on this please.
    Thanks,
    Kumar

    For  editing the ALV cell .. you would be writing some code .. which is mandt  rite ?
    So  before that  code u check the filed value ..initial or not ..

  • ALV out put to be downloaded in Background to apps server

    Hello All,
    I want to download ALV output to APPL Server in TAB delimited format.
    I am able to get the internal table values usinf open record set and transfering.
    But the real issue is they are having diffrent layouts and according to layout i need to down the file.
    Is it possible ? if please suggest.
    Rgds,
    O

    Hi,
    I have an old code that I have wrote to transform ALV in HTML in background to send the result by email. Maybe that could help you (don't be rude, it's one of my first ALV program ).
    The comments are in french, but, you could understand.
    I hope that could help you
    Rgd
    Frédéric
    * Complete.
      call function 'LVC_FIELDCATALOG_MERGE'
           exporting
                i_structure_name   = 'ZGRE000_S2'
                i_bypassing_buffer = ' '
                i_buffer_active    = ' '
           changing
                ct_fieldcat      = itab_fieldcatalog.
      call function 'LVC_FIELDCAT_COMPLETE'
        EXPORTING
    *     I_COMPLETE             =
          IS_LAYOUT              = v_es_layout
          I_REFRESH_BUFFER       = ''
          I_BUFFER_ACTIVE        = ''
    *   IMPORTING
    *     E_EDIT                 =
        changing
          ct_fieldcat            = itab_fieldcatalog.
      call function 'LVC_SORT_COMPLETE'
        exporting
          it_fieldcat       = itab_fieldcatalog
        changing
          ct_sort           = itab_mt_sort.
      call function 'ALV_DATA_EXPORT'
        exporting
          i_report                = ''
          IT_FIELDCAT             = itab_fieldcatalog
        tables
          it_data                 = itab_zgre000_s2.
    * Recherche de la variante d'affichage.
      move : sy-repid to struct_variant-report ,
             sy-uname to struct_variant-username ,
             '2'      to struct_variant-handle.
      if p_vgrid ne space.
        move p_vgrid to struct_variant-variant.
      endif.
    * Ne pas demander d'explication, merci :)
      get reference of itab_zgre000_s2 into mt_outtab.
    * Créé l'objet variant.
      create object m_cl_variant
             exporting
               it_outtab             = mt_outtab
               it_fieldcatalog       = itab_fieldcatalog
               it_sort               = itab_mt_sort
               it_filter             = itab_mt_filter
               is_variant            = struct_variant
               is_layout             = v_es_layout
               i_variant_save        = v_e_var_save
               i_variant_default     = v_e_var_def.
      move : 'A' to v_e_var_save ,
             'X' to v_e_var_def .
      call method m_cl_variant->set_values
           exporting it_outtab             = mt_outtab
                     it_fieldcatalog       = itab_fieldcatalog
                     it_sort               = itab_mt_sort
                     it_filter             = itab_mt_filter
                     is_variant            = struct_variant
                     is_layout             = v_es_layout
                     i_variant_save        = v_e_var_save
                     i_variant_default     = v_e_var_def.
       loop at itab_fieldcatalog into tmp_fieldcatalog
            where tabname ne space.
         exit.
       endloop.
    * Recherche de la variante.
      call method m_cl_variant->load_variant
           exporting i_tabname          = tmp_fieldcatalog-tabname
                     i_bypassing_buffer = 'X'
                    i_dialog           = space.
      create data  mt_ct00 like itab_zgre000_s2.
      create data  mt_ct01 like itab_zgre000_s2.
      create data  mt_ct02 like itab_zgre000_s2.
      create data  mt_ct03 like itab_zgre000_s2.
      create data  mt_ct04 like itab_zgre000_s2.
      create data  mt_ct05 like itab_zgre000_s2.
      create data  mt_ct06 like itab_zgre000_s2.
      create data  mt_ct07 like itab_zgre000_s2.
      create data  mt_ct08 like itab_zgre000_s2.
      create data  mt_ct09 like itab_zgre000_s2.
      assign mt_ct00->* to <lt_ct00>.
      assign mt_ct01->* to <lt_ct01>.
      assign mt_ct02->* to <lt_ct02>.
      assign mt_ct03->* to <lt_ct03>.
      assign mt_ct04->* to <lt_ct04>.
      assign mt_ct05->* to <lt_ct05>.
      assign mt_ct06->* to <lt_ct06>.
      assign mt_ct07->* to <lt_ct07>.
      assign mt_ct08->* to <lt_ct08>.
      assign mt_ct09->* to <lt_ct09>.
    * Recherche des valeurs à partir de la variante sélectionnée.
      call method m_cl_variant->get_values
           importing es_variant     = struct_variant
             et_fieldcatalog        = itab_fieldcatalog
             et_sort                = itab_mt_sort
             et_filter              = itab_mt_filter
             es_layout              = v_es_layout
             et_grouplevels_filter  = mt_grouplevels_filter
             e_variant_save         = v_e_var_save
             e_variant_default      = v_e_var_def.
      call function 'LVC_SORT_APPLY'
        exporting
          it_sort         = itab_mt_sort
    *     I_AS_TEXT       = 'X'
    *     I_STABLE        = 'X'
        tables
          ct_data         = itab_zgre000_s2.
      call function 'LVC_TRANSFER_TO_KKBLO'
        exporting
          it_sort_lvc                     = itab_mt_sort
          it_grouplevels_lvc              = mt_grouplevels_filter
        importing
          et_sort_kkblo                   = itab_lt_sort
          et_grouplevels_kkblo            = itab_lt_grouplevels
        exceptions
          it_data_missing                 = 1
          it_fieldcat_lvc_missing         = 2
          others                          = 3.
      call function 'ALV_GROUPLEVELS_GET'
        exporting
          i_subtotals_only          = 'X'
          it_sort                   = itab_lt_sort
          i_subtract_counter        = 'X'
        importing
          et_groups                 = itab_lt_grouplevels
        tables
          t_outtab                  = itab_zgre000_s2.
      call function 'LVC_TRANSFER_FROM_KKBLO'
        exporting
          it_grouplevels_kkblo            = itab_lt_grouplevels
        importing
          et_grouplevels_lvc              = mt_grouplevels_filter
        exceptions
          it_data_missing                 = 1
          others                          = 2.
    * Recupération des totaux.
      call function 'LVC_TOTALS_GET'
        exporting
          it_sort                  = itab_mt_sort
          is_layout                = v_es_layout
          it_filter_index          = itab_mt_filter_i
        tables
          it_data                  = itab_zgre000_s2
          et_collect00             = <lt_ct00>
          et_collect01             = <lt_ct01>
          et_collect02             = <lt_ct02>
          et_collect03             = <lt_ct03>
          et_collect04             = <lt_ct04>
          et_collect05             = <lt_ct05>
          et_collect06             = <lt_ct06>
          et_collect07             = <lt_ct07>
          et_collect08             = <lt_ct08>
          et_collect09             = <lt_ct09>
        changing
          cs_total_options         = ms_total_options
    *      ct_fieldcat              = mt_fieldcatalog
          ct_fieldcat              = itab_fieldcatalog
          ct_grouplevels           = mt_grouplevels_filter
          c_calculate_totals       = m_calculate_totals
          c_sumlevel               = m_sumlevel .
    * Converti dans un language comprehensible par SAP.
      call function 'LVC_TABLE_FOR_DISPLAY'
        exporting
          it_fieldcat                    = itab_fieldcatalog
          it_sort                        = itab_mt_sort
          it_filter                      = itab_mt_filter
          is_total_options               = ms_total_options
          is_layout                      = v_es_layout
        importing
          et_lvc_data                    = itab_mt_data
          et_lvc_info                    = itab_mt_info
        tables
          it_data                        = itab_zgre000_s2
          it_collect00                   = <lt_ct00>
          it_collect01                   = <lt_ct01>
          it_collect02                   = <lt_ct02>
          it_collect03                   = <lt_ct03>
          it_collect04                   = <lt_ct04>
          it_collect05                   = <lt_ct05>
          it_collect06                   = <lt_ct06>
          it_collect07                   = <lt_ct07>
          it_collect08                   = <lt_ct08>
          it_collect09                   = <lt_ct09>
        changing
          ct_grouplevels                 = mt_grouplevels_filter
        exceptions
          fieldcat_not_complete          = 1
          others                         = 2.
      if sy-subrc ne space.
        write : /1 'Probleme de convertion.'.
        stop.
      endif.
    * Convertie en HTML.
      call function 'LVC_ALV_CONVERT_TO_HTML'
        exporting
          it_data                       = itab_mt_data
          it_info                       = itab_mt_info
          i_file_dialog                 = ' '
        importing
          et_html                       = itab_html.

  • Alv and excel sheet out put.

    hi friends,
    now i am working on sales and purchase order report. For this i have created three radio button on selection screen one for sales 2nd for purchase and 3rd for both. when i click sales radio button it is going to display only sales data in ALV out put list as well as in EXCEL sheet.
    problem:-
    Some layout fileds (out put fields) i am storing in VARIENT and when i have passed this VARIANT in a SELECTION-SCREEN so here the output is ok for me, and i am unable to display these same fields in EXCEL sheet for this Please could u tell that how we do this. please send the logic for this.
    thands and regards.
    sagi.

    Hi Amol,
    you are not getting me ...
    see your itab will have all the fields irrespective of variant used. so you can directly use itab to download.
    i guess you are using alv tool bar option to download.
    but i am telling to use your own button to download the report using your own button with GUI_DOWNLOAD Fm.
    for this you pass your ITAB and and then give the file name then this will save all the fields to excel file.
    Regards
    vijay

  • Reduce out put field length of alv output in back ground

    Hi all,
    Is there a way to reduce the output length of the field in back groundfor ALV out put
    Its back ground
    I have thsi things in my field catalog
    wa_fieldcat-outputlen = 10.
    wa_fieldcat-ddic_outputlen = 10.
    If the field has value of length 10 characters its ok
    but when the field has lenth of more than 10 characters
    (say 20 char). in fore ground it displays 10 characters and then we can move the column to see full thing , but in back ground it displays 20 char.
    In fact that is what i have to see because in background you cannot drag the column to see entire thing , but i want to cut short to 12 char even if i don't see the remaining thing its ok
    Thanks

    Hi Vasu,
    WHAT EXACTLY SY-BATCH DOES .
    I tried reducing wa_fieldcat-outputlen = 10. and then i tried
    wa_fieldcat-outputlen = 5., but it doesnot really changed anything in back ground but it did in fore ground . I haven't used any called sy-batch
    Let me know
    This is how my field catalog looks for mATNR
    clear wa_fieldcat.
      wa_fieldcat-fieldname = 'MATNR'.
      wa_fieldcat-seltext_l = ' Material #'.
      wa_fieldcat-seltext_m = 'Material #'.
      wa_fieldcat-seltext_s = ' Material #'.
      wa_fieldcat-reptext_ddic   = 'Material #'.
      wa_fieldcat-ddictxt   = 'L'.
      wa_fieldcat-col_pos   = 4.
      wa_fieldcat-outputlen = 18.
      wa_fieldcat-intlen    = 18.
      wa_fieldcat-ddic_outputlen = 18.
      wa_fieldcat-tabname   = '1'.
      append wa_fieldcat to fieldcat.
    NEXT TIME I COMMENTED THIS AND HAD
    wa_fieldcat-fieldname = 'MATNR'.
      wa_fieldcat-seltext_l = ' Material #'.
      wa_fieldcat-seltext_m = 'Material #'.
      wa_fieldcat-seltext_s = ' Material #'.
      wa_fieldcat-reptext_ddic   = 'Material #'.
      wa_fieldcat-ddictxt   = 'L'.
      wa_fieldcat-col_pos   = 4.
      wa_fieldcat-outputlen = 10.
      wa_fieldcat-intlen    = 10.
      wa_fieldcat-ddic_outputlen = 10.
      wa_fieldcat-tabname   = '1'.
      append wa_fieldcat to fieldcat.
    BUT I DID SEE DIFFERENCE IN FOREBROUND BUT NOT IN BACK GROUND
    Let me know
    Thanks

Maybe you are looking for

  • ORDER BY Statement in CALENDAR doesn't work! SOLVED

    Hello! I think I've searched nearly all threads containing the words 'calendar' and 'order'... I've found some threads dealing with the same problem as I do but I couldn't solve my problem yet... I've got a calender and the data in the day columns ar

  • Issue in Reversing a FI Document using BAPI_ACC_DOCUMENT_REV_CHECK

    Hi Experts! When I try to reverse a FI document with document no (9100000451) in company code 005 in my code by calling the BAPI BAPI_ACC_DOCUMENT_REV_CHECK and BAPI_ACC_DOCUMENT_REV_POST, its gives an error saying  'Reversal in component General Led

  • Mobile account rules are still being ignored!

    We've been running Tiger server for a couple years in combination with mobile accounts for some years now, mostly without significant problems. Since the introduction with Leopard it started giving problems: all rules in the WGM mobile account setup

  • Adobe Illustrator CS6 quit unexpectedly

    OS X Version 10.9.3 3.06 Intel Core 2 Duo 4GB 800 mHz DDR SDRAM IMac - 24 inch (early 2008) Help. Cannot get Illustrato or InDesign to work. So, I am getting this and can not seem to solve it. First off here is the history: Owned and operated CS3. Ha

  • RE: Purchase info record

    Hello Sap gurus       When we create an Purchase info record in conditions we mention the NET PRICE and when we come to PR and in PR when we the Purchase info record no is entered in it, why we have to entered the Valuation Price again why dont it ta