Urgent: regarding ALV  report display problem

hi,
There are 3 problems:-
1.) I had made a ALV report in which i have to display 'POSTING DATE' (iseg-budat) when we execute the report i.e. it should be displayed as  PERIOD :- _______  to _______ on alv report ..
2.)the 2nd problem is dat when i use the '  wa_fieldcat-no_zero = 'X'.  It eliminates all the leading zeros which are present which is okay when i it displays material no.. but the problem is dat it also deletes the other fields where the values are to be zeros.
i had used this FM:-
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
  EXPORTING
   INPUT = ITS1-MATNR
   IMPORTING
   OUTPUT = ITS1-MATNR.
so that only matnr field are to be 0's.
3.) I want to delete the rows which use to contain the values 0's as there are no calculations are performing as these are displayed .
ANYbody having solution of this problem ,plzzzz provide the soluion of it as it is most urgent to me and dat person will definately rewarded.
regards,
ric.s

hi kiran,
thanks for ur response. here is d code which i am using it and plzz help me to figure out where i have to make changes:-
REPORT  ZTEST03.
TABLES: ISEG,MARA.
TYPE-POOLS : SLIS.
INTERNAL TABLE FOR INVENTORY STOCK *****************
DATA: BEGIN OF ITS1 OCCURS 0,
      MATNR LIKE ISEG-MATNR,
      MEINS LIKE ISEG-MEINS,
      MENGE LIKE ISEG-MENGE,
      WRTZL LIKE ISEG-WRTZL,
      BUCHM LIKE ISEG-BUCHM,
      WRTBM LIKE ISEG-WRTBM,
      WERKS LIKE ISEG-WERKS,
      BUDAT LIKE ISEG-BUDAT,
      MTART LIKE MARA-MTART,
      ITEMDESC LIKE MAKT-MAKTX,
      DIFFQTY LIKE ISEG-BUCHM,
      DIFFVALUE LIKE ISEG-WRTBM,
      END OF ITS1.
data: t_heading type slis_t_listheader.
SELECTION-SCREEN BEGIN OF BLOCK PAR1 WITH FRAME TITLE TEXT-001.
*********PARAMETERS*********
PARAMETERS : PLANT LIKE ISEG-WERKS OBLIGATORY.
*********SELECTION SCREEN OPTIONS*********
SELECT-OPTIONS : R_DATE FOR ISEG-BUDAT,
                 M_TYPE  FOR MARA-MTART,
                 IT_M FOR MARA-MATNR.
*********DEFINING VARIABLES*********
  SELECTION-SCREEN END OF BLOCK par1.
TOP-OF-PAGE.
     PERFORM PG_HEADER.
START-OF-SELECTION.
SELECT DISTINCT A~MATNR A~MEINS A~MENGE A~WRTZL A~BUCHM A~WRTBM A~WERKS A~BUDAT B~MTART
   FROM ISEG AS A INNER JOIN MARA AS B ON B~MATNR = A~MATNR
     INTO CORRESPONDING FIELDS OF TABLE ITS1 WHERE B~MATNR = A~MATNR  AND B~MEINS = A~MEINS AND A~WERKS = PLANT AND A~BUDAT IN R_DATE AND B~MTART IN M_TYPE AND B~MATNR IN IT_M.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
  EXPORTING
   INPUT = ITS1-MATNR
   IMPORTING
   OUTPUT = ITS1-MATNR.
  SORT ITS1 BY MATNR.
  DELETE ADJACENT DUPLICATES  FROM  ITS1 WHERE MENGE = 0 AND BUCHM = 0.
LOOP AT ITS1.
     ITS1-DIFFQTY = ITS1-MENGE - ITS1-BUCHM.
     ITS1-DIFFVALUE = ITS1-WRTZL - ITS1-WRTBM.
     SELECT SINGLE MAKTX FROM MAKT INTO ITS1-ITEMDESC WHERE MATNR = ITS1-MATNR.
     MODIFY ITS1.
ENDLOOP.
PERFORM PRN_SMSTOCK_ALV.
WRITING DATA FROM D TABLES**********
FORM PG_HEADER.
WRITE : 'PHYSICAL INVENTORY AUDIT REPORT             PLANT : ', PLANT.
ENDFORM.
*&      Form  PRN_SMSTOCK_ALV
      text
-->  p1        text
<--  p2        text
form PRN_SMSTOCK_ALV .
data: w_title   type lvc_title,
      w_repid   type syrepid,
      w_comm    type slis_formname,
      w_status  type slis_formname,
      x_layout  type slis_layout_alv,
      t_event    type slis_t_event,
      t_fieldcat type slis_t_fieldcat_alv,
      t_sort     type slis_t_sortinfo_alv.
refresh t_fieldcat.
refresh t_event.
refresh t_sort.
clear x_layout.
clear w_title.
  perform set_fieldcat2 using:
1  'MTART'     'MTART'     'MARA'  '15'  space 'MATERIAL TYPE'        space  space  space space space space space space SPACE t_fieldcat 'L' 'C',
2  'MATNR'     'MATNR'     'MARA'  '13'  space 'MATERIAL NO. '        space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
3  'ITEMDESC'  'MAKTX'     'MAKT'  '25'  space 'MATERIAL DESCRIPTION' space  space  space space space space space space SPACE t_fieldcat 'L' 'C',
4  'MEINS'     'MEINS'     'MARA'  '5'   space 'UOM'                  space  space  space space space space space space SPACE t_fieldcat 'C' 'C',
5  'MENGE'     'MENGE'     'ISEG'  '13'  space 'ORG.INV.QTY'          space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
6  'WRTZL'     'WRTZL'     'ISEG'  '13'  space 'ORG.INV.VALUE'        space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
7  'BUCHM'     'BUCHM'     'ISEG'  '13'  space 'PHY.INV.QTY'          space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
8  'WRTBM'     'WRTBM'     'ISEG'  '13'  space 'PHY.INV.VALUE'        space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
9  'DIFFQTY'   'MENGE'     'ISEG'  '13'  space 'DIFF.INV.QTY'         space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
10 'DIFFVALUE' 'WRTZL'     'ISEG'  '13'  space 'DIFF.INV.VALUE'       space  space  space space space space space space SPACE t_fieldcat SPACE 'P'.
x_layout-zebra = 'X'.
perform set_top_page_heading using t_heading t_event.
perform set_events using t_event.
  w_status = ''.
  w_repid = sy-repid.
  w_comm   = 'USER_COMMAND'.
  call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      i_callback_program       = w_repid
      it_fieldcat              = t_fieldcat
      i_Callback_top_of_page   = 'Top-of-page'
      is_layout                = x_layout
      it_sort                  = t_sort
      i_callback_pf_status_set = w_status
      i_callback_user_command  = w_comm
      i_save                   = 'X'
      it_events                = t_event
      i_grid_title             = w_title
      tables
      t_outtab                 = ITS1
    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 set_fieldcat2 USING
      p_colpos p_fieldname p_ref_fieldname p_ref_tabname
      p_outputlen p_noout
      p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
      p_hotspot p_showasicon p_checkbox p_edit
      p_dosum
      t_fieldcat TYPE slis_t_fieldcat_alv
      P_JUST
      P_FTYPE.
  DATA: wa_fieldcat TYPE slis_fieldcat_alv.
  CLEAR wa_fieldcat.
General settings
  wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-no_zero = 'X'.
  wa_fieldcat-col_pos = p_colpos.
  wa_fieldcat-no_out = p_noout.
  wa_fieldcat-hotspot = p_hotspot.
  wa_fieldcat-checkbox = p_checkbox.
  wa_fieldcat-icon = p_showasicon.
  wa_fieldcat-do_sum = p_dosum.
Set output length.
  IF NOT p_outputlen IS INITIAL.
    wa_fieldcat-outputlen = p_outputlen.
  ENDIF.
Set text headers.
IF NOT p_seltext_m IS INITIAL.
    wa_fieldcat-seltext_m = p_seltext_m.
ENDIF.
IF NOT p_seltext_l IS INITIAL.
    wa_fieldcat-seltext_l = p_seltext_l.
ENDIF.
IF NOT p_seltext_s IS INITIAL.
    wa_fieldcat-seltext_s = p_seltext_s.
ENDIF.
  IF NOT p_reptext_ddic IS INITIAL.
    wa_fieldcat-reptext_ddic = p_reptext_ddic.
  ENDIF.
IF NOT p_ddictxt IS INITIAL.
    wa_fieldcat-ddictxt = p_ddictxt.
ENDIF.
  IF NOT P_JUST IS INITIAL.
    WA_FIELDCAT-JUST = P_JUST.
  ENDIF.
Set as editable or not.
  IF NOT p_edit IS INITIAL.
    wa_fieldcat-input     = 'X'.
    wa_fieldcat-edit     = 'X'.
  ENDIF.
  APPEND wa_fieldcat TO t_fieldcat.
ENDFORM.                   "set_fieldcat2
======================== Subroutines called by ALV ================
*&      Form  top_of_page
      Called on top_of_page ALV event.
      Prints the heading.
form top_of_page.
  call function 'REUSE_ALV_COMMENTARY_WRITE'
     exporting
          it_list_commentary = t_heading.
ENDFORM.
form set_top_page_heading using t_heading type slis_t_listheader
                                t_events  type slis_t_event.
data: x_heading type slis_listheader,
      x_event   type line of slis_t_event.
Report title
  clear t_heading[].
  clear x_heading.
  x_heading-typ = 'H'.
  x_heading-info = 'PHYSICAL INVENTORY AUDIT REPORT'.
  append x_heading to t_heading.
Plant Name
clear x_heading.
  x_heading-typ = 'S'.
  x_heading-key = 'PLANT: '.
  x_heading-info = its1-werks.
  append x_heading to t_heading.
Posting Date
*clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'POSTING DATE: '.
x_heading-info = ITS1-BUDAT.
append x_heading to t_heading.
Control Date
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'CONTROL No: '.
x_heading-info = its1-werks.
append x_heading to t_heading.
Control date
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'CONTROL DATE: '.
x_heading-info = its1-werks.
append x_heading to t_heading.
User who is running the report
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'User: '.
x_heading-info = sy-uname.
append x_heading to t_heading.
Date of execution
  clear x_heading.
  x_heading-typ = 'S'.
  x_heading-key = 'Date: '.
  write sy-datum to x_heading-info.
  append x_heading to t_heading.
