ALV list display in a Background job - Spool output

Hi,
We are currently working on a report scheduled to be run in the background job, and the ALV list is displayed in the spool output.
ALV list in the spool does not look the same as front run job, the column headers are all crowded together, and there is no grid in-between different columns or rows. It's hard to read.
Is there a way to add grid for this kind of output?
Thanks!

Hi Deepak:
I expanded your report into two rows display, and the grid in the spool display simply gone!
report zzscratch line-size 120 no standard page heading.
type-pools slis.
tables pa0001.
data : li_field type standard table of slis_fieldcat_alv,
gi_events type standard table of slis_alv_event,
gr_layout_bck type slis_layout_alv,
gr_save like disvariant,
gr_events type slis_alv_event.
types : begin of gtt_emp,
pernr type persno,
ename  like pa0001-ename,
uname  like pa0001-UNAME,
end of gtt_emp.
data : lr_field type slis_fieldcat_alv.
data : lc_rep like syst-repid.
data : li_emp type standard table of gtt_emp,
lr_emp type gtt_emp.
data : gv_ref_table type lvc_rtname.
gv_ref_table = 'CATSDB'.
lr_field-fieldname = 'PERNR'.
lr_field-ref_tabname = gv_ref_table.
lr_field-inttype = 'N'.
lr_field-outputlen = 8.
lr_field-seltext_l = 'EMPLOYEE Number'.
append lr_field to li_field.
lr_field-fieldname = 'ENAME'.
lr_field-ref_tabname = 'PA0001'.
lr_field-inttype = 'C'.
lr_field-outputlen = 40.
lr_field-seltext_l = 'EMPLOYEE Name'.
append lr_field to li_field.
lr_field-fieldname = 'UNAME'.
lr_field-ref_tabname = 'PA0001'.
lr_field-inttype = 'C'.
lr_field-outputlen = 12.
lr_field-seltext_l = 'User Name'.
lr_field-row_pos = 2.
lr_field-col_pos = 1.
append lr_field to li_field.
lc_rep = sy-repid.
gr_layout_bck-edit_mode = 'D'.
gr_save-report = sy-repid.
lr_emp-pernr = '00000001'.
lr_emp-ename = 'abc'.
lr_emp-uname = 'testus'.
append lr_emp to li_emp.
lr_emp-pernr = '00000002'.
lr_emp-ename = 'def'.
append lr_emp to li_emp.
lr_emp-pernr = '00000003'.
append lr_emp to li_emp.
lr_emp-pernr = '00000004'.
append lr_emp to li_emp.
lr_emp-pernr = '00000005'.
append lr_emp to li_emp.
lr_emp-pernr = '00000006'.
append lr_emp to li_emp.
lr_emp-pernr = '00000007'.
append lr_emp to li_emp.
lr_emp-pernr = '00000008'.
append lr_emp to li_emp.
end-of-selection.
Function module for ALV grid display
  call function 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_buffer_active    = 'X'
            i_callback_program = lc_rep
            is_layout          = gr_layout_bck
            it_fieldcat        = li_field
            i_save             = 'A'
            is_variant         = gr_save
            it_events          = gi_events
       TABLES
            t_outtab           = li_emp[]
       EXCEPTIONS
            program_error      = 1
            others             = 2.
  if sy-subrc <> 0.
clear gr_messages.
message e023 into gr_messages.
append gr_messages to gi_messages.
  endif.