Time of execution
  clear x_heading.
  x_heading-typ = 'S'.
  x_heading-key = 'Time: '.
  write sy-uzeit to x_heading-info.
  append x_heading to t_heading.
Top of page event
  x_event-name = slis_ev_top_of_page.
  x_event-form = 'TOP_OF_PAGE'.
  append x_event to t_events.
endform.
form set_events using t_events type slis_t_event.
data: x_event   type line of slis_t_event.
endform.
plzzz help me out as it is most urgent to me.
regards,
ric.s

Similar Messages

  • VERY URGENT:REGARDING ALV REPORT

    HI,
    I am making Interactive alv report in which i have to display 3 views in a single report i.e.
    1.) I  have to display :-
    RAW MATERIAL      DAYS
    BOP                        DAYS
    Here days are the difference b/w the Material Doc. Date and Requsition Approval date.
    (which  i have already calculated.)
    2.) When i double click the raw material or bop option then material no and days are to be dislplayed.
    3.)  After double clicking the material then the its migo status and requsition status to be dislplayed .(this thing i had performed )
    My main problem is dat i have to write it all in a single ALV but its little confusing to me as i am doing this kind of report for first time.
    If anybody provide me useful or solved awnser ,he or she will be definately rewarded.
    Message was edited by:
            ric .s

    hi ric.s
    check this prog
    *& Report  ZSAMP_INTERCTIVE                                            *
    REPORT  zsamp_interctive                        .
    TABLES: mara,vbap.
    DATA : BEGIN OF itab OCCURS 0,
           matnr LIKE mara-matnr,
           ernam LIKE mara-ernam,
           END OF itab.
    DATA :  BEGIN OF itab1 OCCURS 0,
            matnr LIKE vbap-matnr,
            vbeln LIKE vbap-vbeln,
            END OF itab1.
    DATA: fld(20) TYPE c,val LIKE mara-matnr .
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: m FOR mara-matnr OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    *AT SELECTION-SCREEN ON m.
    SELECT SINGLE matnr FROM mara INTO mara-matnr WHERE matnr = m.
    IF sy-subrc NE 0.
       MESSAGE e000(zz) WITH 'invalid ' mara-matnr 'in your ' 'selection'.
    ENDIF.
    START-OF-SELECTION.
      SELECT matnr ernam INTO TABLE itab FROM mara WHERE matnr IN m.
      SELECT matnr vbeln INTO TABLE itab1 FROM vbap FOR ALL ENTRIES IN itab
      WHERE matnr = itab-matnr.
    END-OF-SELECTION.
      LOOP AT itab.
        WRITE:/20 itab-matnr,40 itab-ernam.
       hide itab-matnr.
        CLEAR itab-matnr.
      ENDLOOP.
    AT LINE-SELECTION.
      GET CURSOR FIELD fld  VALUE val.
      CASE fld.
        WHEN 'ITAB-MATNR'.
          WRITE:/ val.
      ENDCASE.
      CASE sy-lsind.
        WHEN '1'.
          SET PF-STATUS 'XX2'.
          SET TITLEBAR 'XX2'.
          IF itab1[] IS INITIAL.
            WRITE:/ 'no data found for itab1 in first secondary list'.
          ENDIF.
          LOOP AT itab1.
            WRITE:/30 itab1-matnr,60 itab1-vbeln.
           hide itab1-matnr.
          ENDLOOP.
        WHEN '2'.
          SET PF-STATUS 'XX2'.
          SET TITLEBAR 'XX2'.
          LOOP AT itab.
            WRITE:/30 itab-matnr,60 itab-ernam.
          ENDLOOP.
      ENDCASE.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'SET'.
          IF sy-lsind = 1.
            WINDOW STARTING AT 5 3 ENDING AT 40 10.
            WRITE 'Select line for a second window'.
          ELSEIF sy-lsind = 2.
            WINDOW STARTING AT 45 10 ENDING AT 60 12.
            WRITE 'Last window'.
          ENDIF.
        WHEN 'BACK'.
        sy-lsind = sy-lsind - 1.
        WHEN 'ABC'.
          WRITE:/ 'iam great'.
       WHEN 'DOWNLOAD'.
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
            BIN_FILESIZE                    =
              filename                        = 'c:\temp.txt'
              filetype                        = 'DAT'
            TABLES
              data_tab                        = itab
           FIELDNAMES                      =
           EXCEPTIONS
             file_write_error                = 1
             no_batch                        = 2
             gui_refuse_filetransfer         = 3
             invalid_type                    = 4
             no_authority                    = 5
             unknown_error                   = 6
             header_not_allowed              = 7
             separator_not_allowed           = 8
             filesize_not_allowed            = 9
             header_too_long                 = 10
             dp_error_create                 = 11
             dp_error_send                   = 12
             dp_error_write                  = 13
             unknown_dp_error                = 14
             access_denied                   = 15
             dp_out_of_memory                = 16
             disk_full                       = 17
             dp_timeout                      = 18
             file_not_found                  = 19
             dataprovider_exception          = 20
             control_flush_error             = 21
             OTHERS                          = 22.
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
      ENDCASE.
    TOP-OF-PAGE DURING  LINE-SELECTION.
      CASE sy-lsind.
        WHEN '1'.
          WRITE:/ 'this is secondary list'.
      ENDCASE.

  • Re: URGENT: REGARDING ALV REPORT OUTLOOK

    HI,
    I am making alv report in which d simple format is used and its output is used to be appear to be simple and  now i want to make its output more gud,can anybody tell me d solution of dis problem,reply useful will be definately rewarded....
    REPORT  ZMFTEST5 no standard page heading LINE-SIZE 310.
    TABLES : VBAK,ABAP,VBEP,VBKD,MARA,KNA1,MAKT.
    *Varriable declaration.
    TYPE-POOLS SLIS.
    DATA : POS TYPE I.
    DATA   REPID  LIKE SY-REPID.
    DATA : F1 TYPE SLIS_T_FIELDCAT_ALV,
           F2 TYPE SLIS_FIELDCAT_ALV,
          L_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA   L_POS TYPE I VALUE 1.               "position of the column
    DATA   GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    **DATA  GT_SORT TYPE SLIS_T_SORTINFO_ALV.
    DATA:  GT_EVENTS    TYPE SLIS_T_EVENT,
           FS_EVENTCAT LIKE LINE OF GT_EVENTs.
    INTERNAL TABLE FOR SALES ORDER *****************
    DATA : BEGIN OF ITSO OCCURS 0,
           VBELN LIKE VBAK-VBELN,
           ERDAT LIKE VBAK-ERDAT,
           BSTNK LIKE VBAK-BSTNK,
           KUNNR LIKE VBAK-KUNNR,
           MATNR LIKE VBAP-MATNR,
           POSNR LIKE VBAP-POSNR,
           WMENG LIKE VBEP-WMENG,
           NTGEW LIKE MARA-NTGEW,
           BRGEW LIKE MARA-BRGEW,
           GEWEI LIKE MARA-GEWEI,
           SPART LIKE VBAK-SPART,
           BMENG LIKE VBEP-BMENG,
           EDATU LIKE VBEP-EDATU,
           BSTKD LIKE VBKD-BSTKD,
           WERKS LIKE VBAP-WERKS,
           MEINS LIKE MARA-MEINS,
           KWMENG LIKE VBAP-KWMENG,
           KLMENG LIKE VBAP-KLMENG,
           END OF ITSO.
    Heading of the report.
    data: t_heading type slis_t_listheader.
    ***********PARAMETERS***************
      PARAMETERS : PLANT LIKE VBAP-WERKS OBLIGATORY.
    *********SELECTION SCREEN OPTIONS*********
      SELECT-OPTIONS : SO_ORD  FOR VBAK-VBELN,
                       SO_PARTY FOR VBAK-KUNNR,
                       IT_M FOR MARA-MATNR,
                       DIV FOR VBAK-SPART,
                       SO_DATE FOR VBAK-ERDAT,
                       S_DATE FOR VBEP-EDATU.                   .
    START-OF-SELECTION.
           SELECT DISTINCT AVBELN AERDAT ABSTNK AKUNNR  BSPART BMATNR BPOSNR BWERKS BKWMENG BKBMENG CNTGEW CBRGEW CGEWEI DWMENG DBMENG DEDATU D~VBELN
              FROM VBAK AS A INNER JOIN VBAP AS B ON BVBELN = AVBELN
               INNER JOIN MARA AS C ON CMATNR = BMATNR
                 INNER JOIN VBEP AS D ON DWMENG > 0 AND DVBELN = AVBELN AND DPOSNR = B~POSNR
                   INTO CORRESPONDING FIELDS OF TABLE ITSO
                     WHERE AVBELN IN SO_ORD AND AKUNNR IN SO_PARTY AND BSPART IN DIV AND AERDAT IN SO_DATE AND DEDATU IN S_DATE AND BMATNR IN IT_M AND B~WERKS = PLANT.
             IF SY-SUBRC <> 0.
       MESSAGE E899(M3) WITH 'No records'.
    ENDIF.
    perform f_build_eventcat.
    PERFORM LAYOUT.
    END-OF-SELECTION.
    FORM LAYOUT.
      PERFORM FCAT USING 'VBELN'    'ITSO'  '' 'S.O.NO. '  'VBELN'     'VBAK' ''.
      PERFORM FCAT USING 'WERKS'    'ITSO'  '' 'PLANT  '   'WERKS'     'VBAP' ''.
      PERFORM FCAT USING 'ERDAT'    'ITSO'  '' 'S.O.DATE'  'ERDAT'     'VBAK' ''.
      PERFORM FCAT USING 'BSTNK'    'ITSO'  '' 'P.O.N.O.'  'BSTNK'     'VBAK' ''.
      PERFORM FCAT USING 'KUNNR'    'ITSO'  '' 'PARTY   '  'KUNNR'     'VBAP' ''.
      PERFORM FCAT USING 'MATNR'    'ITSO'  '' 'MAT.NO. '  'MATNR'     'MARA' ''.
      PERFORM FCAT USING 'WMENG'    'ITSO'  '' 'S.O.QTY'   'WMENG'     'VBEP' ''.
    REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
             I_CALLBACK_PROGRAM       = REPID
             IT_FIELDCAT              = F1
            IT_SORT                  = GT_SORT
             I_SAVE                   = 'X'
             IT_EVENTS                = GT_EVENTS[]
         TABLES
              T_OUTTAB                 = ITSO.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Top of page heading
    perform set_top_page_heading using t_heading t_event.
    Events
    perform set_events using t_event.
    GUI Status
    w_status = ''.
    w_repid = sy-repid.
    Title
    w_title = <<If you want to set a title for
                the ALV, please, uncomment and edit this line>>.
    User commands
    w_comm   = 'USER_COMMAND'.
    ENDFORM.                    " LAYOUT
    *&      Form  FCAT
    FORM FCAT USING P_FIELD P_TABLE P_SUM P_TEXT P_RFIELD P_RTABLE P_DISP.
      ADD 1 TO POS.
      F2-COL_POS       = POS.
      F2-FIELDNAME     = P_FIELD.
      F2-TABNAME       = P_TABLE.
      F2-SELTEXT_L     = P_TEXT.
      F2-REF_FIELDNAME = P_RFIELD.
      F2-REF_TABNAME   = P_RTABLE.
      F2-DO_SUM        = P_SUM.
      F2-NO_OUT        = P_DISP.
      APPEND F2 TO F1.
      CLEAR F2.
    ENDFORM.                " FCAT
    FORM F_BUILD_EVENTCAT .
    CLEAR: GT_EVENTS.  REFRESH: GT_EVENTS.
      CLEAR: FS_EVENTCAT.
      FS_EVENTCAT-NAME = 'TOP_OF_PAGE'.
      FS_EVENTCAT-FORM = 'F_REPORT_HEADER_ALV'.
      APPEND FS_EVENTCAT TO GT_EVENTS.
      CLEAR: FS_EVENTCAT.
      FS_EVENTCAT-NAME = 'END_OF_LIST'.
      FS_EVENTCAT-FORM = 'F_WRITE_SUMMARY'.
      APPEND FS_EVENTCAT TO GT_EVENTS.
    ENDFORM.                    " F_BUILD_EVENTCAT
    *&      Form  F_WRITE_SUMMARY
          Write summary before exit
    FORM F_WRITE_SUMMARY .
    write:/ 'Welcome to XYZ Limited'.
    write:/ 'This is a test program to display Report in ALV Format'.
    ENDFORM.

    Just check the program :
    REPORT ZMFTEST5 no standard page heading LINE-SIZE 310.
    TABLES : VBAK,ABAP,VBEP,VBKD,MARA,KNA1,MAKT.
    *Varriable declaration.
    TYPE-POOLS SLIS.
    DATA : POS TYPE I.
    DATA REPID LIKE SY-REPID.
    DATA : F1 TYPE SLIS_T_FIELDCAT_ALV,
    F2 TYPE SLIS_FIELDCAT_ALV,
    L_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA L_POS TYPE I VALUE 1. "position of the column
    DATA GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    **DATA GT_SORT TYPE SLIS_T_SORTINFO_ALV.
    DATA: GT_EVENTS TYPE SLIS_T_EVENT,
    FS_EVENTCAT LIKE LINE OF GT_EVENTs.
    INTERNAL TABLE FOR SALES ORDER *****************
    DATA : BEGIN OF ITSO OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    ERDAT LIKE VBAK-ERDAT,
    BSTNK LIKE VBAK-BSTNK,
    KUNNR LIKE VBAK-KUNNR,
    MATNR LIKE VBAP-MATNR,
    POSNR LIKE VBAP-POSNR,
    WMENG LIKE VBEP-WMENG,
    NTGEW LIKE MARA-NTGEW,
    BRGEW LIKE MARA-BRGEW,
    GEWEI LIKE MARA-GEWEI,
    SPART LIKE VBAK-SPART,
    BMENG LIKE VBEP-BMENG,
    EDATU LIKE VBEP-EDATU,
    BSTKD LIKE VBKD-BSTKD,
    WERKS LIKE VBAP-WERKS,
    MEINS LIKE MARA-MEINS,
    KWMENG LIKE VBAP-KWMENG,
    KLMENG LIKE VBAP-KLMENG,
    END OF ITSO.
    Heading of the report.
    data: t_heading type slis_t_listheader.
    ***********PARAMETERS***************
    PARAMETERS : PLANT LIKE VBAP-WERKS OBLIGATORY.
    *********SELECTION SCREEN OPTIONS*********
    SELECT-OPTIONS : SO_ORD FOR VBAK-VBELN,
    SO_PARTY FOR VBAK-KUNNR,
    IT_M FOR MARA-MATNR,
    DIV FOR VBAK-SPART,
    SO_DATE FOR VBAK-ERDAT,
    S_DATE FOR VBEP-EDATU. .
    START-OF-SELECTION.
    SELECT DISTINCT AVBELN AERDAT ABSTNK AKUNNR BSPART BMATNR B~POSNR
    BWERKS BKWMENG BKBMENG CNTGEW CBRGEW CGEWEI DWMENG DBMENG
    DEDATU DVBELN
    FROM VBAK AS A INNER JOIN VBAP AS B ON BVBELN = AVBELN
    INNER JOIN MARA AS C ON CMATNR = BMATNR
    INNER JOIN VBEP AS D ON DWMENG > 0 AND DVBELN = AVBELN AND DPOSNR =
    B~POSNR
    INTO CORRESPONDING FIELDS OF TABLE ITSO
    WHERE AVBELN IN SO_ORD AND AKUNNR IN SO_PARTY AND B~SPART IN DIV AND
    AERDAT IN SO_DATE AND DEDATU IN S_DATE AND BMATNR IN IT_M AND BWERKS
    = PLANT.
    IF SY-SUBRC <> 0.
    MESSAGE E899(M3) WITH 'No records'.
    ENDIF.
    perform f_build_eventcat.
    PERFORM LAYOUT.
    END-OF-SELECTION.
    FORM LAYOUT.
    PERFORM FCAT USING 'VBELN' 'ITSO' '' 'S.O.NO. ' 'VBELN' 'VBAK' ''.
    PERFORM FCAT USING 'WERKS' 'ITSO' '' 'PLANT ' 'WERKS' 'VBAP' ''.
    PERFORM FCAT USING 'ERDAT' 'ITSO' '' 'S.O.DATE' 'ERDAT' 'VBAK' ''.
    PERFORM FCAT USING 'BSTNK' 'ITSO' '' 'P.O.N.O.' 'BSTNK' 'VBAK' ''.
    PERFORM FCAT USING 'KUNNR' 'ITSO' '' 'PARTY ' 'KUNNR' 'VBAP' ''.
    PERFORM FCAT USING 'MATNR' 'ITSO' '' 'MAT.NO. ' 'MATNR' 'MARA' ''.
    PERFORM FCAT USING 'WMENG' 'ITSO' '' 'S.O.QTY' 'WMENG' 'VBEP' ''.
    REPID = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                =
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = F1
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
       IT_EVENTS                         = GT_EVENTS[]
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_ADD_FIELDCAT                   =
      IT_HYPERLINK                      =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
      IT_EXCEPT_QINFO                   =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = ITSO
    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.
    Top of page heading
    perform set_top_page_heading using t_heading t_event.
    Events
    perform set_events using t_event.
    GUI Status
    w_status = ''.
    w_repid = sy-repid.
    Title
    w_title = <<If you want to set a title for
    the ALV, please, uncomment and edit this line>>.
    User commands
    w_comm = 'USER_COMMAND'.
    ENDFORM. " LAYOUT
    *& Form FCAT
    FORM FCAT USING P_FIELD P_TABLE P_SUM P_TEXT P_RFIELD P_RTABLE P_DISP.
    ADD 1 TO POS.
    F2-COL_POS = POS.
    F2-FIELDNAME = P_FIELD.
    F2-TABNAME = P_TABLE.
    F2-SELTEXT_L = P_TEXT.
    F2-REF_FIELDNAME = P_RFIELD.
    F2-REF_TABNAME = P_RTABLE.
    F2-DO_SUM = P_SUM.
    F2-NO_OUT = P_DISP.
    APPEND F2 TO F1.
    CLEAR F2.
    ENDFORM. " FCAT
    FORM F_BUILD_EVENTCAT .
    CLEAR: GT_EVENTS. REFRESH: GT_EVENTS.
    CLEAR: FS_EVENTCAT.
    FS_EVENTCAT-NAME = 'TOP_OF_PAGE'.
    FS_EVENTCAT-FORM = 'F_REPORT_HEADER_ALV'.
    APPEND FS_EVENTCAT TO GT_EVENTS.
    CLEAR: FS_EVENTCAT.
    FS_EVENTCAT-NAME = 'END_OF_LIST'.
    FS_EVENTCAT-FORM = 'F_WRITE_SUMMARY'.
    APPEND FS_EVENTCAT TO GT_EVENTS.
    ENDFORM. " F_BUILD_EVENTCAT
    *& Form F_WRITE_SUMMARY
    Write summary before exit
    FORM F_WRITE_SUMMARY .
    write:/ 'Welcome to XYZ Limited'.
    write:/ 'This is a test program to display Report in ALV Format'.
    ENDFORM.
    Thanks
    Seshu

  • URGENT: - REGARDING ALV REPORT

    hi,
        i had made dis report in ALV and i want to display d heading format as follows:-
            NAME:- TEST PROGRAM
            date: - 21.05.2007
            time:- 1:30:23 am
    moreover i want to see the print perview of it but it is giving runtime error.
    plz help me in solving dis problem and he or she will be definately rewarded..
    *& Report  ZMFTEST5
    REPORT  ZMFTEST5 no standard page heading LINE-SIZE 310.
    TABLES : VBAK,ABAP,VBEP,VBKD,MARA,KNA1,MAKT.
    *Varriable declaration.
    TYPE-POOLS SLIS.
    DATA : POS TYPE I.
    DATA REPID LIKE SY-REPID.
    DATA : F1 TYPE SLIS_T_FIELDCAT_ALV,
    F2 TYPE SLIS_FIELDCAT_ALV,
    L_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA L_POS TYPE I VALUE 1. "position of the column
    DATA GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA: GT_EVENTS TYPE SLIS_T_EVENT,
    FS_EVENTCAT LIKE LINE OF GT_EVENTs.
    DATA : T_HEADING TYPE slis_t_listheader.
    INTERNAL TABLE FOR SALES ORDER *****************
    DATA : BEGIN OF ITSO OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    ERDAT LIKE VBAK-ERDAT,
    BSTNK LIKE VBAK-BSTNK,
    KUNNR LIKE VBAK-KUNNR,
    MATNR LIKE VBAP-MATNR,
    POSNR LIKE VBAP-POSNR,
    WMENG LIKE VBEP-WMENG,
    NTGEW LIKE MARA-NTGEW,
    BRGEW LIKE MARA-BRGEW,
    GEWEI LIKE MARA-GEWEI,
    SPART LIKE VBAK-SPART,
    BMENG LIKE VBEP-BMENG,
    EDATU LIKE VBEP-EDATU,
    BSTKD LIKE VBKD-BSTKD,
    WERKS LIKE VBAP-WERKS,
    MEINS LIKE MARA-MEINS,
    KWMENG LIKE VBAP-KWMENG,
    KLMENG LIKE VBAP-KLMENG,
    BALQTY LIKE VBAP-KLMENG,
    SOGWT LIKE MARA-BRGEW,
    SONWT LIKE MARA-BRGEW,
    SINWT LIKE MARA-BRGEW,
    BALGWT LIKE MARA-BRGEW,
    BALNWT LIKE MARA-BRGEW,
    DISPNWT LIKE MARA-BRGEW,
    PARTYNAME LIKE KNA1-NAME1,
    ITEMDESC LIKE MAKT-MAKTX,
    STATUS TYPE C,
    END OF ITSO.
    DATA:B_QTY TYPE P LENGTH 7 DECIMALS 3.
    ***********PARAMETERS***************
    PARAMETERS : PLANT LIKE VBAP-WERKS OBLIGATORY.
    *********SELECTION SCREEN OPTIONS*********
    SELECT-OPTIONS : SO_ORD FOR VBAK-VBELN,
    SO_PARTY FOR VBAK-KUNNR,
    IT_M FOR MARA-MATNR,
    DIV FOR VBAK-SPART,
    SO_DATE FOR VBAK-ERDAT,
    S_DATE FOR VBEP-EDATU.
    START-OF-SELECTION.
    SELECT DISTINCT A~VBELN A~ERDAT A~BSTNK A~KUNNR B~SPART B~MATNR B~POSNR B~WERKS B~KWMENG B~KBMENG C~NTGEW C~BRGEW C~GEWEI D~WMENG D~BMENG D~EDATU D~VBELN
    FROM VBAK AS A INNER JOIN VBAP AS B ON B~VBELN = A~VBELN
    INNER JOIN MARA AS C ON C~MATNR = B~MATNR
    INNER JOIN VBEP AS D ON D~WMENG > 0 AND D~VBELN = A~VBELN AND D~POSNR = B~POSNR
    INTO CORRESPONDING FIELDS OF TABLE ITSO
    WHERE A~VBELN IN SO_ORD AND A~KUNNR IN SO_PARTY AND B~SPART IN DIV AND A~ERDAT IN SO_DATE AND D~EDATU IN S_DATE AND B~MATNR IN IT_M AND B~WERKS = PLANT.
    IF SY-SUBRC <> 0.
    MESSAGE E899(M3) WITH 'No records'.
    ENDIF.
    DATA : V_NETWT LIKE MARA-NTGEW,
           V_GRWT LIKE MARA-NTGEW,
           V_SOSTAT TYPE C.
    LOOP AT ITSO.
      if ITSO-bmeng = 0.
        V_SOSTAT = 'A'.
      ELSEIF ITSO-WMENG <> ITSO-BMENG.
        V_SOSTAT = 'B'.
      ELSE.
        V_SOSTAT = 'C'.
      ENDIF.
      IF ITSO-GEWEI = 'G'.
        V_NETWT = ITSO-NTGEW / 1000.
        V_GRWT = ITSO-BRGEW / 1000.
      ELSEIF ITSO-GEWEI = 'KG'.
        V_NETWT = ITSO-NTGEW.
        V_GRWT = ITSO-BRGEW.
      ELSEIF ITSO-GEWEI = 'TO'.
        V_NETWT = ITSO-NTGEW * 1000.
        V_GRWT = ITSO-BRGEW * 1000.
      ENDIF.
      ITSO-STATUS = V_SOSTAT.
      ITSO-SOGWT = V_GRWT * ITSO-WMENG / 1000.
      ITSO-SONWT = V_NETWT * ITSO-WMENG / 1000.
      ITSO-SINWT = V_GRWT * ITSO-BMENG / 1000.
      ITSO-BALGWT = V_GRWT * ( ITSO-WMENG - ITSO-BMENG )  / 1000.
      ITSO-BALNWT = V_NETWT * ( ITSO-WMENG - ITSO-BMENG )  / 1000.
      ITSO-DISPNWT = V_NETWT * ITSO-BMENG  / 1000.
      ITSO-BALQTY = ITSO-WMENG - ITSO-BMENG.
      SELECT SINGLE NAME1 FROM KNA1 INTO ITSO-PARTYNAME WHERE KUNNR = ITSO-KUNNR.
      SELECT SINGLE MAKTX FROM MAKT INTO ITSO-ITEMDESC WHERE MATNR = ITSO-MATNR.
      MODIFY ITSO.
    ENDLOOP.
    perform f_build_eventcat.
    PERFORM LAYOUT using t_heading.
    END-OF-SELECTION.
    FORM LAYOUT using t_heading  type slis_t_listheader.
    data : t_event    type slis_t_event.
    PERFORM FCAT USING 'WERKS'     'ITSO' '' 'PLANT '               'WERKS'     'VBAP' ''.
    PERFORM FCAT USING 'VBELN'     'ITSO' '' 'SO NO. '              'VBELN'     'VBAK' ''.
    PERFORM FCAT USING 'ERDAT'     'ITSO' '' 'S.O.DATE'             'ERDAT'     'VBAK' ''.
    PERFORM FCAT USING 'BSTNK'     'ITSO' '' 'P.O.N.O.'             'BSTNK'     'VBAK' ''.
    PERFORM FCAT USING 'KUNNR'     'ITSO' '' 'PARTY '               'KUNNR'     'VBAP' ''.
    PERFORM FCAT USING 'PARTYNAME' 'ITSO' '' 'PARTY DESCRIPTION'    'PARTYNAME' ''     ''.
    PERFORM FCAT USING 'ITEMDESC'  'ITSO' '' 'MATERIAL DESCRIPTION' 'ITEMDESC'  ''     ''.
    PERFORM FCAT USING 'MATNR'     'ITSO' '' 'MAT.NO. '             'MATNR'     'MARA' ''.
    PERFORM FCAT USING 'POSNR'     'ITSO' '' 'LINE.ITEM'            'POSNR'     'VBAP' ''.
    PERFORM FCAT USING 'WMENG'     'ITSO' '' 'S.O.QTY'              'WMENG'     'VBEP' '' .
    PERFORM FCAT USING 'EDATU'     'ITSO' '' 'SCH.DATE'             'EDATU'     'VBEP' ''.
    PERFORM FCAT USING 'SONWT'     'ITSO' '' 'S.O.NWT '             'P'         ''     ''.
    PERFORM FCAT USING 'SOGWT'     'ITSO' '' 'S.O.GWT '             'P'         ''     ''.
    PERFORM FCAT USING 'SPART'     'ITSO' '' 'DIV    '              'SPART'     'VBAP' ''.
    PERFORM FCAT USING 'BMENG'     'ITSO' '' 'DISP.QTY'             'BMENG'     'VBEP' ''.
    PERFORM FCAT USING 'DISPNWT'   'ITSO' '' 'DISP.NT.WT '          'P'         ''     ''.
    PERFORM FCAT USING 'BALQTY'    'ITSO' '' 'BAL.QTY.'             'P'         ''     ''.
    PERFORM FCAT USING 'BALNWT'    'ITSO' '' 'BAL.NT.WT '           'P'         ''     ''.
    PERFORM FCAT USING 'BALGWT'    'ITSO' '' 'BAL.GR.WT '           'P'         ''     ''.
    PERFORM FCAT USING 'STATUS'    'ITSO' '' 'STATUS'               'STATUS'    ''     ''.
    refresh t_event.
    *perform set_top_page_heading using t_heading t_event.
    REPID = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                =
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
       I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
      IT_FIELDCAT                       = F1
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         = GT_EVENTS[]
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_ADD_FIELDCAT                   =
      IT_HYPERLINK                      =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
      IT_EXCEPT_QINFO                   =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
    TABLES
       T_OUTTAB                          = ITSO
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
    ENDFORM. " LAYOUT
    *& Form FCAT
    FORM FCAT USING P_FIELD P_TABLE P_SUM P_TEXT P_RFIELD P_RTABLE P_DISP.
    ADD 1 TO POS.
    F2-COL_POS = POS.
    F2-FIELDNAME = P_FIELD.
    F2-TABNAME = P_TABLE.
    F2-SELTEXT_L = P_TEXT.
    F2-REF_FIELDNAME = P_RFIELD.
    F2-REF_TABNAME = P_RTABLE.
    F2-DO_SUM = P_SUM.
    F2-NO_OUT = P_DISP.
    APPEND F2 TO F1.
    CLEAR F2.
    ENDFORM. " FCAT
    FORM F_BUILD_EVENTCAT .
    CLEAR: GT_EVENTS. REFRESH: GT_EVENTS.
    CLEAR: FS_EVENTCAT.
    FS_EVENTCAT-NAME = 'TOP_OF_PAGE'.
    FS_EVENTCAT-FORM = 'F_REPORT_HEADER_ALV'.
    APPEND FS_EVENTCAT TO GT_EVENTS.
    CLEAR: FS_EVENTCAT.
    FS_EVENTCAT-NAME = 'END_OF_LIST'.
    FS_EVENTCAT-FORM = 'F_WRITE_SUMMARY'.
    APPEND FS_EVENTCAT TO GT_EVENTS.
    ENDFORM.
    *FORM F_REPORT_HEADER_ALV.
    *CALL FUNCTION 'Z_HEAD_PRINT'
    EXPORTING
    WRITE: / TITLE1 = 'XYZ Limited'
    TITLE2 = 'Sales Order Report'
    TITLE3 = 'Created on '
    COLOR = 'X'.
    *ENDFORM.
    FORM F_WRITE_SUMMARY .
    write:/ 'Welcome to XYZ Limited'.
    write:/ 'This is a test program to display Report in ALV Format'.
    ENDFORM.
    *&      Form  set_top_page_heading
          text
         -->P_T_HEADING  text
    *form set_top_page_heading  using    t_heading
                                       t_events  type slis_t_event.
    *data: x_heading type slis_listheader,
         x_event   type line of slis_t_event.
    Report title
    clear t_heading[].
    clear x_heading.
    x_heading-typ = 'H'.
    x_heading-info = ''(001).
    append x_heading to t_heading.
    t_heading-info = 'TEST'.
    t_heading-typ = 'H'.
    Program name
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'Program: '.
    x_heading-info = sy-repid.
    append x_heading to t_heading.
    User who is running the report
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'User: '.
    x_heading-info = sy-uname.
    append x_heading to t_heading.
    Date of execution
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'Date: '.
    write sy-datum to x_heading-info.
    append x_heading to t_heading.
    Time of execution
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'Time: '.
    write sy-uzeit to x_heading-info.
    append x_heading to t_heading.
    Top of page event
    x_event-name = slis_ev_top_of_page.
    x_event-form = 'TOP_OF_PAGE'.
    append x_event to t_events.
    *endform.                    " set_top_page_heading

    Hi,
    i had change ur code just copy this and try,i hope it will work.
    REPORT ZMFTEST5 no standard page heading LINE-SIZE 310.
    TABLES : VBAK,ABAP,VBEP,VBKD,MARA,KNA1,MAKT.
    *Varriable declaration.
    TYPE-POOLS SLIS.
    DATA : POS TYPE I.
    DATA REPID LIKE SY-REPID.
    ****************CHANGES**************
    DATA : FDATE TYPE STRING,
           FTIME TYPE STRING,
           FNAME TYPE STRING.
    ****************CHANGES**************
    DATA : F1 TYPE SLIS_T_FIELDCAT_ALV,
    F2 TYPE SLIS_FIELDCAT_ALV,
    L_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA L_POS TYPE I VALUE 1. "position of the column
    DATA GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA: GT_EVENTS TYPE SLIS_T_EVENT,
    FS_EVENTCAT LIKE LINE OF GT_EVENTs.
    DATA : T_HEADING TYPE slis_t_listheader.
    INTERNAL TABLE FOR SALES ORDER *****************
    DATA : BEGIN OF ITSO OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    ERDAT LIKE VBAK-ERDAT,
    BSTNK LIKE VBAK-BSTNK,
    KUNNR LIKE VBAK-KUNNR,
    MATNR LIKE VBAP-MATNR,
    POSNR LIKE VBAP-POSNR,
    WMENG LIKE VBEP-WMENG,
    NTGEW LIKE MARA-NTGEW,
    BRGEW LIKE MARA-BRGEW,
    GEWEI LIKE MARA-GEWEI,
    SPART LIKE VBAK-SPART,
    BMENG LIKE VBEP-BMENG,
    EDATU LIKE VBEP-EDATU,
    BSTKD LIKE VBKD-BSTKD,
    WERKS LIKE VBAP-WERKS,
    MEINS LIKE MARA-MEINS,
    KWMENG LIKE VBAP-KWMENG,
    KLMENG LIKE VBAP-KLMENG,
    BALQTY LIKE VBAP-KLMENG,
    SOGWT LIKE MARA-BRGEW,
    SONWT LIKE MARA-BRGEW,
    SINWT LIKE MARA-BRGEW,
    BALGWT LIKE MARA-BRGEW,
    BALNWT LIKE MARA-BRGEW,
    DISPNWT LIKE MARA-BRGEW,
    PARTYNAME LIKE KNA1-NAME1,
    ITEMDESC LIKE MAKT-MAKTX,
    STATUS TYPE C,
    END OF ITSO.
    DATA:B_QTY TYPE P LENGTH 7 DECIMALS 3.
    ***********PARAMETERS***************
    PARAMETERS : PLANT LIKE VBAP-WERKS OBLIGATORY.
    *********SELECTION SCREEN OPTIONS*********
    SELECT-OPTIONS : SO_ORD FOR VBAK-VBELN,
    SO_PARTY FOR VBAK-KUNNR,
    IT_M FOR MARA-MATNR,
    DIV FOR VBAK-SPART,
    SO_DATE FOR VBAK-ERDAT,
    S_DATE FOR VBEP-EDATU.
    START-OF-SELECTION.
    SELECT DISTINCT A~VBELN A~ERDAT A~BSTNK A~KUNNR B~SPART B~MATNR B~POSNR B~WERKS B~KWMENG B~KBMENG C~NTGEW C~BRGEW C~GEWEI D~WMENG D~BMENG D~EDATU D~VBELN
    FROM VBAK AS A INNER JOIN VBAP AS B ON B~VBELN = A~VBELN
    INNER JOIN MARA AS C ON C~MATNR = B~MATNR
    INNER JOIN VBEP AS D ON D~WMENG > 0 AND D~VBELN = A~VBELN AND D~POSNR = B~POSNR
    INTO CORRESPONDING FIELDS OF TABLE ITSO
    WHERE A~VBELN IN SO_ORD AND A~KUNNR IN SO_PARTY AND B~SPART IN DIV AND A~ERDAT IN SO_DATE AND D~EDATU IN S_DATE AND B~MATNR IN IT_M AND B~WERKS = PLANT.
    IF SY-SUBRC <> 0.
    MESSAGE E899(M3) WITH 'No records'.
    ENDIF.
    DATA : V_NETWT LIKE MARA-NTGEW,
    V_GRWT LIKE MARA-NTGEW,
    V_SOSTAT TYPE C.
    LOOP AT ITSO.
    if ITSO-bmeng = 0.
    V_SOSTAT = 'A'.
    ELSEIF ITSO-WMENG <> ITSO-BMENG.
    V_SOSTAT = 'B'.
    ELSE.
    V_SOSTAT = 'C'.
    ENDIF.
    IF ITSO-GEWEI = 'G'.
    V_NETWT = ITSO-NTGEW / 1000.
    V_GRWT = ITSO-BRGEW / 1000.
    ELSEIF ITSO-GEWEI = 'KG'.
    V_NETWT = ITSO-NTGEW.
    V_GRWT = ITSO-BRGEW.
    ELSEIF ITSO-GEWEI = 'TO'.
    V_NETWT = ITSO-NTGEW * 1000.
    V_GRWT = ITSO-BRGEW * 1000.
    ENDIF.
    ITSO-STATUS = V_SOSTAT.
    ITSO-SOGWT = V_GRWT * ITSO-WMENG / 1000.
    ITSO-SONWT = V_NETWT * ITSO-WMENG / 1000.
    ITSO-SINWT = V_GRWT * ITSO-BMENG / 1000.
    ITSO-BALGWT = V_GRWT * ( ITSO-WMENG - ITSO-BMENG ) / 1000.
    ITSO-BALNWT = V_NETWT * ( ITSO-WMENG - ITSO-BMENG ) / 1000.
    ITSO-DISPNWT = V_NETWT * ITSO-BMENG / 1000.
    ITSO-BALQTY = ITSO-WMENG - ITSO-BMENG.
    SELECT SINGLE NAME1 FROM KNA1 INTO ITSO-PARTYNAME WHERE KUNNR = ITSO-KUNNR.
    SELECT SINGLE MAKTX FROM MAKT INTO ITSO-ITEMDESC WHERE MATNR = ITSO-MATNR.
    MODIFY ITSO.
    ENDLOOP.
    perform f_build_eventcat.
    PERFORM LAYOUT using t_heading.
    END-OF-SELECTION.
    FORM LAYOUT using t_heading type slis_t_listheader.
    data : t_event type slis_t_event.
    PERFORM FCAT USING 'WERKS' 'ITSO' '' 'PLANT ' 'WERKS' 'VBAP' ''.
    PERFORM FCAT USING 'VBELN' 'ITSO' '' 'SO NO. ' 'VBELN' 'VBAK' ''.
    PERFORM FCAT USING 'ERDAT' 'ITSO' '' 'S.O.DATE' 'ERDAT' 'VBAK' ''.
    PERFORM FCAT USING 'BSTNK' 'ITSO' '' 'P.O.N.O.' 'BSTNK' 'VBAK' ''.
    PERFORM FCAT USING 'KUNNR' 'ITSO' '' 'PARTY ' 'KUNNR' 'VBAP' ''.
    PERFORM FCAT USING 'PARTYNAME' 'ITSO' '' 'PARTY DESCRIPTION' 'PARTYNAME' '' ''.
    PERFORM FCAT USING 'ITEMDESC' 'ITSO' '' 'MATERIAL DESCRIPTION' 'ITEMDESC' '' ''.
    PERFORM FCAT USING 'MATNR' 'ITSO' '' 'MAT.NO. ' 'MATNR' 'MARA' ''.
    PERFORM FCAT USING 'POSNR' 'ITSO' '' 'LINE.ITEM' 'POSNR' 'VBAP' ''.
    PERFORM FCAT USING 'WMENG' 'ITSO' '' 'S.O.QTY' 'WMENG' 'VBEP' '' .
    PERFORM FCAT USING 'EDATU' 'ITSO' '' 'SCH.DATE' 'EDATU' 'VBEP' ''.
    PERFORM FCAT USING 'SONWT' 'ITSO' '' 'S.O.NWT ' 'P' '' ''.
    PERFORM FCAT USING 'SOGWT' 'ITSO' '' 'S.O.GWT ' 'P' '' ''.
    PERFORM FCAT USING 'SPART' 'ITSO' '' 'DIV ' 'SPART' 'VBAP' ''.
    PERFORM FCAT USING 'BMENG' 'ITSO' '' 'DISP.QTY' 'BMENG' 'VBEP' ''.
    PERFORM FCAT USING 'DISPNWT' 'ITSO' '' 'DISP.NT.WT ' 'P' '' ''.
    PERFORM FCAT USING 'BALQTY' 'ITSO' '' 'BAL.QTY.' 'P' '' ''.
    PERFORM FCAT USING 'BALNWT' 'ITSO' '' 'BAL.NT.WT ' 'P' '' ''.
    PERFORM FCAT USING 'BALGWT' 'ITSO' '' 'BAL.GR.WT ' 'P' '' ''.
    PERFORM FCAT USING 'STATUS' 'ITSO' '' 'STATUS' 'STATUS' '' ''.
    refresh t_event.
    *perform set_top_page_heading using t_heading t_event.
    REPID = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_CALLBACK_TOP_OF_PAGE = ' '
    I_CALLBACK
    I_CALLBACK_HTML_TOP_OF_PAGE = 'TOP'
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = ' '
    I_GRID_TITLE =
    I_GRID_SETTINGS =
    IS_LAYOUT =
    IT_FIELDCAT = F1
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
    IT_EVENTS = GT_EVENTS[]
    IT_EVENT_EXIT =
    IS_PRINT =
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    IT_ALV_GRAPHICS =
    IT_ADD_FIELDCAT =
    IT_HYPERLINK =
    I_HTML_HEIGHT_TOP =
    I_HTML_HEIGHT_END =
    IT_EXCEPT_QINFO =
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    T_OUTTAB = ITSO
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2
    ENDFORM. " LAYOUT
    *& Form FCAT
    FORM FCAT USING P_FIELD P_TABLE P_SUM P_TEXT P_RFIELD P_RTABLE P_DISP.
    ADD 1 TO POS.
    F2-COL_POS = POS.
    F2-FIELDNAME = P_FIELD.
    F2-TABNAME = P_TABLE.
    F2-SELTEXT_L = P_TEXT.
    F2-REF_FIELDNAME = P_RFIELD.
    F2-REF_TABNAME = P_RTABLE.
    F2-DO_SUM = P_SUM.
    F2-NO_OUT = P_DISP.
    APPEND F2 TO F1.
    CLEAR F2.
    ENDFORM. " FCAT
    FORM F_BUILD_EVENTCAT .
    CLEAR: GT_EVENTS. REFRESH: GT_EVENTS.
    CLEAR: FS_EVENTCAT.
    FS_EVENTCAT-NAME = 'TOP_OF_PAGE'.
    FS_EVENTCAT-FORM = 'F_REPORT_HEADER_ALV'.
    APPEND FS_EVENTCAT TO GT_EVENTS.
    CLEAR: FS_EVENTCAT.
    FS_EVENTCAT-NAME = 'END_OF_LIST'.
    FS_EVENTCAT-FORM = 'F_WRITE_SUMMARY'.
    APPEND FS_EVENTCAT TO GT_EVENTS.
    ENDFORM.
    *FORM F_REPORT_HEADER_ALV.
    *CALL FUNCTION 'Z_HEAD_PRINT'
    EXPORTING
    WRITE: / TITLE1 = 'XYZ Limited'
    TITLE2 = 'Sales Order Report'
    TITLE3 = 'Created on '
    COLOR = 'X'.
    *ENDFORM.
    FORM F_WRITE_SUMMARY .
    write:/ 'Welcome to XYZ Limited'.
    write:/ 'This is a test program to display Report in ALV Format'.
    ENDFORM.
    FORM TOP.
      DATA: WT_HEADER TYPE SLIS_T_LISTHEADER,
            WA_HEADER TYPE SLIS_LISTHEADER.
    CONCATENATE 'DATE:-' SY-DATUM INTO FDATE.
    CONCATENATE 'TIME:-' SY-UZEIT INTO FTIME.
    FNAME = 'NAME:- TEST'.
      WA_HEADER-TYP = HEADER.
      WA_HEADER-INFO = FNAME.
      APPEND WA_HEADER TO WT_HEADER.
      CLEAR WA_HEADER.
      WA_HEADER-TYP = HEADER.
      WA_HEADER-INFO = FDATE.
      APPEND WA_HEADER TO WT_HEADER.
      CLEAR WA_HEADER.
      WA_HEADER-TYP = HEADER.
      WA_HEADER-INFO = FTIME.
      APPEND WA_HEADER TO WT_HEADER.
      CLEAR WA_HEADER.
    ENDFORM.                   
    *& Form set_top_page_heading
    text
    -->P_T_HEADING text
    *form set_top_page_heading using t_heading
    t_events type slis_t_event.
    *data: x_heading type slis_listheader,
    x_event type line of slis_t_event.
    Report title
    clear t_heading[].
    clear x_heading.
    x_heading-typ = 'H'.
    x_heading-info = ''(001).
    append x_heading to t_heading.
    t_heading-info = 'TEST'.
    t_heading-typ = 'H'.
    Program name
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'Program: '.
    x_heading-info = sy-repid.
    append x_heading to t_heading.
    User who is running the report
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'User: '.
    x_heading-info = sy-uname.
    append x_heading to t_heading.
    Date of execution
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'Date: '.
    write sy-datum to x_heading-info.
    append x_heading to t_heading.
    Time of execution
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'Time: '.
    write sy-uzeit to x_heading-info.
    append x_heading to t_heading.
    Top of page event
    x_event-name = slis_ev_top_of_page.
    x_event-form = 'TOP_OF_PAGE'.
    append x_event to t_events.
    *endform. " set_top_page_heading
    *please do reward points if helpful
    Thanks and Regards,
    S.N.Venkatesh

  • Re: URGENT: REGARDING ALV REPORT

    hi,
    i am making dis report :-
    TABLES : VBAK,ABAP,VBEP,VBKD,MARA,KNA1,MAKT.
    *Varriable declaration.
    TYPE-POOLS SLIS.
    DATA : POS TYPE I.
    DATA REPID LIKE SY-REPID.
    DATA : F1 TYPE SLIS_T_FIELDCAT_ALV,
    F2 TYPE SLIS_FIELDCAT_ALV,
    L_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA L_POS TYPE I VALUE 1. "position of the column
    DATA GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    **DATA GT_SORT TYPE SLIS_T_SORTINFO_ALV.
    DATA: GT_EVENTS TYPE SLIS_T_EVENT,
    FS_EVENTCAT LIKE LINE OF GT_EVENTs.
    INTERNAL TABLE FOR SALES ORDER *****************
    DATA : BEGIN OF ITSO OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    ERDAT LIKE VBAK-ERDAT,
    BSTNK LIKE VBAK-BSTNK,
    KUNNR LIKE VBAK-KUNNR,
    MATNR LIKE VBAP-MATNR,
    POSNR LIKE VBAP-POSNR,
    WMENG LIKE VBEP-WMENG,
    NTGEW LIKE MARA-NTGEW,
    BRGEW LIKE MARA-BRGEW,
    GEWEI LIKE MARA-GEWEI,
    SPART LIKE VBAK-SPART,
    BMENG LIKE VBEP-BMENG,
    EDATU LIKE VBEP-EDATU,
    BSTKD LIKE VBKD-BSTKD,
    WERKS LIKE VBAP-WERKS,
    MEINS LIKE MARA-MEINS,
    KWMENG LIKE VBAP-KWMENG,
    KLMENG LIKE VBAP-KLMENG,
    END OF ITSO.
    Heading of the report.
    data: t_heading type slis_t_listheader.
    ***********PARAMETERS***************
    PARAMETERS : PLANT LIKE VBAP-WERKS OBLIGATORY.
    *********SELECTION SCREEN OPTIONS*********
    SELECT-OPTIONS : SO_ORD FOR VBAK-VBELN,
    SO_PARTY FOR VBAK-KUNNR,
    IT_M FOR MARA-MATNR,
    DIV FOR VBAK-SPART,
    SO_DATE FOR VBAK-ERDAT,
    S_DATE FOR VBEP-EDATU. .
    START-OF-SELECTION.
    SELECT DISTINCT AVBELN AERDAT ABSTNK AKUNNR BSPART BMATNR BPOSNR BWERKS BKWMENG BKBMENG CNTGEW CBRGEW CGEWEI DWMENG DBMENG DEDATU D~VBELN
    FROM VBAK AS A INNER JOIN VBAP AS B ON BVBELN = AVBELN
    INNER JOIN MARA AS C ON CMATNR = BMATNR
    INNER JOIN VBEP AS D ON DWMENG > 0 AND DVBELN = AVBELN AND DPOSNR = B~POSNR
    INTO CORRESPONDING FIELDS OF TABLE ITSO
    WHERE AVBELN IN SO_ORD AND AKUNNR IN SO_PARTY AND BSPART IN DIV AND AERDAT IN SO_DATE AND DEDATU IN S_DATE AND BMATNR IN IT_M AND B~WERKS = PLANT.
    IF SY-SUBRC <> 0.
    MESSAGE E899(M3) WITH 'No records'.
    ENDIF.
    perform f_build_eventcat.
    PERFORM LAYOUT.
    END-OF-SELECTION.
    FORM LAYOUT.
    PERFORM FCAT USING 'WERKS' 'ITSO' '' 'PLANT  '  'WERKS' 'VBAP' ''.
    PERFORM FCAT USING 'VBELN' 'ITSO' '' 'S.O.NO. ' 'VBELN' 'VBAK' ''.
    PERFORM FCAT USING 'ERDAT' 'ITSO' '' 'S.O.DATE' 'ERDAT' 'VBAK' ''.
    PERFORM FCAT USING 'BSTNK' 'ITSO' '' 'P.O.N.O'  'BSTNK' 'VBAK' ''.
    PERFORM FCAT USING 'KUNNR' 'ITSO' '' 'PARTY '   'KUNNR' 'VBAP' ''.
    PERFORM FCAT USING 'MATNR' 'ITSO' '' 'MAT.NO.'  'MATNR' 'MARA' ''.
    PERFORM FCAT USING 'WMENG' 'ITSO' '' 'S.O.QTY'  'WMENG' 'VBEP' ''.
    REPID = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                =
      I_BUFFER_ACTIVE                   = ' '
      I_CALLBACK_PROGRAM                = REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
      IT_FIELDCAT                       = F1
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         = GT_EVENTS[]
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_ADD_FIELDCAT                   =
      IT_HYPERLINK                      =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
      IT_EXCEPT_QINFO                   =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
    TABLES
       T_OUTTAB                          = ITSO
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
    ENDFORM. " LAYOUT
    *& Form FCAT
    FORM FCAT USING P_FIELD P_TABLE P_SUM P_TEXT P_RFIELD P_RTABLE P_DISP.
    ADD 1 TO POS.
    F2-COL_POS = POS.
    F2-FIELDNAME = P_FIELD.
    F2-TABNAME = P_TABLE.
    F2-SELTEXT_L = P_TEXT.
    F2-REF_FIELDNAME = P_RFIELD.
    F2-REF_TABNAME = P_RTABLE.
    F2-DO_SUM = P_SUM.
    F2-NO_OUT = P_DISP.
    APPEND F2 TO F1.
    CLEAR F2.
    ENDFORM. " FCAT
    FORM F_BUILD_EVENTCAT .
    CLEAR: GT_EVENTS. REFRESH: GT_EVENTS.
    CLEAR: FS_EVENTCAT.
    FS_EVENTCAT-NAME = 'TOP_OF_PAGE'.
    FS_EVENTCAT-FORM = 'F_REPORT_HEADER_ALV'.
    APPEND FS_EVENTCAT TO GT_EVENTS.
    CLEAR: FS_EVENTCAT.
    FS_EVENTCAT-NAME = 'END_OF_LIST'.
    FS_EVENTCAT-FORM = 'F_WRITE_SUMMARY'.
    APPEND FS_EVENTCAT TO GT_EVENTS.
    ENDFORM. " F_BUILD_EVENTCAT
    and i want to add dis code: -
    DATA: B_QTY TYPE P LENGTH 7 DECIMALS 3,
               B_GR_W TYPE P LENGTH 5 DECIMALS 3,
               B_NT_W TYPE P LENGTH 5 DECIMALS 3,
               ITEM_NTW TYPE P LENGTH 5 DECIMALS 3,
               ITEM_GRW TYPE P LENGTH 5 DECIMALS 3,
               ITEM_DISP TYPE P LENGTH 5 DECIMALS 3,
               CNT(5) TYPE N.
    CNT = 0.
    DATA : V_SOSTAT TYPE C,
           V_NETWT LIKE MARA-NTGEW,
           V_GRWT LIKE MARA-BRGEW,
           V_DESPQTY TYPE P LENGTH 5 DECIMALS 3,
           V_TSONWT TYPE P LENGTH 5 DECIMALS 3,
           V_TSOGWT TYPE P LENGTH 5 DECIMALS 3,
           V_TSINWT TYPE P LENGTH 5 DECIMALS 3,
           V_TBALNWT TYPE P LENGTH 5 DECIMALS 3,
           V_TBALGWT TYPE P LENGTH 5 DECIMALS 3.
    V_TSONWT = 0.
    V_TSOGWT = 0.
    V_TSINWT = 0.
    V_TBALNWT = 0.
    V_TBALGWT = 0.
    *LOOP AT ITSO.
    loop at t_data.
       if t_data-bmeng = 0.
         V_SOSTAT = 'A'.
          ELSEIF t_data-WMENG <> t_data-BMENG.
              V_SOSTAT = 'B'.
    ELSE.
      V_SOSTAT = 'C'.
    ENDIF.
    if ( PEND = 'X' AND ( V_SOSTAT = 'A' OR V_SOSTAT = 'B' ) ) OR ( UNTC = 'X' AND V_SOSTAT = 'A' ) OR ( COMP = 'X' AND V_SOSTAT = 'C' ) OR ALL_E = 'X'.
       CNT = CNT + 1.
    IF ITSO-BMENG = 0.
    if wa_data-bmeng = 0.
       V_SOSTAT = 'A'.
    ELSEIF ITSO-WMENG <> ITSO-BMENG.
       V_SOSTAT = 'B'.
    ELSE.
       V_SOSTAT = 'C'.
    ENDIF.
    if ( PEND = 'X' AND ( V_SOSTAT = 'A' OR V_SOSTAT = 'B' ) ) OR ( UNTC = 'X' AND V_SOSTAT = 'A' ) OR ( COMP = 'X' AND V_SOSTAT = 'C' ) OR ALL_E = 'X'.
       CNT = CNT + 1.
       SELECT SINGLE MAKTX FROM MAKT INTO V_ITEM WHERE MATNR = ITSO-MATNR.
       SELECT SINGLE NAME1 FROM KNA1 INTO V_ADDR WHERE KUNNR = ITSO-KUNNR.*
       IF ITSO-GEWEI = 'G'.
         V_NETWT = ITSO-NTGEW / 1000.
         V_GRWT = ITSO-BRGEW / 1000.
       ELSEIF ITSO-GEWEI = 'KG'.
         V_NETWT = ITSO-NTGEW.
         V_GRWT = ITSO-BRGEW.
       ELSEIF ITSO-GEWEI = 'TO'.
         V_NETWT = ITSO-NTGEW * 1000.
         V_GRWT = ITSO-BRGEW * 1000.
       ENDIF.
       V_DESPQTY = ITSO-BMENG.
       ITEM_NTW = V_NETWT * ITSO-WMENG / 1000.
       ITEM_GRW = V_GRWT * ITSO-WMENG / 1000.
       ITEM_DISP = V_NETWT * V_DESPQTY / 1000.
       B_QTY = ITSO-WMENG - V_DESPQTY.
       B_NT_W = V_NETWT * B_QTY / 1000.
       B_GR_W = V_GRWT * B_QTY / 1000.
    HOW CAN I DISPLAY IT is a calculation stored in d variable.
    providing dis solution to dis problem will b rewarded....

    take a marker and write calculation....!!!!
    waiting for reward point.........

  • Help needed regarding ALV report

    Hi,
    I have a query regarding ALV report.
    The requirement is as follows:-
    When the user executes the ALV report and if he sums one numeric field column values and filters out some of the field columns ( for example there r 5 columns in the report and the user has filtered out 2 of them and viewing only 3 columns)
    and now the requirements is that when the user runs the report later he should see the modified report ( i mean only 3 cloumns and the total value of the column which he has made) but not the original output which was there when the report was developed.
    First of all i wanna know is it possible to do r not. If yes then how
    Hope u have got what i want.
    eagerly waiting for ur reply.
    regards,
    maqsood

    Hi
    Yes you can! You have to manage the layout variant.
    So when you call your ALV you have to set the parameter I_SAVE = 'A'.
    In this way you'll allow the user to save the variants for layout.
    After you has to have a chance to choose the variant in selection-screen.
    See the demo program BCALV_GRID_11 to manage the variant in selection-screen.
    Max

  • ALV Report displays space instead of '0.00' for qty field. why?

    Hello friends,
    I am facing a problem to display 0 value for the field
    field - ZZQTY (Predefined Type at Domain level)
         QUAN 21,2
    In the program I am clearing the field and I can see its value as 0.00 while debugging.
    As soon as field ZZQTY is displayed on ALV, it becomes blank (Space).
    My requirement is to display '0.00' on ALV report.
    What should I do?
    Regards,
    Ronny Hanks

    Hello
    Search for
    LS_FIELDCAT-NO_ZERO = 'X'.
    for this field in programm and comment this.

  • Hi experts 1 query regarding alv report running in background

    when i run my alv report with 40 columns in background in spool when i get output disturbed 20 lines of first row is moving to second row so when i download to excel the o/p is completely disturbed and no use for me is there any way to solve this problem.please reply

    hi ,
    this will solve your problem
    http://www.****************/Tutorials/ALV/Spool/width.htm
    Increasing the width of the spool when using ALV List
    By Aafaque Husain, YASH Technologies
    Whenever an ALV report (with more number of columns) is scheduled in background, the output will be displayed in a zigzag fashion as shown below:  
    If we try to download the output from the spool or try to view the output, then we observe that the output is not in an appropriate fashion.  
    To get the right format of output in the spool we generally increase the u201Cno. of columns fieldu201D in the Format typesu201D. Have a look at the following screenshot:   
    Sometimes even when we change this field, we get the output truncated at the end, like last few columns are not displayed. There is certain limitation for this field, so that even if increase this value again, we find no change in the output display in spool. 
    This value is effective only when we check the check box u201CNumber of columns from list display formatu201D in the SPAD transaction.
    Ø       GO to SPAD Transaction code
    Ø       In the menu Settings -> Spool System as shown belowu2026
    Ø       In the others tab check the first check box in the Output Controller block, SAVE and exit.
    Now Schedule the ALV report again by providing the output device and format, and then we get the full output in the spool as shown below: 
    Regards,
    Madhavi

  • ALV GRID DISPLAY -Problem with Layout

    Hi,
    I'm using ALV GRID DISPLAY. I ran the program and in the output i created a layout Test1.Later i created a layout Test2. Now when i run the report, when i select layout Test1, the display is not as selected for the layout. but when i manualy select the layout throu change layout-->Test1, the display is working good. Can someone tell me what the problem can be?
    Thanks
    Challa

    hi,
    in the FM have you filled the structure IS_VARIANT.
    is_variant-report = sy-repid.
    is_variant-variant = <variant name>.
    Regards,
    Leo

  • ALV Report - displaying column name in two fields.

    Dear All,
                 I am working on ALV report , report is ready but now i have to format it according to client requirment, in which have to show column name in two row like.
    supppose there is field by name
    "Date of receipt of processed Goods"
    can i display it like
    "Date of receipt of
    processed Goods "
    Assured points for suitable answer.
    Looking foward to your response.
    Best Regards,
    Gulrez Alam

    Hi Ellery,
    As Philipp said, there is no need for populating the field using PL/SQL. You would just need to go to the Paper Layout in the Reports Editor, click on "Text" in the Drawing toolbar, drag it to the appropriate place in your layout to create the field, and write what you want in that field. Below that, you can create the field(s) which will display the actual totals. I'm assuming that creating the totals field is not a problem.
    Navneet.

  • Issue regarding ALV report

    Hi all,
             I've created an ALV report which is having a editable checkbox box field and some more fields that are not editable.
    My requirement is that when i check any checkbox, some of the fields in that particular row should become editable.
    In table control it can be done easily but can it be done in ALV.
    Note: I have created the ALV through container as it was required.
    Thanks in Advance.
    Regards
    Dheeraj

    Hi,
    Basically you will have to first register the data change event after you display the grid as follows:-
        CALL METHOD y_lobj_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>MC_EVT_MODIFIED
          EXCEPTIONS
            error      = 1
            OTHERS     = 2.
    Here Y_LOBJ_GRID is my grid object of type CL_GUI_ALV_GRID.
    Then you will have to set a handler method for this.
       SET HANDLER y_obj_evt_handler->y_m_handle_cell_modified
        FOR Y_LOBJ_GRID.
    Here y_obj_evt_handler is a local class in your program and y_m_handle_cell_modified is the method of that class.
    In this method you can change the fields to make then editable or non editable.
    Regards,
    Ankur Parab

  • ALV Report Displaying QUAN field different in systems

    Hi Guys,
    I have a field of type QUAN (quantity) on an ALV report that is displaying differently on the Devlopment and QA systems.
    If I enter the value '5' in this field in Development and press enter, the value displays as '5.000'.  If I enter the value in the QA field, however, the value displayes as '0.005'.
    I have looked at domains and everything, but they seem simmilar.
    Please advise fi there is something I have overlooked,
    Thank you,
    Christiaan

    Hi,
    Check in system default parameter settings. It works based on system default parameter settings.
    System => User Profile => Own Data
    In *Defaults* tab check the *Decimal Notaion* field.
    Regards,
    Shankar.

  • Help regarding alv report

    i need to develop alv report which displays po and corresponding invoice receipt information.
    what all  fields can i include in invoice receipt information.please help on this.thanks in advance.credit will be given.

    Hi,
    Check the following link:
    http://www.sapbrain.com/TUTORIALS/TECHNICAL/ALV_tutorial.html
    http://www.sapbrain.com/ARTICLES/TECHNICAL/ABAP/company%20logo%20in%20the%20top%20of%20alv%20report.html
    Regards,
    Bhaskar

  • Re: Regarding ALV report

    Hi experts,
    Please help me out as i am new to abap.My problem is how to create a an ALV Report that will show the details of order like order no, order date, customer, product code & description, order quantity and value along with the details of dispatch of those orders like invoice no, invoice date, invoice quantity and pending order quantity.
    Replies will be highly appreciated.
    Thanks,
    Pankaj

    Hi,
    Have a look on the following ALV Grid report.Later find the fields and tables for your requirement.
    Use that fields and tables in this report.
    Follow the below step for uploading the image file:
    Steps for uploading Logo :-:
    1. Goto the transaction OAER
    2. Enter the class name as 'PICTURES'
    3. Enter the class type as 'OT'
    4. Enter the object key as the name of the logo(e.g. tripodsm.gif) you wish to give
    5. Execute
    6. Then in the new screen select Standard doc. types in bottom window
    Click on the Screen icon
    Now, it will ask for the file path where you have to upload the logo
    7. Now you can use this logo in REUSE_ALV_COMMENTARY_WRITE
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = i_header
    i_logo = 'tripodsm.gif'.
    TABLES VBAK.
    TYPE-POOLS SLIS.
    Data Declaration
    TYPES: BEGIN OF T_VBAK,
          VBELN TYPE VBAK-VBELN,
          ERDAT TYPE VBAK-ERDAT,
          ERNAM TYPE VBAK-ERNAM,
          AUDAT TYPE VBAK-AUDAT,
          VBTYP TYPE VBAK-VBTYP,
          NETWR TYPE VBAK-NETWR,
          VKORG TYPE VBAK-VKORG,
          VKGRP TYPE VBAK-VKGRP,
          LINE_COLOR(4) TYPE C,
          END OF T_VBAK.
    DATA: IT_VBAK TYPE STANDARD TABLE OF T_VBAK INITIAL SIZE 0,
          WA_VBAK TYPE T_VBAK.
    ALV Data Declaration
    DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
          GD_REPID TYPE SY-REPID.
    START-OF-SELECTION.
    PERFORM DATA_RETRIEVAL.
    PERFORM BLD_FLDCAT.
    PERFORM BLD_LAYOUT.
    PERFORM DISPLAY_ALV_REPORT.
    Build Field Catalog for ALV Report
    FORM BLD_FLDCAT.
    FLDCAT-FIELDNAME = 'VBELN'.
    FLDCAT-SELTEXT_M = 'Sales Document'.
    FLDCAT-COL_POS = 0.
    *FLDCAT-EMPHASIZE = 'C411'.
    FLDCAT-OUTPUTLEN = 20.
    FLDCAT-KEY = 'X'.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'ERDAT'.
    FLDCAT-SELTEXT_L = 'Record Date created'.
    FLDCAT-COL_POS = 1.
    FLDCAT-KEY = 'X'.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'ERNAM'.
    FLDCAT-SELTEXT_L = 'Cteated Object Person Name'.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'AUDAT'.
    FLDCAT-SELTEXT_M = 'Document Date'.
    FLDCAT-COL_POS = 3.
    FLDCAT-EMPHASIZE = 'C110'.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'VBTYP'.
    FLDCAT-SELTEXT_L = 'SD Document category'.
    FLDCAT-COL_POS = 4.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'NETWR'.
    FLDCAT-SELTEXT_L = 'Net Value of the SO in Document Currency'.
    FLDCAT-COL_POS = 5.
    FLDCAT-OUTPUTLEN = 60.
    FLDCAT-DO_SUM = 'X'.
    FLDCAT-DATATYPE = 'CURR'.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'VKORG'.
    FLDCAT-SELTEXT_L = 'Sales Organization'.
    FLDCAT-COL_POS = 6.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    FLDCAT-FIELDNAME = 'VKGRP'.
    FLDCAT-SELTEXT_M = 'Sales Group'.
    FLDCAT-COL_POS = 7.
    FLDCAT-EMPHASIZE = 'C801'.
    APPEND FLDCAT TO FLDCAT.
    CLEAR FLDCAT.
    ENDFORM.
    Build Layout for ALV Grid Report
    FORM BLD_LAYOUT.
    GD_LAYOUT-NO_INPUT = 'X'.
    GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    GD_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
    GD_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.
    GD_LAYOUT-CONFIRMATION_PROMPT = 'X'.  “ This asks the confirmation    
                                       before leaving the screen.
    ENDFORM.
    Display report using ALV grid
    FORM DISPLAY_ALV_REPORT.
    GD_REPID = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = GD_REPID
       IS_LAYOUT                         = GD_LAYOUT
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
       I_GRID_TITLE                      = 'SALES DOCUMENT HEADER'
       IT_FIELDCAT                       = FLDCAT[]
       I_SAVE                            = 'X'
      TABLES
        T_OUTTAB                          = IT_VBAK
    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.
    Retrieve data from VBAK table and populate itab IT_VBAK
    FORM DATA_RETRIEVAL.
    DATA LD_COLOR(1) TYPE C.
    SELECT VBELN ERDAT ERNAM AUDAT VBTYP NETWR VKORG
    UP TO 20 ROWS
    FROM VBAK
    INTO TABLE IT_VBAK.
    LOOP AT IT_VBAK INTO WA_VBAK.
    LD_COLOR = LD_COLOR + 1.
    IF LD_COLOR = 8.
      LD_COLOR = 1.
    ENDIF.
    CONCATENATE 'C' LD_COLOR '10' INTO WA_VBAK-LINE_COLOR.
    MODIFY IT_VBAK FROM WA_VBAK.
    ENDLOOP.
    ENDFORM.
    FORM TOP_OF_PAGE.
    DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
          W_HEADER TYPE SLIS_LISTHEADER.
    W_HEADER-TYP = 'H'.
    W_HEADER-INFO = 'WELCOME HEADER LIST'.
    APPEND W_HEADER TO T_HEADER.
    W_HEADER-TYP = 'S'.
    W_HEADER-KEY = 'REPORT:'.
    W_HEADER-INFO = SY-REPID.
    APPEND W_HEADER TO T_HEADER.
    W_HEADER-TYP = 'S'.
    W_HEADER-KEY = 'DATE:'.
    CONCATENATE SY-DATUM6(2) ' / ' SY-DATUM4(2) ' / ' SY-DATUM(4) INTO W_HEADER-INFO.
    APPEND W_HEADER TO T_HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = T_HEADER
        I_LOGO          = ‘TRIPODSM.GIF’.     
    ENDFORM.
    Reward,if useful.
    Thanks,
    Chandu

  • Regarding ALV report heading

    Hi to all
    I am preparing a ALV report.
    In which I want to display the values which are entered on selection screen.
    On the selection screen these are the fields :
    s_werks for pa0001-werks
    s_orgeh for pa0001-orgeh
    I am successful to capture one value (s_orgeh-low) but if multiple values are selected then how to display.
    Plz guide me...

    Hi,
    try like this..in the belwo code first FM captures the selection screen fields and the second function mdoule dispalys them in the output.
    DATA :
    Internal table for Selection screen parameters
           i_seltable   TYPE STANDARD TABLE OF rsparams.
    *&      Form  get_selection_screen
      Subroutine to get the user selection on selection screen
    FORM get_selection_screen .
      CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
        EXPORTING
          curr_report     = sy-repid
        TABLES
          selection_table = i_seltable
        EXCEPTIONS
          not_found       = 01
          no_report       = 02.
      IF sy-subrc NE 0.
        REFRESH i_seltable.
      ENDIF.
    ENDFORM.                    " get_selection_screen
    *&      Form  display_selection_criteria
    Subroutine to display the selction criteria in the output
    FORM display_selection_criteria .
      CALL FUNCTION 'RS_LIST_SELECTION_TABLE'
        EXPORTING
          report        = sy-repid
          seltext       = c_x
          newpage       = space
        TABLES
          sel_tab       = i_seltable
        EXCEPTIONS
          sel_tab_empty = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
        REFRESH i_seltable.
      ENDIF.
    ENDFORM.                    " display_selection_criteria
    Regards,
    Nagaraj

Maybe you are looking for

  • No sound in file import by iMovie 2013 (version 10.0.2)

    Hello, When I import video File, there is no sound in iMovie 2013 (version 10.0.2) My camera is a sony cam with hdd (model DCR-SR 190E). It's a compatible camera (sony dcr-sr 100 is same model) The same import in iMovie 9.0.9 have no problem. The sou

  • Different views in "Personnel Data" tab for a withdrawn personnel number

    Hi, In PA20 one user can see the ticks for "Actions, Organizational Assignment & Personal Data" in "Personnel Data" tab for a personnel number which has been withdrawn. But another user can see tick only for "Organizational Assignment" in "Personnel

  • Multi dimensional arrays and table indicators

    I'm wondering how I can write a string array with more than two dimensions to a table. Specifically what I want to do is this: I am currently writing a 2d array to the table. Column 1 consists of the channel names from my DAQmx task and Column two is

  • # of dimensions

    Hi all,I have a cube (1) with 12 dimensions and the block size is 361648. I created another cube (2) and merged 2 sparse dimensions so I have 11 dimensions in the cube but the interesting part is that my block size is still the same 361648. Can someo

  • Problem Optimizing a PDF

    In the process of optimizing a PDF I received an error from Acrobat Pro 9. The error reads "an error was encountered while removing structure information". I am working in OS X 10.10.1. I have not been able to figure out what is causing this error, I