Similar Messages

  • Background job - Spool output screwed up.

    Hi Friends,
    i am running a report in background and i have 40 to 50 columns as a result the output of the back ground job spool output does not show in one lone but as soon as it reaches to the certain point it splits the line and shows one line as as two...
    what could be the problem?
    thank you,
    pasala.

    Check
    In your report
    -  [REPORT - list_options|http://help.sap.com/abapdocu_70/de/ABAPREPORT_LIST_OPTIONS.htm] [LINE-SIZE width|http://help.sap.com/abapdocu_70/de/ABAPREPORT_LIST_OPTIONS.htm#&ABAP_ADDITION_2@2@]
    - [NEW-PAGE|http://help.sap.com/abapdocu_70/en/ABAPNEW-PAGE.htm] [LINE-SIZE width |http://help.sap.com/abapdocu_70/en/ABAPNEW-PAGE_OPTIONS.htm#&ABAP_ADDITION_4@4@]
    In print parameter of the step/job
    - [SUBMIT - spool_options |http://help.sap.com/abapdocu_70/en/ABAPSUBMIT_PRINT_PARAMETERS.htm] [SPOOL PARAMETERS pri_params|http://help.sap.com/abapdocu_70/en/ABAPSUBMIT_PRINT_PARAMETERS.htm#&ABAP_ADDITION_1@1@] or [LINE-SIZE width |http://help.sap.com/abapdocu_70/en/ABAPSUBMIT_LIST_OPTIONS.htm#&ABAP_ADDITION_1@1@]
    Also read [Printing Lists |http://help.sap.com/abapdocu_70/en/ABENPRINT.htm] and [SET_PRINT_PARAMETER|http://www.sdn.sap.com/irj/scn/advancedsearch?query=set_print_parameters] for LAYOUT and LINE_SIZE parameters.
    Regards,
    Raymond

  • Background Job spool / output file in different app server

    We are working with 2 ECC app servers, A and B.
    I've defined in app server A a background job to run an abap report and this report creates and submit 4 other background jobs.
    Each of these 4 jobs is regarding an abap report which outputs a text file in the server.
    The question is, why are the jobs generating the files in different app servers randomically?
    The same file, in the 1st execution was generated in app server A, and without any change was generated in app server B, in the job 2nd execution?
    Thank you!

    Hi,
    You can specify server name whille creating a batch job , so that it gets executed to that server only.
    there is one field (in SM36 during creation or SM37 while modifying batch job) called "Exec Target " , where you can specify server name.
    Hence you can plan to run your some batch jobs on server A or B.
    Regards,
    Rupali

  • How to send the alv list display to spool

    Hi all,
    I am executing a program in foreground. My requirement is sending alv list output to spool. When i execute the smae program in background mode the SAP is handling the spool output in hierarchial list display. How to get the same output in foreground also.
    Thanks and Regards,
    Vijay.

    Hi max,
    I think my question is not clear.
    when I execute my report in background mode, I can able to see the output in the spool.
    But when I execute the same report in foreground no spool output is getting generated.
    To handle this I am calling some function modules like RSPO_OPEN_SPOOLREQUEST , RSPO_WRITE_SPOOLREQUEST,  RSPO_WRITE_SPOOLREQUEST. But by using this i cannot able to get the desired output in alv list display format. what to do to get my desired output.
    Thanks and Regards,
    Vijay.

  • Send/export the background job spool in Excel (in MHTML format) in ECC 6.0.

    Hello All,
    I have a requirement to send/export the background job spool in Excel (in MHTML format) in ECC 6.0. Please help.
    Thank you.
    Nalini

    Hi Jigar,
    Thanks for your response.
    Anything is like download to desktop or email is fine. But in MHTML format.
    We can download the ALV report in MHTML spreadsheet format when we run the program online. But the program is running for long time and going to dump.
    So i scheduled it as background job and downloading the output in  .HTML format. But user wants the spool/report output in .MHTML spreadsheet format.
    I can write the code. Instead of changing the existing program I would like to know is there any way (from standard SAP) that I can get the background spool in MHTML spreadsheet format.
    Thanks,
    Nalini

  • Hide delete option is not working in ALV List  Display- urgent

    Hi All,
    In my program i am displaying the output by using alv list display. after displaying the data i am displaying my own pf status here. in this i have few pushbuttons like
    selest all, deselect all, hide . first two options are working fine. when i click hide button selected records are going to be hide.but this is not happening in my program. any body cam send me the code plz.
    i am sending my code below. if possible please modify and resend the code asap.
    my code:
    type-pools : slis.
    tables : zuser_secobjects.
    data : t_header1 like zuser_secobjects.
    data : begin of it_secobjects occurs 0.
            include structure t_header1.
    *data :  box,
           input(1) type c,
    data :   checkbox type c,
            flag type c,
          end of it_secobjects.
    data : wa_ita like line of it_secobjects.
    *data : it_secobjects like zuser_secobjects occurs 0 with header line.
    data : i_field type slis_t_fieldcat_alv with header line.
    data : w_field like line of i_field.
    data : i_sort type slis_t_sortinfo_alv.
    data : w_sort like line of i_sort.
    data : it_filt1 type slis_t_filter_alv with header line.
    data:
    i_tabname type tabname,
    i_repid like sy-repid,
    is_lout type slis_layout_alv.
    data :   it_filt type slis_t_filter_alv   with header line,
             it_evts type slis_t_event        with header line.
    DATA : is_vari type disvariant.
    constants :   c_default_vari value 'X',
                  c_save_vari    value 'U',
                   c_checkfield type slis_fieldname     value 'ACTION',
                   c_f2code     type sy-ucomm           value '&ETA'.
    data : chk_box type slis_fieldname.
    selection-screen: begin of block b1 with frame title text-t01.
    parameters : p_appln type zuser_secobjects-appln.
    parameters : p_user type usr02-bname, "zuser_secobjects-appln_user,
    p_partnr type zuser_secobjects-appln_partner,
    p_ptype type zuser_secobjects-partner_type default '02',
    p_upostn type zuser_secobjects-user_position,
    p_sdate like likp-erdat default sy-datum,
    p_edate(10) default '12/31/9999',
    p_revnum type zuser_secobjects-revnum,
    p_cted type zuser_secobjects-created_by,
    p_cdate type zuser_secobjects-creation_date,
    p_ctime type zuser_secobjects-creation_time,
    p_chnby type zuser_secobjects-changed_by,
    p_cdate1 type zuser_secobjects-changed_date,
    p_ctime1 type zuser_secobjects-changed_time.
    selection-screen: end of block b1.
    form user_command using p_ucomm like sy-ucomm
    rs_selfield type slis_selfield.
    *DATA :   it_filt type slis_t_filter_alv   with header line.
      case p_ucomm.
        when 'SELECT_ALL'. " SELALL is the FCODE of ur push button
          loop at it_secobjects into wa_ita.
            wa_ita-checkbox = 'X'.
            modify it_secobjects from wa_ita.
          endloop.
      rs_selfield-refresh = 'X'.   "<-  ADD THIS
      when 'DESLCT_ALL'.
        loop at it_secobjects into wa_ita.
            wa_ita-checkbox = ' '.
            modify it_secobjects from wa_ita.
          endloop.
      rs_selfield-refresh = 'X'.   "<-  ADD THIS
        is_lout-f2code               = c_f2code.
        is_lout-box_fieldname        = c_checkfield.
        is_lout-get_selinfos         = 'X'.
        is_lout-detail_popup         = 'X'.
        is_lout-detail_initial_lines = 'X'.
    when 'HIDE_DEL'.
          rs_selfield-exit  = 'X'.
          it_filt-fieldname = 'CHECKBOX'.
          it_filt-tabname   = '1'.
          it_filt-valuf     = 'X'.
          it_filt-intlen    = '1'.
          it_filt-inttype   = 'C'.
          it_filt-datatype  = 'CHAR'.
          it_filt-valuf_int = 'X'.
          it_filt-sign0     = 'E'.
          it_filt-optio     = 'EQ'.
          if it_filt[] is initial.
            append it_filt.
          else.
            modify it_filt index 1.
          endif.
         perform display using i_object.
    PERForm  ALV_LIST_DISPLAY.
    WHEN 'SHOW_DEL'.
          rs_selfield-exit = 'X'.
          free it_filt.
    PERForm  ALV_LIST_DISPLAY.
    when 'SAVE1'.
           select * from zuser_secobjects where
                        appln = zuser_secobjects-appln
                  and   appln_partner = zuser_secobjects-appln_partner
                  and   partner_type = zuser_secobjects-partner_type
                  and   start_date = zuser_secobjects-start_date
                  and   end_date = zuser_secobjects-end_date.
          endselect.
          if sy-subrc eq 0.
            message e000(ZV) with 'Duplicate Entry'.
          endif.
      endcase.
    endform.
    *&      Form  delete
    form delete.
      data : begin of is_secobjects occurs 0.
              include structure zuser_secobjects.
      data : checkbox type c.
      data : end of is_secobjects.
      is_secobjects-checkbox = 'X'.
      modify is_secobjects
        from it_secobjects
        transporting checkbox
      where checkbox = 'X'.
    endform.
    *&      Form  get_data
    form get_data.
      select * from zuser_secobjects
      into table it_secobjects.
    endform.                    " get_data
    *&      Form  prepare_fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    form prepare_fieldcatalog.
      clear: w_field,i_field.
      refresh:i_field.
      i_field-key = 'X'.
      i_field-col_pos = 1.
      i_field-ddictxt = 'S'.
      i_field-seltext_s = '@11@'.
      i_field-checkbox = 'X'.
      i_field-input = 'X'.
      i_field-fieldname = 'HEADER'.
      i_field-outputlen = 0.
      append i_field.
      clear i_field.
      w_field-fieldname = 'APPLN'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-seltext_l = text-m01.
      w_field-outputlen = '10'.
      w_field-col_pos = 1.
      append w_field to i_field.
      clear w_field.
      w_field-fieldname = 'APPLN_USER'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-just = 'C'.
      w_field-seltext_l = text-m02.
      w_field-outputlen = '7'.
      w_field-col_pos = 2.
      append w_field to i_field.
      clear w_field.
    endform.                    " prepare_fieldcatalog
    *&      Form  ALV_LIST_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    form alv_list_display.
      i_repid = sy-repid.
      is_lout-box_fieldname = 'CHECKBOX'.
      it_filt-fieldname = 'CHECKBOX'.
      call function 'REUSE_ALV_LIST_DISPLAY'
           exporting
                i_callback_program       = i_repid
                i_callback_pf_status_set = 'PF_STATUS_SET'
                i_callback_user_command  = 'USER_COMMAND'
                is_layout                = is_lout
                it_fieldcat              = i_field[]
                it_filter                = it_filt[]
                 it_events                = it_evts[]
                i_default                = c_default_vari
                i_save                   = c_save_vari
                is_variant               = is_vari
           tables
                t_outtab                 = it_secobjects.
    endform.                    " ALV_LIST_DISPLAY
    *&      Form  display
          text
         -->P_I_OBJECT  text
    form display using    object.
      case object.
    ENDCASE.
    endform.                    " display
    thanks,
    maheedhar.t

    Hi,
    What do you mean by Hiding the records.
    Deleting completely from the screen.
    You can just delete the records from the internal table and pass to field catalog before displaying again.
    or serach in the slis structrue for hiding the contents of the output.
    reward if useful
    regards,
    Anji

  • Issue in ALV List display

    Issue in ALV List display  
    Posted: Apr 5, 2008 10:25 AM     Edit      E-mail this message      Reply 
    Hi Friends,
    Can any one help me out in the logic to display the output in the ALV list.
    i want to get the out put as
    based on the field4 i have to display fieds5, field6 and field 7 values as mentioned below.
    field1 field2 field3 field4 field5 field6 field7
    0L 123 456 2008  001 123.00 456.00
    -    -     -       -     002  213.00 789.00
    -      -       -     003 0.00     0.00
    -      -       -     004 0.00     0.00
    -      -        -    005 0.00     0.00
    -       -       -     006 0.00     0.00
                                   336.00  1245.00
    Thanks,
    Vijay

    for display you have to define fieldcatlaog and use Fm RESUE_ALV_GRID_DISPLAY,
    Go through this program
    *& Report  Z_OPEN_CLOSE                                                *
    REPORT  Z_OPEN_CLOSE MESSAGE-ID YW2 LINE-SIZE 231 LINE-COUNT 45
    NO STANDARD PAGE HEADING.
    Type Declaration *
    TYPE-POOLS SLIS.
    Tables *
    TABLES: MKPF, " Material Document: Header Data
            MSEG, " Material Document: Item Data
            MARA,
            MARD,
            S031,
            EKKO,
            EKPO,
            LIKP,
            MAKT,
            J_1IWRKCUS,
            T001W,
            WB2_V_MKPF_MSEG2,
            MMIM_REP_PRINT,
            YW2_STKMOVEMENTS,
            YPLNT,
            MARDH.
    Internal Tables *
    DATA: I_WERKS LIKE J_1IWRKCUS OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF I_YPLNT OCCURS 0,
             PPLNT LIKE YPLNT-PPLNT,
             WPLNT LIKE YPLNT-WPLNT,
          END OF I_YPLNT.
    DATA: BEGIN OF I_MKPF OCCURS 0,
            MBLNR LIKE MKPF-MBLNR,
            MJAHR LIKE MKPF-MJAHR,
            BUDAT LIKE MKPF-BUDAT,
            VGART LIKE MKPF-VGART,
            BWART LIKE MSEG-BWART,
            MATNR LIKE MSEG-MATNR,
            WERKS LIKE MSEG-WERKS,
            LGORT LIKE MSEG-LGORT,
            MENGE LIKE MSEG-MENGE,
            MEINS LIKE MSEG-MEINS,
            KUNNR LIKE MSEG-KUNNR,
            ZEILE LIKE MSEG-ZEILE,
            XAUTO LIKE MSEG-XAUTO,
            SHKZG LIKE MSEG-SHKZG,
            MATNR1 LIKE MSEG-MATNR,
          END OF I_MKPF.
    DATA: BEGIN OF I_MARDH OCCURS 0,
           WERKS LIKE MARDH-WERKS,
           MEINS LIKE MARA-MEINS,
           MATNR LIKE MARDH-MATNR,
           LGORT LIKE MARDH-LGORT,
           LABST LIKE MARDH-LABST,
           LFGJA LIKE MARDH-LFGJA, "Added -MB
           LFMON LIKE MARDH-LFMON, "Added -MB
           PERIO(6),
           INSME LIKE MARDH-LABST,
           EINME LIKE MARDH-LABST,
           SPEME LIKE MARDH-LABST,
           RETME LIKE MARDH-LABST,
           O_STK LIKE MARDH-LABST, " Opening Stock
           C_STK LIKE MARDH-LABST, " Closing Stock
          END OF I_MARDH.
    DATA: BEGIN OF I_MARD OCCURS 0,
           WERKS LIKE MARD-WERKS,
           MATNR LIKE MARD-MATNR,
           LGORT LIKE MARD-LGORT,
           LABST LIKE MARD-LABST,
           INSME LIKE MARD-LABST,
           MEINS LIKE MARA-MEINS,
           EINME LIKE MARD-LABST,
           SPEME LIKE MARD-LABST,
           RETME LIKE MARD-LABST,
          END OF I_MARD.
    DATA: I_MARD1 LIKE I_MARD OCCURS 0 WITH HEADER LINE.
    DATA: I_MARDH1 LIKE I_MARDH OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF I_MKPF1 OCCURS 0,
            MBLNR LIKE MKPF-MBLNR,
            WERKS LIKE MSEG-WERKS,
            MATNR LIKE MSEG-MATNR,
            BUDAT LIKE MKPF-BUDAT,
            BWART LIKE MSEG-BWART,
            MJAHR LIKE MKPF-MJAHR,
            VGART LIKE MKPF-VGART,
            LGORT LIKE MSEG-LGORT,
            MENGE LIKE MSEG-MENGE,
            MEINS LIKE MSEG-MEINS,
            XAUTO LIKE MSEG-XAUTO,
            SHKZG LIKE MSEG-SHKZG,
          END OF I_MKPF1.
    DATA: BEGIN OF I_MKPF2 OCCURS 0,
           WERKS LIKE MSEG-WERKS,
           MATNR LIKE MSEG-MATNR,
           BUDAT LIKE MKPF-BUDAT,
           BWART LIKE MSEG-BWART,
           MJAHR LIKE MKPF-MJAHR,
           VGART LIKE MKPF-VGART,
           LGORT LIKE MSEG-LGORT,
           MENGE LIKE MSEG-MENGE,
           MEINS LIKE MSEG-MEINS,
           XAUTO LIKE MSEG-XAUTO,
         END OF I_MKPF2.
    DATA: BEGIN OF I_FINAL5 OCCURS 0,
           WERKS LIKE MSEG-WERKS, " Plant
           MATNR LIKE MSEG-MATNR, " Material
           LGORT LIKE MSEG-LGORT, " Storage Location
           BUDAT LIKE MKPF-BUDAT, " Posting Date
           MTART LIKE MARA-MTART, " Material Type
           SPMON LIKE S031-SPMON, " Month
           MAKTX LIKE MAKT-MAKTX, " Description
    meins(3), " UOM
            MEINS LIKE MSEG-MEINS,
            O_STK LIKE MARDH-LABST, " opening stock
            TRECEP LIKE MARDH-LABST, " total receipts
            PRODU LIKE MARDH-LABST, " Net Receipts - Production
            RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
            SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
            TDISP LIKE MARDH-LABST, " total dispatches
            CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
            OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
            TLOSS LIKE MARDH-LABST, " Total Loss
            TRLOSS LIKE MARDH-LABST, " Transit Loss
            WHLOSS LIKE MARDH-LABST, " Warehouse Loss
            C_STK LIKE MARDH-LABST, " Closing Stock
            TRFSTK LIKE MARDH-LABST, "Transfer stock
            MENGE LIKE MSEG-MENGE,
            OTHADJ LIKE MARDH-LABST,
          END OF I_FINAL5.
    DATA: BEGIN OF I_FINAL OCCURS 0,
            WERKS LIKE MSEG-WERKS, " Plant
            MATNR LIKE MSEG-MATNR, " Material
            BUDAT LIKE MKPF-BUDAT, " Posting Date
            MTART LIKE MARA-MTART, " Material Type
            SPMON LIKE S031-SPMON, " Month
            MAKTX LIKE MAKT-MAKTX, " Description
    meins(3), " UOM
            MEINS LIKE MSEG-MEINS,
            O_STK LIKE MARDH-LABST, " opening stock
            TRECEP LIKE MARDH-LABST, " total receipts
            PRODU LIKE MARDH-LABST, " Net Receipts - Production
            RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
            SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
            TDISP LIKE MARDH-LABST, " total dispatches
            CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
            OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
            TRFSTK LIKE MARDH-LABST, "Material Transfer stock
            TRLOSS LIKE MARDH-LABST, " Transit Loss
            WHLOSS LIKE MARDH-LABST, " Warehouse Loss
            TLOSS LIKE MARDH-LABST, " Total Loss
            C_STK LIKE MARDH-LABST, " Closing Stock
            OTHADJ LIKE MARDH-LABST,
           END OF I_FINAL.
    DATA: I_FINAL1 LIKE I_FINAL OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF I_FINAL_TEMP OCCURS 0,
            WERKS LIKE MSEG-WERKS, " Plant
            MATNR LIKE MSEG-MATNR, " Material
            MTART LIKE MARA-MTART, " Material Type
            MAKTX LIKE MAKT-MAKTX, " Description
            MEINS LIKE MSEG-MEINS,
            O_STK LIKE MARDH-LABST, " opening stock
            TRECEP LIKE MARDH-LABST, " total receipts
            PRODU LIKE MARDH-LABST, " Net Receipts - Production
            RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
            SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
            TDISP LIKE MARDH-LABST, " total dispatches
            CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
            OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
            TRFSTK LIKE MARDH-LABST, "Material Transfer stock
            TRLOSS LIKE MARDH-LABST, " Transit Loss
            WHLOSS LIKE MARDH-LABST, " Warehouse Loss
            TLOSS LIKE MARDH-LABST, " Total Loss
            C_STK LIKE MARDH-LABST, " Closing Stock
            OTHADJ LIKE MARDH-LABST,
          END OF I_FINAL_TEMP.
    For Materials
    DATA: BEGIN OF I_MARA OCCURS 0,
           MATNR TYPE MARA-MATNR,
           MTART TYPE MARA-MTART,
           MEINS LIKE MARA-MEINS,
           LABST TYPE MARD-LABST,
           MAKTX LIKE MAKT-MAKTX,
          END OF I_MARA.
    DATA: BEGIN OF I_STKMVMNTS OCCURS 0,
           BWART LIKE MSEG-BWART,
           SHKZG LIKE MSEG-SHKZG,
           VZBEW LIKE YW2_STKMOVEMENTS-VZBEW,
          END OF I_STKMVMNTS.
    DATA: BEGIN OF I_FINALT OCCURS 0,
           WERKS LIKE MSEG-WERKS, " Plant
           MATNR LIKE MSEG-MATNR, " Material
           BUDAT LIKE MKPF-BUDAT, " Posting Date
           MTART LIKE MARA-MTART, " Material Type
           SPMON LIKE S031-SPMON, " Month
           MAKTX LIKE MAKT-MAKTX, " Description
    meins(3), " UOM
           MEINS LIKE MSEG-MEINS,
           O_STK LIKE MARDH-LABST, " opening stock
           TRECEP LIKE MARDH-LABST, " total receipts
           PRODU LIKE MARDH-LABST, " Net Receipts - Production
           RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
           SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
           TDISP LIKE MARDH-LABST, " total dispatches
           CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
           OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
           TRFSTK LIKE MARDH-LABST, "Material Transfer stock
           TRLOSS LIKE MARDH-LABST, " Transit Loss
           WHLOSS LIKE MARDH-LABST, " Warehouse Loss
           TLOSS LIKE MARDH-LABST, " Total Loss
           C_STK LIKE MARDH-LABST, " Closing Stock
           OTHADJ LIKE MARDH-LABST,
           MONTH(8) ,
          END OF I_FINALT.
    DATA: IMKPFT LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
    DATA: IMKPFT1 LIKE I_MKPF1 OCCURS 0 WITH HEADER LINE.
    DATA: IMARDT LIKE I_MARD OCCURS 0 WITH HEADER LINE.
    DATA: IMARDHT LIKE I_MARDH OCCURS 0 WITH HEADER LINE.
    DATA: T_FINAL LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
    DATA: IMKPFT2 LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
    FCAT is used for the field catalog
    DATA: FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV WITH NON-UNIQUE DEFAULT KEY
                      WITH HEADER LINE INITIAL SIZE 0,
    for excluding the ICONs from the application toolbar
          FEXC TYPE TABLE OF SLIS_EXTAB WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
    FS_LAYO is used for Grid Layout
          FS_LAYO TYPE SLIS_LAYOUT_ALV,
    FEVENTS to handle the events TOP OF PAGE & USER_COMMAND
          FEVENTS TYPE TABLE OF SLIS_ALV_EVENT WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
    FHEADER is used for List header
          FHEADER TYPE TABLE OF SLIS_LISTHEADER WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
    sort is used for sorting
          FSORT TYPE TABLE OF SLIS_SORTINFO_ALV WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
          FCAT1 TYPE TABLE OF SLIS_FIELDCAT_ALV WITH NON-UNIQUE DEFAULT KEY
                    WITH HEADER LINE INITIAL SIZE 0,
          FS_LAYO1 TYPE SLIS_LAYOUT_ALV,
          GT_LIST_TOP_OF_PAGE1 TYPE SLIS_T_LISTHEADER,
          FEVENTS1 TYPE TABLE OF SLIS_ALV_EVENT WITH NON-UNIQUE DEFAULT KEY
                 WITH HEADER LINE INITIAL SIZE 0,
           FHEADER1 TYPE TABLE OF SLIS_LISTHEADER WITH NON-UNIQUE DEFAULT  
                  KEY WITH HEADER LINE INITIAL SIZE 0,
           G_STATU_071 TYPE SLIS_FORMNAME VALUE 'Z_PFSTATUS',
           ALV_VARIANT1 LIKE DISVARIANT.
    Variable Declaration *
    TYPES: TRFF_TYPE_DEC_6_5(6) TYPE P DECIMALS 5.
    DATA: FYEAR(4),
          MON(2),
          FYEAR1(4),
          MON1(2),
          OBAL LIKE MARD-LABST,
          CBAL LIKE MARD-LABST,
          INDEX TYPE I,
          COUNT,
          COUNT1 TYPE I,
          O_STK TYPE P DECIMALS 3,
          C_STK TYPE P DECIMALS 3,
          V_MJAHR LIKE MKPF-MJAHR,
          MONTHS TYPE TRFF_TYPE_DEC_6_5,
          MONTH TYPE I.
    Global variables for handling ALV functionality
    DATA: ALV_KEYINFO TYPE SLIS_KEYINFO_ALV,
          ALV_VARIANT LIKE DISVARIANT,
          ALV_LAYOUT TYPE SLIS_LAYOUT_ALV,
          ALV_REPID LIKE SY-REPID,
          ALV_PRINT TYPE SLIS_PRINT_ALV,
          ALV_DETAIL_FUNC(30),
          ALV_DEFAULT_VARIANT LIKE DISVARIANT-VARIANT,
          ALV_COLOURIZE_FIELDS LIKE MMIM_REP_PRINT-COLOR.
    RANGES: R_BUDAT FOR MKPF-BUDAT.
    *Added by Prabhu for year on 26.4.05.
    DATA: IDATE LIKE R_BUDAT OCCURS 0 WITH HEADER LINE.
    Selection Screen Elements *
    SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-001.
      SELECT-OPTIONS: S_WERKS FOR MARD-WERKS OBLIGATORY NO INTERVALS.
      PARAMETER: P_SPMON LIKE S031-SPMON NO-DISPLAY .
      SELECT-OPTIONS: S_MATNR FOR MARA-MATNR OBLIGATORY,
                      S_LGORT FOR MSEG-LGORT NO-EXTENSION NO INTERVALS,
                      S_MBLNR FOR MKPF-MBLNR,
                      S_BUDAT FOR MKPF-BUDAT OBLIGATORY .
    SELECTION-SCREEN END OF BLOCK BLK.
    SELECTION-SCREEN BEGIN OF BLOCK BLK3 WITH FRAME TITLE TEXT-004.
          PARAMETER : MTART LIKE MARA-MTART DEFAULT 'FERT' NO-DISPLAY.
    SELECTION-SCREEN END OF BLOCK BLK3.
    SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-003.
    SELECTION-SCREEN END OF BLOCK BLK2.
    ADDED BY PRABHU FOR DAY-WISE REPORT.
    SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-007.
      PARAMETERS: D1 RADIOBUTTON GROUP P1 DEFAULT 'X',
                  M1 RADIOBUTTON GROUP P1,
                  Y1 RADIOBUTTON GROUP P1.
    SELECTION-SCREEN END OF BLOCK B3.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-006.
    PARAMETERS: ALV_DEF LIKE DISVARIANT-VARIANT.
    SELECTION-SCREEN END OF BLOCK B2.
    DATA: S_BUDAT1 LIKE S_BUDAT OCCURS 0 WITH HEADER LINE."prabhu
    Initialization *
    INITIALIZATION.
      PERFORM ALV_INIT.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR ALV_DEF.
      PERFORM ALV_F4.
    At Selection Screen
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_spmon.
    PERFORM monat_f4.
    At Selection Screen *
    AT SELECTION-SCREEN.
    checking for the layout
      PERFORM ALV_CHECK.
    authorisation check for the Plant
    PERFORM auth_check.
    Validation for the Plant
      PERFORM VALIDITY_CHECK.
      IF MTART NE 'FERT'.
        MESSAGE E041 WITH 'Material Type must be FERT Only...'.
      ENDIF.
      IF D1 = 'X'." On 26.4.05.
        P_SPMON0(4) = S_BUDAT-LOW0(4).
        P_SPMON4(2) = S_BUDAT-LOW4(2).
      ELSE.
        P_SPMON0(4) = S_BUDAT-LOW0(4).
        P_SPMON4(2) = S_BUDAT-LOW4(2).
      ENDIF.
      LOOP AT S_BUDAT.
        IF S_BUDAT-HIGH IS INITIAL.
          S_BUDAT-HIGH = S_BUDAT-LOW.
          MODIFY S_BUDAT.
        ENDIF.
      ENDLOOP.
      IDATE-LOW = S_BUDAT-LOW.
      IDATE-HIGH = S_BUDAT-HIGH.
      CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
        EXPORTING
           I_DATE_FROM = IDATE-LOW
           I_DATE_TO = IDATE-HIGH
       IMPORTING
    E_DAYS =
          E_MONTHS = MONTH
    E_YEARS =
      DATA: I(3) TYPE C.
      I = S_BUDAT-LOW+4(2).
      CLEAR: R_BUDAT.
      REFRESH: R_BUDAT.
    *added by Prabhu for Only for Oneday.on 18.5.5
      IF MONTH EQ '0'.
        MONTH = MONTH + 1.
      ENDIF.
    *added by Prabhu for Only for Oneday.on 18.5.5
      DO MONTH TIMES.
        R_BUDAT-LOW = S_BUDAT-LOW.
        APPEND R_BUDAT.
      ENDDO.
      I = 0.
      LOOP AT R_BUDAT.
        R_BUDAT-LOW4(2) = S_BUDAT-LOW4(2) + I.
        I = I + 1.
        R_BUDAT-LOW+6(2) = '01'.
        MODIFY R_BUDAT.
      ENDLOOP.
      LOOP AT R_BUDAT.
        CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
           EXPORTING
             DAY_IN = R_BUDAT-LOW
           IMPORTING
             LAST_DAY_OF_MONTH = R_BUDAT-HIGH
          EXCEPTIONS
            DAY_IN_NO_DATE = 1
            OTHERS = 2
        MODIFY R_BUDAT.
      ENDLOOP.
      LOOP AT R_BUDAT.
        IF R_BUDAT-LOW4(2) = S_BUDAT-LOW4(2).
          R_BUDAT-LOW = S_BUDAT-LOW.
          MODIFY R_BUDAT.
        ENDIF.
        IF R_BUDAT-HIGH4(2) = S_BUDAT-HIGH4(2).
          R_BUDAT-HIGH = S_BUDAT-HIGH.
          MODIFY R_BUDAT.
        ENDIF.
    For Summary on 26.4.05.
        IF Y1 = 'X'.
          CLEAR R_BUDAT.
          REFRESH R_BUDAT.
          R_BUDAT-LOW = S_BUDAT-LOW.
          R_BUDAT-HIGH = S_BUDAT-HIGH.
          APPEND R_BUDAT.
          CLEAR R_BUDAT.
        ENDIF.
      ENDLOOP.
    At Selection Screen *
    AT SELECTION-SCREEN OUTPUT.
    Start of Selection *
    START-OF-SELECTION.
      V_MJAHR = P_SPMON+0(4).
    Get plant distinction warehouse/production
      PERFORM GET_PLANT_DISTINCTION.
    Collect the data from various tables
      PERFORM GETDATA_FG_STOCK.
    here the number of rows in the output table is found
      PERFORM OUTPUT_TABLE_CHECK.
    here the top of the page code is written, that is to be displayed
    in the output
      PERFORM Z_TOP_OF_PAGE.
    here ALV layout properties are set
      PERFORM Z_LAYOUT_SETTINGS.
    ALV EVENTS for TOP OF PAGE and for USER COMMAND
      PERFORM Z_ALV_EVENTS.
    The field catalog is defined for the Primary List is defined in
    the subroutine CREATE_FIELD_CATALOG include program ZPRRDOCR_FCAT
      PERFORM Z_CREATE_FIELD_CATALOG.
    This is for displaying the output
      PERFORM Z_REUSE_ALV_GRID_DISPLAY.
    *& Form getdata_fg_stock
    Getting data from standard tables
    FORM GETDATA_FG_STOCK.
    For getting the Start date & end date of the month
    PERFORM get_month_dates.
    Getting the Opening Stock from MARDH table
      IF MON EQ '01'.
        MON1 = MON.
        FYEAR1 = FYEAR.
        MON = '12'.
        FYEAR = FYEAR - 1.
      ELSE.
        MON1 = MON.
        FYEAR1 = FYEAR.
        MON = MON - 1.
        FYEAR = FYEAR.
      ENDIF.
      PERFORM GET_RECORDS_FROM_DB.
    *added for Month Summary on 26.4.05.
      LOOP AT R_BUDAT.
        S_BUDAT-LOW = R_BUDAT-LOW.
        S_BUDAT-HIGH = R_BUDAT-HIGH.
    *for Month
        P_SPMON0(4) = S_BUDAT-LOW0(4).
        P_SPMON4(2) = S_BUDAT-LOW4(2).
    *for summary.
        IF Y1 = 'X'.
          LOOP AT S_BUDAT.
            S_BUDAT1-SIGN = 'I'.
            S_BUDAT1-OPTION = 'NB'.
            S_BUDAT1-LOW = S_BUDAT-LOW.
            S_BUDAT1-HIGH = S_BUDAT-HIGH.
            APPEND S_BUDAT1.
            CLEAR S_BUDAT1.
          ENDLOOP.
        ENDIF.
        IMKPFT[] = I_MKPF[].
        IMKPFT2[] = I_MKPF[].
        IMARDT[] = I_MARD[].
        IMARDHT[] = I_MARDH[].
        PERFORM MONTH_WISE.
        PERFORM PROCESS_MOVEMENTS.
        PERFORM CALCULATE_OPENING_STOCK.
        PERFORM UPDATE_NON_TRANSACTION_ITMS.
        PERFORM DELETE_EMPTY_RECORDS.
        CLEAR: IMARDHT,IMARDT,IMKPFT1,IMKPFT,I_FINAL,I_FINAL5.
        REFRESH: IMARDHT,IMARDT,IMKPFT1,I_FINAL,I_FINAL5,IMKPFT.
      ENDLOOP.
      CLEAR: R_BUDAT.
      REFRESH: R_BUDAT.
    *end of changes for month.
    ENDFORM. " getdata_fg_stock
    FORM MONAT_F4 *
    F4-Hilfe für Monat *
    FORM MONAT_F4.
      DATA: BEGIN OF MF_DYNPFIELDS OCCURS 1.
              INCLUDE STRUCTURE DYNPREAD.
      DATA: END OF MF_DYNPFIELDS.
      DATA: MF_RETURNCODE LIKE SY-SUBRC,
             MF_MONAT LIKE ISELLIST-MONTH,
             MF_HLP_REPID LIKE SY-REPID.
      FIELD-SYMBOLS: .
    Wert von Dynpro lesen
      GET CURSOR FIELD MF_DYNPFIELDS-FIELDNAME.
      APPEND MF_DYNPFIELDS.
      MF_HLP_REPID = SY-REPID.
      DO 2 TIMES.
        CALL FUNCTION 'DYNP_VALUES_READ'
          EXPORTING
            DYNAME               = MF_HLP_REPID
            DYNUMB               = SY-DYNNR
          TABLES
            DYNPFIELDS           = MF_DYNPFIELDS
          EXCEPTIONS
            INVALID_ABAPWORKAREA = 01
            INVALID_DYNPROFIELD  = 02
            INVALID_DYNPRONAME   = 03
            INVALID_DYNPRONUMMER = 04
            INVALID_REQUEST      = 05
            NO_FIELDDESCRIPTION  = 06
            UNDEFIND_ERROR       = 07.
        IF SY-SUBRC = 3.
    Aktuelles Dynpro ist Wertemengenbild
          MF_HLP_REPID = 'SAPLALDB'.
        ELSE.
          READ TABLE MF_DYNPFIELDS INDEX 1.
    Unterstriche durch Blanks ersetzen
          TRANSLATE MF_DYNPFIELDS-FIELDVALUE USING '_ '.
          EXIT.
        ENDIF.
      ENDDO.
      IF SY-SUBRC = 0.
    Konvertierung ins interne Format
        CALL FUNCTION 'CONVERSION_EXIT_PERI_INPUT'
          EXPORTING
            INPUT         = MF_DYNPFIELDS-FIELDVALUE
          IMPORTING
            OUTPUT        = MF_MONAT
          EXCEPTIONS
            ERROR_MESSAGE = 1.
        IF MF_MONAT IS INITIAL.
    Monat ist initial => Vorschlagswert aus akt. Datum ableiten
          MF_MONAT = SY-DATLO(6).
        ENDIF.
        CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
          EXPORTING
            ACTUAL_MONTH               = MF_MONAT
          IMPORTING
            SELECTED_MONTH             = MF_MONAT
            RETURN_CODE                = MF_RETURNCODE
          EXCEPTIONS
            FACTORY_CALENDAR_NOT_FOUND = 01
            HOLIDAY_CALENDAR_NOT_FOUND = 02
            MONTH_NOT_FOUND            = 03.
        IF SY-SUBRC = 0 AND MF_RETURNCODE = 0.
    ASSIGN (MF_DYNPFIELDS-FIELDNAME) TO <MF_FELD>. " ==>> note 148804
    <MF_FELD> = MF_MONAT.
          CALL FUNCTION 'CONVERSION_EXIT_PERI_OUTPUT'
            EXPORTING
              INPUT  = MF_MONAT
            IMPORTING
              OUTPUT = MF_DYNPFIELDS-FIELDVALUE.
          COLLECT MF_DYNPFIELDS.
          CALL FUNCTION 'DYNP_VALUES_UPDATE'
            EXPORTING
              DYNAME               = MF_HLP_REPID
              DYNUMB               = SY-DYNNR
            TABLES
              DYNPFIELDS           = MF_DYNPFIELDS
            EXCEPTIONS
              INVALID_ABAPWORKAREA = 01
              INVALID_DYNPROFIELD  = 02
              INVALID_DYNPRONAME   = 03
              INVALID_DYNPRONUMMER = 04
              INVALID_REQUEST      = 05
              NO_FIELDDESCRIPTION  = 06
              UNDEFIND_ERROR       = 07. "<<== note 148804
        ENDIF.
      ENDIF.
    ENDFORM.                                                    "MONAT_F4
    *& Form get_month_dates
    Calculating the Month Start & End Date
    FORM GET_MONTH_DATES.
      IF M1 = 'X'.
        FYEAR = P_SPMON+0(4).
        MON = P_SPMON+4(2).
        CONCATENATE FYEAR MON '01' INTO R_BUDAT-LOW.
        R_BUDAT-SIGN = 'I'.
        R_BUDAT-OPTION = 'BT'.
        CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
          EXPORTING
            I_DATE = R_BUDAT-LOW
          IMPORTING
            E_DATE = R_BUDAT-HIGH.
        APPEND R_BUDAT.
        CLEAR S_BUDAT.
        REFRESH S_BUDAT.
        S_BUDAT-SIGN = 'I'.
        S_BUDAT-OPTION = 'BT'.
        S_BUDAT-LOW = R_BUDAT-LOW.
        S_BUDAT-HIGH = R_BUDAT-HIGH.
        APPEND S_BUDAT.
      ELSE.
        FYEAR = P_SPMON+0(4).
        MON = P_SPMON+4(2).
        CONCATENATE FYEAR MON '01' INTO R_BUDAT-LOW.
        R_BUDAT-SIGN = 'I'.
        R_BUDAT-OPTION = 'BT'.
        CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
          EXPORTING
            I_DATE = R_BUDAT-LOW
          IMPORTING
            E_DATE = R_BUDAT-HIGH.
        APPEND R_BUDAT.
      ENDIF.
    ENDFORM. " get_month_dates
    *& Form output_table_Check
    checking for records for output
    FORM OUTPUT_TABLE_CHECK .
      DESCRIBE TABLE I_FINALT LINES INDEX.
      IF INDEX EQ 0.
        MESSAGE I041 WITH TEXT-005.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM. "OUTPUT_TABLE_CHECK
    *& Form Z_TOP_OF_PAGE
    for setting the details in the top of page *
    has no formal paramters *
    FORM Z_TOP_OF_PAGE.
      DATA: V_MON(2),
      V_YR(40),
      V_FIN(18),
      V_FIN1(48),
      LOW(10),
      HIGH(10).
      V_MON = P_SPMON+4(2).
      V_YR = P_SPMON+0(4).
      FHEADER-TYP = 'H'.
      FHEADER-INFO = 'Stock Register Report (FG Stock)'.
      APPEND FHEADER.
      CLEAR FHEADER.
    *if m1 = 'X'.
    CONCATENATE 'Month = ' v_mon '.' v_yr INTO v_fin.
    fheader-typ = 'H'.
    fheader-info = v_fin.
    APPEND fheader.
    CLEAR fheader.
    *endif."prabhu on 18.5.5
      IF D1 = 'X'.
        CLEAR S_BUDAT.
        LOOP AT S_BUDAT.
          CONCATENATE S_BUDAT-LOW6(2) '/' S_BUDAT-LOW4(2) '/'
          S_BUDAT-LOW+0(4) INTO LOW.
          CONCATENATE S_BUDAT-HIGH6(2) '/' S_BUDAT-HIGH4(2) '/'
          S_BUDAT-HIGH+0(4) INTO HIGH.
          CONCATENATE 'Date = ' LOW ' - ' HIGH INTO V_FIN1.
          FHEADER-TYP = 'H'.
          FHEADER-INFO = V_FIN1.
          APPEND FHEADER.
          CLEAR FHEADER.
        ENDLOOP.
      ENDIF.
    ENDFORM. " Z_TOP_OF_PAGE
    *& Form Z_LAYOUT_SETTINGS
    this is done for setting the properties for the layout of the *
    grid *
    has no formal paramters *
    FORM Z_LAYOUT_SETTINGS.
      FS_LAYO-ZEBRA = 'X'. " Output in Zebra pattern
      FS_LAYO-DETAIL_POPUP = 'X'. " A popup window appears to give
      FS_LAYO-DETAIL_TITLEBAR = TEXT-022.
      FS_LAYO-COLWIDTH_OPTIMIZE = 'X'.
    ENDFORM. " Z_LAYOUT_SETTINGS
    *& Form Z_ALV_EVENTS
    This is used for handling the events TOP OF PAGE and the USER *
    COMMAND event *
    has no formal paramters *
    FORM Z_ALV_EVENTS.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = FEVENTS[].
      READ TABLE FEVENTS WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC = 0.
        FEVENTS-FORM = 'Z_TOPOFPAGE'.
        MODIFY FEVENTS INDEX SY-TABIX.
        CLEAR FEVENTS.
      ENDIF.
      READ TABLE FEVENTS WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC = 0.
        FEVENTS-FORM = 'Z_USER_COMMAND'.
        MODIFY FEVENTS INDEX SY-TABIX.
        CLEAR FEVENTS.
      ENDIF.
    ENDFORM. "Z_ALV_EVENTS
    *& Form Z_CREATE_FIELD_CATALOG
    here the field catalog is created for the primary list *
    no formal parameters *
    FORM Z_CREATE_FIELD_CATALOG.
    for the Plant
      FCAT-FIELDNAME = 'WERKS'.
      FCAT-KEY = 'X'.
      FCAT-OUTPUTLEN = '000005'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Plant'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Material Type
      FCAT-FIELDNAME = 'MTART'.
      FCAT-KEY = 'X'.
      FCAT-OUTPUTLEN = '000006'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'MatTyp'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Material No.
      FCAT-FIELDNAME = 'MATNR'.
      FCAT-KEY = 'X'.
    fcat-hotspot = 'X'.
      FCAT-OUTPUTLEN = '000018'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Material'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Material Description
      FCAT-FIELDNAME = 'MAKTX'.
      FCAT-KEY = ''.
      FCAT-OUTPUTLEN = '000040'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Description'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Unit of Measure
      FCAT-FIELDNAME = 'MEINS'.
      FCAT-KEY = ''.
      FCAT-OUTPUTLEN = '03'.
      FCAT-JUST = 'C'.
      FCAT-SELTEXT_M = 'UOM'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'UNIT'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Plant
      FCAT-FIELDNAME = 'MONTH'.
      FCAT-KEY = 'X'.
      FCAT-OUTPUTLEN = '08'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'MONTH'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Opening Stock
      FCAT-FIELDNAME = 'C_STK'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Opening Stock'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
    fcat-do_sum = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Total Receipts
      FCAT-FIELDNAME = 'TRECEP'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Total Receipts'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Production
      FCAT-FIELDNAME = 'PRODU'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Production'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Other Plant Receipts
      FCAT-FIELDNAME = 'RECEP'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Othr Plnt Recpts'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    Sales Return
      FCAT-FIELDNAME = 'SAL_RET'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Sales Return'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    Total Dispatches
      FCAT-FIELDNAME = 'TDISP'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Total Dispatches'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.

  • How to edit particular field in alv list display-urgent

    HI ALL,
    my requirement is i am displaying output using alv list display. now my rewuirement :
    i am displaying out in edit mode only. when user clicks one particular field
    for example record is like
    runrate a01 maheed  -> if user clicks on a01 this field should be editable. i have a following code
      w_field-edit = w_edit.
      w_field-input = 'X'.    -> using this code i can able to display entire colomn in edit mode. this not suits my requirement.anybody can send me the sample code please.
    thanks,
    maheedhar.t

    Can you please send me the sample code plz.
    i am sending my code below.
    type-pools : slis.
    tables : zuser_secobjects.
    data : t_header1 like zuser_secobjects.
    data : begin of it_secobjects occurs 0.
            include structure t_header1.
    data :   checkbox type c value 'X',
            action type c,
          end of it_secobjects.
    data : begin of it_secobjects1 occurs 0.
            include structure ZUSER_SECOBJECTS.
    data :   checkbox type c VALUE 'X',
          end of it_secobjects1.
    data : wa_ita like line of it_secobjects.
    data : i_field type slis_t_fieldcat_alv with header line.
    data : w_field like line of i_field.
    data : i_sort type slis_t_sortinfo_alv.
    data : w_sort like line of i_sort.
    data : it_filt1 type slis_t_filter_alv with header line.
    data:
    i_tabname type tabname,
    i_repid like sy-repid,
    is_lout type slis_layout_alv.
    data :   it_filt type slis_t_filter_alv   with header line,
             it_evts type slis_t_event        with header line.
    DATA : is_vari type disvariant.
    constants :   c_default_vari value 'X',
                  c_save_vari    value 'U',
                   c_checkfield type slis_fieldname     value 'ACTION',
                   c_f2code     type sy-ucomm           value '&ETA'.
    data : chk_box type slis_fieldname.
    selection-screen: begin of block b1 with frame title text-t01.
    parameters : p_appln type zuser_secobjects-appln.
    parameters : p_user type usr02-bname, "zuser_secobjects-appln_user,
    p_partnr type zuser_secobjects-appln_partner,
    p_ptype type zuser_secobjects-partner_type default '02',
    p_upostn type zuser_secobjects-user_position,
    p_sdate like likp-erdat default sy-datum,
    p_edate(10) default '12/31/9999',
    p_revnum type zuser_secobjects-revnum,
    p_cted type zuser_secobjects-created_by,
    p_cdate type zuser_secobjects-creation_date,
    p_ctime type zuser_secobjects-creation_time,
    p_chnby type zuser_secobjects-changed_by,
    p_cdate1 type zuser_secobjects-changed_date,
    p_ctime1 type zuser_secobjects-changed_time.
    selection-screen: end of block b1.
    form user_command using p_ucomm like sy-ucomm
    rs_selfield type slis_selfield.
      case p_ucomm.
        when 'SELECT_ALL'. " SELALL is the FCODE of ur push button
          loop at it_secobjects into wa_ita.
            wa_ita-checkbox = 'X'.
            modify it_secobjects from wa_ita.
          endloop.
      rs_selfield-refresh = 'X'.   "<-  ADD THIS
      when 'DESLCT_ALL'.
        loop at it_secobjects into wa_ita.
            wa_ita-checkbox = ' '.
            modify it_secobjects from wa_ita.
          endloop.
    rs_selfield-refresh = 'X'.   "<-  ADD THIS
       is_lout-f2code               = c_f2code.
       is_lout-box_fieldname        = c_checkfield.
       is_lout-get_selinfos         = 'X'.
       is_lout-detail_popup         = 'X'.
       is_lout-detail_initial_lines = 'X'.
    maheed-start.
    *when 'SAVE'.
    *LOOP AT IT_SECOBJECTS WHERE CHECKBOX = 'X'.
    MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.
    APPEND IT_SECOBJECTS1.
    CLEAR IT_SECOBJECTS1.
    DELETE IT_SECOBJECTS.
    *ENDLOOP.
    *DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.
    WHEN 'DELETE'.
        loop at it_SECOBJECTS where checkbox eq 'X'.
            delete it_SECOBJECTS.
        endloop.
    *RS_SELFIELD-REFRESH = 'X'.
    maheed-end.
    maheed-start.  apr 13
    WHEN 'DELETE'.
    loop at it_SECOBJECTS where checkbox eq 'X'.
    MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.
    APPEND IT_SECOBJECTS1.
    delete it_SECOBJECTS.
    endloop.
    RS_SELFIELD-REFRESH = 'X'.
    when 'SAVE'.
    DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.
    commit work.
    refresh :IT_SECOBJECTS1.
    maheed-end.    apr 13
    *when 'SAVE'.
    *LOOP AT IT_SECOBJECTS WHERE CHECKBOX = 'X'.
    MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.
    APPEND IT_SECOBJECTS1.
    CLEAR IT_SECOBJECTS1.
    DELETE IT_SECOBJECTS.
    *ENDLOOP.
    *DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.
    ENDCASE.
    endform.
    *&      Form  delete
    form delete.
      data : begin of is_secobjects occurs 0.
              include structure zuser_secobjects.
      data : checkbox type c.
      data : end of is_secobjects.
      is_secobjects-checkbox = 'X'.
      modify is_secobjects
        from it_secobjects
        transporting checkbox
      where checkbox = 'X'.
    endform.
    *&      Form  get_data
    form get_data.
      select * from zuser_secobjects
      into table it_secobjects.
    endform.                    " get_data
    *&      Form  prepare_fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    form prepare_fieldcatalog." USING w_edit TYPE any.
    data : w_edit type c.
    clear w_edit.
      clear: w_field,i_field.
      refresh:i_field.
      i_field-key = 'X'.
      i_field-col_pos = 1.
      i_field-ddictxt = 'S'.
      i_field-seltext_s = '@11@'.
    i_field-checkbox = 'X'.
      i_field-input = 'X'.
      i_field-fieldname = 'HEADER'.
      i_field-outputlen = 0.
      append i_field.
      clear i_field.
      w_field-fieldname = 'APPLN'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-seltext_l = text-m01.
      w_field-outputlen = '10'.
      w_field-EDIT = 'X'.      "maheed
      w_field-col_pos = 1.
      append w_field to i_field.
      clear w_field.
      w_field-fieldname = 'APPLN_USER'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-just = 'C'.
      w_field-seltext_l = text-m02.
      w_field-outputlen = '7'.
      w_field-col_pos = 2.
      append w_field to i_field.
      clear w_field.
      w_field-fieldname = 'APPLN_PARTNER'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-just = 'C'.
      w_field-seltext_l = text-m03.
      w_field-edit = w_edit.
      w_field-input = 'X'.
      w_field-outputlen = '7'.
      w_field-col_pos = 2.
      append w_field to i_field.
      clear w_field.
      w_field-fieldname = 'INACTIVE'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-just = 'C'.
      w_field-seltext_l = text-m02.
      w_field-outputlen = '7'.
      w_field-col_pos = 3.
      append w_field to i_field.
      clear w_field.
    endform.                    " prepare_fieldcatalog
    *&      Form  ALV_LIST_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    form alv_list_display.
    DATA : LC_GLAY TYPE LVC_S_GLAY.
    LC_GLAY-EDT_CLL_CB = 'X'.
      i_repid = sy-repid.
      is_lout-box_fieldname = 'CHECKBOX'.
      it_filt-fieldname = 'ACTION'.
      call function 'REUSE_ALV_LIST_DISPLAY'
           exporting
                i_callback_program       = i_repid
                i_callback_pf_status_set = 'PF_STATUS_SET'
                i_callback_user_command  = 'USER_COMMAND'
                is_layout                = is_lout
                it_fieldcat              = i_field[]
                it_filter                = it_filt[]
                 it_events                = it_evts[]
                i_default                = c_default_vari
                i_save                   = c_save_vari
                is_variant               = is_vari
           tables
                t_outtab                 = it_secobjects.
    endform.                    " ALV_LIST_DISPLAY
    *&      Form  display
          text
         -->P_I_OBJECT  text
    form display using    object.
      case object.
    ENDCASE.
    endform.                    " display
    thanks,
    maheedhar.t

  • Editable field in alv list display

    i WANT TO GIVE COLOR FOR EDITABLE FIELD IN ALV LIST DISPLAY.i TRIED WITH EMPHASIZE IN FIELD CATALOGUE ASSIGNING.bUT,IT IS NOT WORKING.HOW TO DO.tHANX IN ADVANCE.........

    HI,
    Please refer the link below:
    http://www.****************/Tutorials/ALV/Edit/demo.htm
    http://www.****************/Tutorials/ALV/ColorSALV/Demo.htm
    Thanks,
    Sriram Ponna.

  • How to get subtotal value in ALV list display

    Hi all,
    How to give condition on the value of subtotal line in ALV list display,
    i.e.if value of subtotal of plan quantity = actual quantity (in red oval) it should show the message
    'ON TIME DELIVERY' else it should not show messagee.In my case(shown in red oval) its
    showing for each subtotal value. I know how to change the subtotal text but i want to change
    with respect to value of the subtotal.(plz refer attachment)
    Any input regard to this will be achieved great.
    Many thanks in advance.
    samadhan shinde.

    Hi Samadhan,
    I am awaiting for solution for this problem.....but as i think dynamically displaying sub total based on
    matching actual quantity and planned quantity is bit complicated.
    My idea is to display matched quantities in one block and unmatched  quantities in another. I mean using blocked list.
    awaiting suggestions.
    regards,

  • Dynamically assign value to a column in ALV LIST Display

    Hi all,
    How can I dynamically assign value to a column in ALV LIST Display without using classes and methods?
    Thanks,
    Ridhima

    Hi Vikranth,
    I am displaying one ALV list say with columns A and B.
    I have value in A but not in B. Now at runtime user selects one row, clicks on push button in application toolbar, then i have to display value in column B in the already displayed list.
    I searched and came to know it can be done with oops concept. but i am not using classes and methods.
    so how can i do this?
    Thanks,
    Ridhima.

  • How to give color of particular cell in alv list display for dynamic table

    Dear Experts,
    i want to give color of a particular cell in alv list display (reuse_alv_list_display). Here i am passing data through dynamic table?

    Hi,
    Se this:
    DATA: lt_color    TYPE lvc_t_scol WITH HEADER LINE.
    DATA: BEGIN OF data_tab OCCURS 0.
             tabcolor     TYPE   lvc_t_scol,
          END OF data_tab.
    * Befone ALV call
      alv_layout-coltab_fieldname  = 'TABCOLOR'.
    * For each row in data_tab
    REFRESH: lt_color.
    CLEAR: lt_color.
    lt_color-color-col = 6.
    lt_color-color-int = 1.
    lt_color-fname = FIELD1'.
    APPEND lt_color.
    lt_color-color-col = 2.
    lt_color-color-int = 0.
    lt_color-fname = 'FIELD2'.
    APPEND lt_color.
    data_tab-tabcolor[] = lt_color[].
    append data_tab.
    Best regards,
    Leandro Mengue

  • Reg: ALV list Display

    Hi Experts,
                    My requirement is i need a button along with the tool bar of ALV list display . when i check the button it should display the Selection criteria values which user entered as a pop up .
    Is there any default tool which displays user selection values  for ALV list display  ?
    Regards,
    Vikram.S

    > Is there any default tool which displays user selection values  for ALV list display  ?
    No such program.
    But you have to write a code for it. Activate Button using the pf-status. then Handle that button in User command , and show a popup with the selection values.
    Function used to get the selection details is
    RS_REFRESH_FROM_SELECTOPTIONS
    get the data and show it using a Popup. May be a ALV popup select function will help you.

  • What data is stored in the CC Background Job Spool File?

    What information is stored in the location referenced in the CC Configuration/Miscellaneous setting of 'Background Job Spool File Location'?  Our test and production versions of this system are configured the same, with both pointing to the same location on their respective servers.  However the test location shows a virsa/bgJobSpool folder in it containing multiple files while our production system shows this location as empty.
    Both versions seem to be working OK.  We are running backgrounds jobs in each (risk analysis, management reviews, rule generation, etc.) and seeing results.
    We updated to the GRC 5.2 a few months ago and are currently on SP9.  This issue came up during a system audit, so we need to come up with an explanation for the differences.
    Thanks.

    I had reviewed that SAP note previously, but it does not seem to help any with our situation.  We are running ad hoc background risk analysis jobs frequently and can always see the results.  Everything seems to work fine from the application side, we just don't see the logs where we thought they should be over on the server.
    From the outside, it looks like maybe it is ignoring the configuration setting and is still using the default location for the log.  Does it need to be on the same drive as the application?  I believe our application and the default location are both on our E drive, but we want to put the location for this and the Alert Log on the D drive.
    Thanks.

  • Has anyone put the RAR Background Job Spool on a different server?

    We are on GRC 5.3 SP 13.
    Has anyone put the RAR Background Job Spool File Location (assigned in the Miscellaneous configuration section) on a server different than the one that the GRC Frontend/Java system is on?
    I currently have it assigned to a folder on the GRC server, but it is running out of space.  I am having a problem getting the users to delete old reports as they say they need to keep them for internal Audit controls.  They are also resisting downloading the reports (more work for them).  I have been told that we cannot easily increase the file space on the GRC server (would basically have to purchase more storage and rebuild the server).
    I was thinking about moving the folder over to our virtual storage area, were file size can be more easily expanded.  I haven't found any documentation that says the folder has to be on the GRC server, but I also haven't seen any examples of where it has been put on a different server.
    Has anyone done this, and did you run into any problems?
    Thanks.

    Hello Bob,
    I got your point. Probably there's no recommendation about this, because the recomended practise is to delete or archive the spools as suggested in note : Note 1511027 - Periodic clean up of spool files
    If you have a requirement to keep these files "online", I think the option to save them to a network drive is fine. I haven't tried it for this specific scenario. You have to take into account:
    - Specific user to connect to FileServer
    - Availability of the FileServer. If the FS is down, the RAR job will cancel.
    - Performance. I mean, write to a local disk is not the same to write to a network drive. This point is very difficult to measure,   because it depends on a lot of things like network speed, server load, etc.
    Maybe someone has already implemented it and gives you more hints.
    Cheers,
    Diego.

Maybe you are looking for

  • Lenovo 3000 N100 notebook cannot connect to my wireless network

    Hello, this is my first post. I am new member. I also am a very novice/amateur computer user and so I need some help from some pros or anyone that has experienced a similar problem and can help fix my laptop. I have a Lenovo 3000 N100 laptop model nu

  • Motorola Citrus on $50 unlimited plan?

    I hear rumors that the prepaid Citrus is compatible with the new $50 unlimited plan. From what I'm reading, it's not true. Anyone confirm this? 

  • ApplicationModule - connection and VPD

    My company is looking at changing our Web development over to JDeveloper creating BC4J Struts based applications. I'm using JDeveloper to write a few small apps to see how the development process will go. I have a question on the ApplicationModule co

  • Hastable order reversing

    Can i get sample code for first in first out using Hashtable. Actually we are iterating hastable object to get the value of a key and display it on screen,but screen displays in reverse order(last value of table as first in screen), i want to display

  • Kt4v beeps ....what do they mean!?!???

    Hello I apologize if this problem was addressed in the faqs, but I couldn't find it there.... Anyways, I have a kt4v-L and it was working fine until I tried adding another hard drive and a burner.....when i turned the computer on, the screen stayed b