Code snippet in a ALV report

hello experts
I would like to calclute the invoice value and display in the output (invoice value = VBEP-NETWR/VBEP-FKIMG) , where should i add the code? In the select stament? code help is higly appreciated.
Thanks
mohan 
follows the program
Global structure of list
type-pools: slis.
tables: likp,
        lips,
        vbfa,
        kssk,
        klah,
        ausp,
        cabn,
        vbak,
        mara,
        vbrk,
        ser01,
        vbpa,
        nast,
        zseri,
        ltap,
        pa0001,
        kna1,
        objk,
        viqmel,
        viqmma.
types:  begin of i_delivery,
             vbeln like likp-vbeln,
             posnr  like lips-posnr,
             kunnr like likp-kunnr,
             kunag like likp-kunag,
             vkorg  like vbak-vkorg,
             matnr  like lips-matnr,
             lfart  like likp-lfart,
             arktx  like vbap-arktx,
             vgbel  like lips-vgbel,
             vgpos  like lips-vgpos,
             pstyv   like lips-pstyv,
             wadat type likp-wadat,
             lfdat type likp-lfdat,
             prodh type lips-prodh,
             lfimg type lips-lfimg,
             vkbur type lips-vkbur,
             werks type lips-werks,
             vkgrp type lips-vkgrp,
             mvgr1 type lips-mvgr1,
             sernr like equi-sernr,
             sernp like equi-sernr,
             equnr like equi-equnr,
             kttxt like qpct-kurztext,
             bstnk  like vbak-bstnk,
             vbelv  like lips-vgbel,
             posnv  like lips-posnv,
             uecha  like lips-uecha,
             ernam  like vbak-ernam,
             erdat like vbak-erdat,
             serail like lips-serail,
             anzsn like lips-anzsn,
             auart like vbak-auart ,
             netwr like vbap-netwr,
             fstno like vbpa-pernr,
             fstnm like pa0001-ename,
             ename like pa0001-ename,
             qname like ltap-qname,
             name1 like kna1-name1,
             name3 like kna1-name2,
             pernr like vbpa-pernr,
             aufnr like viqmel-aufnr,
             qmnum like viqmel-qmnum,
             mngrp like viqmma-mngrp,
             qmcod like viqmel-qmcod,
             qmcol like viqmma-mncod,
             cotxt(20),
         end of i_delivery.
Global structure of list
*/ Selection and Input Parameters
selection-screen begin of block block2 with frame title text-003.
select-options: s_vkorg for likp-vkorg no intervals.
select-options: s_vbeln  for likp-vbeln,
                s_lfart  for likp-lfart,
                s_kunnr  for likp-kunnr,
                s_erdat  for likp-erdat,
                s_wadat  for likp-wadat,
                s_werks  for lips-werks,
                s_matnr  for lips-matnr,
                s_prodh  for lips-prodh,
                s_qmnum for viqmel-qmnum.
selection-screen end of block block2.
selection-screen begin of block block4 with frame title text-002.
select-options:  s_vbelv for vbak-vbeln,
                 s_auart for vbak-auart.
selection-screen end of block block4.
parameters: p_vari like disvariant-variant.
ranges: r_vbeln for likp-vbeln.
data:   gt_fieldcat type slis_t_fieldcat_alv.
data:   gt_outtab type i_delivery occurs 0 with header line,
        rt_outtab1 type i_delivery occurs 0 with header line,
        i_nast type nast occurs 0 with header line,
        gt_list_top_of_page type slis_t_listheader,
        gt_events   type slis_t_event,
        gc_formname_top_of_page type slis_formname value 'TOP_OF_PAGE'.
data:   g_repid like sy-repid,
         g_count like sy-tabix.
data: begin of i_serial occurs 0,
        obknr type ser01-obknr,
        lief_nr type ser01-lief_nr,
        posnr type ser01-posnr,
        anzsn type ser01-anzsn,
      end of i_serial.
data: begin of i_object_numbers occurs 0,
        obknr type objk-obknr,
        obzae type objk-obzae,
        sernr type objk-sernr,
        equnr type objk-equnr,
        matnr type objk-matnr,
        taser type objk-taser,
      end of i_object_numbers.
data:   g_save(1) type c,
       g_default(1) TYPE c,
        g_exit(1) type c,
        gx_variant like disvariant,
        g_variant like disvariant.
data:  g_mnkat like viqmma-mnkat,
       g_mngrp like viqmma-mngrp,
       g_atinn like ausp-atinn.
Initialization fieldcatalog
initialization.
  g_repid = sy-repid.
  perform fieldcat_init using gt_fieldcat[].
move: 'I' to  s_vkorg-sign,
       'EQ' to  s_vkorg-option,
       '5090' to s_vkorg-low.
  append  s_vkorg.
  move: 'I' to  s_lfart-sign,
       'EQ' to s_lfart-option,
       'LF' to s_lfart-low.
  append  s_lfart.
  g_save = 'A'.
  perform variant_init.
Get default variant
  gx_variant = g_variant.
  call function 'REUSE_ALV_VARIANT_DEFAULT_GET'
       exporting
            i_save     = g_save
       changing
            cs_variant = gx_variant
       exceptions
            not_found  = 2.
  if sy-subrc = 0.
    p_vari = gx_variant-variant.
  endif.
at selection-screen on value-request for p_vari.
  perform f4_for_variant.
at selection-screen.
  perform pai_of_selection_screen.
Start of Selection
start-of-selection.
  perform e03_eventtab_build using gt_events[].
  perform select_data tables gt_outtab.
Display list
end-of-selection.
  call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
            i_background_id         = 'ALV_BACKGROUND'
            i_callback_user_command = 'USER_COMMAND'
            is_variant              = g_variant
            i_save                  = g_save
            i_callback_program      = g_repid
            it_fieldcat             = gt_fieldcat[]
       tables
            t_outtab                = gt_outtab.
   Forms
Initialization fieldcatalog
form fieldcat_init
      using rt_fieldcat type slis_t_fieldcat_alv.
  data: ls_fieldcat type slis_fieldcat_alv.
  data: pos type i value 1.
  clear ls_fieldcat.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'VBELN'.
  ls_fieldcat-seltext_s     = 'Delivery'.
  ls_fieldcat-seltext_m     = 'Delivery'.
  ls_fieldcat-key           = 'X'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'POSNR'.
  ls_fieldcat-key           = 'X'.
  ls_fieldcat-seltext_s     = 'Item'.
  ls_fieldcat-seltext_m     = 'Item'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'LFART'.
  ls_fieldcat-seltext_s     = 'Del Type'.
  ls_fieldcat-seltext_m     = 'Delivery Type'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'VGBEL'.
  ls_fieldcat-seltext_s     = 'Source Doc'.
  ls_fieldcat-seltext_m     = 'Source Doc'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'AUART'.
  ls_fieldcat-seltext_s     = 'Type'.
  ls_fieldcat-seltext_m     = 'Type'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'KUNNR'.
  ls_fieldcat-seltext_s     = 'Customer'.
  ls_fieldcat-seltext_m     = 'Customer'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'NAME1'.
  ls_fieldcat-seltext_s     = 'Name'.
  ls_fieldcat-seltext_m     = 'Name1'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'WERKS'.
  ls_fieldcat-seltext_s     = 'Plant'.
  ls_fieldcat-seltext_m     = 'Plant'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'MATNR'.
  ls_fieldcat-seltext_s     = 'Material'.
  ls_fieldcat-seltext_m     = 'Material'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'MVGR1'.
  ls_fieldcat-seltext_s     = 'Speciality'.
  ls_fieldcat-seltext_m     = 'Speciality'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'PRODH'.
  ls_fieldcat-seltext_s     = 'Hierarchy'.
  ls_fieldcat-seltext_m     = 'Prod Hierarchy'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'ARKTX'.
  ls_fieldcat-seltext_s     = 'Description'.
  ls_fieldcat-seltext_m     = 'Description'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'ERNAM'.
  ls_fieldcat-seltext_s     = 'Created By'.
  ls_fieldcat-seltext_m     = 'Created By'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'ERDAT'.
  ls_fieldcat-seltext_s     = 'Created On'.
  ls_fieldcat-seltext_m     = 'Created On'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'WADAT'.
  ls_fieldcat-seltext_s     = 'GoodsMvt.Date'.
  ls_fieldcat-seltext_m     = 'Goods Mvt Date'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'SERNR'.
  ls_fieldcat-seltext_s     = 'Serial Shipped'.
  ls_fieldcat-seltext_m     = 'Serial Shipped'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'SERNP'.
  ls_fieldcat-seltext_s     = 'Old Serial'.
  ls_fieldcat-seltext_m     = 'Old Serial'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'VBELV'.
  ls_fieldcat-seltext_s     = 'Invoice'.
  ls_fieldcat-seltext_m     = 'Invoice'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'NETWR'.
  ls_fieldcat-seltext_s     = 'Invoice Amt'.
  ls_fieldcat-seltext_m     = 'Invoice Value'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'QMNUM'.
  ls_fieldcat-seltext_s     = 'Notification'.
  ls_fieldcat-seltext_m     = 'Notification'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'QMCOD'.
  ls_fieldcat-seltext_s     = 'Rep LevKST'.
  ls_fieldcat-seltext_m     = 'Repair Level KST'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'COTXT'.
  ls_fieldcat-seltext_s     = 'CdTXT KST'.
  ls_fieldcat-seltext_m     = 'Repair Level Text KST'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'QMCOL'.
  ls_fieldcat-seltext_s     = 'Rep LevKSE'.
  ls_fieldcat-seltext_m     = 'Repair Level KSE'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
pos = pos + 1.
  ls_fieldcat-col_pos       =  pos.
  ls_fieldcat-fieldname     = 'KTTXT'.
  ls_fieldcat-seltext_s     = 'CdTXT KSE'.
  ls_fieldcat-seltext_m     = 'Repair Level Text KSE'.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
endform.   "fieldcat_init
Data selection
form select_data tables rt_outtab like gt_outtab[].
  clear: r_vbeln[].
Read all Invoices for the Selection
  select distinct h~vbeln  h~kunnr h~kunag
                 d~posnr  d~matnr d~anzsn
                 d~serail d~vgbel d~vgpos
                 d~posnv  d~lfimg d~arktx
                 d~uecha  h~lfart h~erdat
                 h~ernam  h~lfdat d~prodh
                 h~vkorg  d~vkbur d~vkgrp
                 d~mvgr1  h~wadat_ist d~pstyv
                 d~werks
         into (rt_outtab-vbeln, rt_outtab-kunnr,
                rt_outtab-kunag, rt_outtab-posnr,
                rt_outtab-matnr, rt_outtab-anzsn,
                rt_outtab-serail, rt_outtab-vgbel,
                rt_outtab-vgpos,  rt_outtab-posnv,
                rt_outtab-lfimg,  rt_outtab-arktx,
                rt_outtab-uecha, rt_outtab-lfart,
                rt_outtab-erdat, rt_outtab-ernam,
                rt_outtab-lfdat, rt_outtab-prodh,
                rt_outtab-vkorg, rt_outtab-vkbur,
                rt_outtab-vkgrp, rt_outtab-mvgr1,
                rt_outtab-wadat, rt_outtab-pstyv,
                rt_outtab-werks)
        from likp as h inner join lips as d
                 on h~vbeln = d~vbeln
                where h~vbeln in s_vbeln
                and  h~vkorg in s_vkorg
                and  h~lfart in s_lfart
                 and  h~kunnr in s_kunnr
                 and  h~erdat in s_erdat
                 and  d~matnr in s_matnr
                 and  d~werks in s_werks
                 and  d~prodh in s_prodh
                 and  d~vgbel in s_vbelv
                 and  d~matnr like 'S%'.
    select single * from vbak where vbeln = rt_outtab-vgbel.
    if: sy-subrc eq 0.
      move vbak-vbeln to rt_outtab-vgbel.
      move vbak-auart to rt_outtab-auart.
    endif.
    select single * from mara where matnr = rt_outtab-matnr
                                and  mtart eq 'FERT'.
    check sy-subrc eq 0.
    if not rt_outtab-posnv is initial.
      rt_outtab-vgpos = rt_outtab-posnv.
    endif.
    clear: vbfa.
    select single vbeln rfwrt into (rt_outtab-vbelv, rt_outtab-netwr)
from vbfa  where vbelv eq rt_outtab-vbeln
                           and   posnv eq rt_outtab-posnr
                           and   vbtyp_n eq 'M'.
    append rt_outtab.
    if not  r_vbeln-low is initial.
      if r_vbeln-low gt rt_outtab-vbeln.
        r_vbeln-low =  rt_outtab-vbeln.
      endif.
      if r_vbeln-high lt rt_outtab-vbeln.
        r_vbeln-high =  rt_outtab-vbeln.
      endif.
    else.
      r_vbeln-low  =  rt_outtab-vbeln.
      r_vbeln-high =  rt_outtab-vbeln.
    endif.
    clear: rt_outtab.
  endselect.
  if not r_vbeln is initial.
    move: 'I' to  r_vbeln-sign,
           'BT' to  r_vbeln-option.
    append r_vbeln.
    select * into corresponding fields of table i_serial
                              from   ser01 where lief_nr in r_vbeln.
  endif.
  sort i_serial.
  if not i_serial[] is initial.
    select * into corresponding fields of table i_object_numbers
                               from   objk
                               for all entries in i_serial
                               where obknr eq i_serial-obknr
                               and  taser eq 'SER01'.
  endif.
  sort i_object_numbers by  obknr obzae.
  loop at rt_outtab.
Read the Sold To Name
    select single name1 into rt_outtab-name1
                      from kna1 where kunnr eq rt_outtab-kunnr.
Read Ship-to Customer
    clear: objk.
    if not rt_outtab-serail is initial.
      read table i_serial with key lief_nr = rt_outtab-vbeln
                                    posnr = rt_outtab-posnr.
      if sy-subrc eq 0.
        do i_serial-anzsn times.
          read table i_object_numbers  with key obknr = i_serial-obknr
                                                matnr = rt_outtab-matnr
                                            binary search.
          if sy-subrc eq 0.
            rt_outtab-sernr = i_object_numbers-sernr.
            delete i_object_numbers index sy-tabix.
            move '1'   to rt_outtab-lfimg.
clear: rt_outtab-aufnr, rt_outtab-qmnum,
                     rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat.
select single aufnr qmnum equnr qmcod qmgrp qmkat
                        into (rt_outtab-aufnr, rt_outtab-qmnum,
                     rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat)
                     from viqmel  where matnr = rt_outtab-matnr
                         and serialnr = rt_outtab-sernr
                         and qmart  eq 'S4'
                         and qmnum in s_qmnum.
clear: rt_outtab-cotxt.
select single kurztext into rt_outtab-cotxt
                         from qpct where katalogart eq g_mnkat
                          and codegruppe eq  g_mngrp
                          and code eq rt_outtab-qmcod
                          and sprache eq sy-langu.
Read Serial Number from Name Plate Data.
            clear: klah, kssk, ausp, cabn, g_atinn.
            select single atinn into (g_atinn) from cabn
                                where atnam = 'SBANK_SERIAL_NUMBER'.
            select single  atwrt
                  into  (rt_outtab-sernp)
                  from  ( klah as a inner join kssk as k
                           on aclint = kclint )
                      join ausp as p
                            on kobjek = pobjek
                            and p~atinn = g_atinn
                            and pklart = aklart
                  where a~klart = '002'
                   and  a~class = 'KSE_SN_ENDOSCOPES'
                    and  k~objek = rt_outtab-equnr.
*KSE Repair level (activity code text from KSE-SM07 code group)
clear: rt_outtab-qmcol, g_mngrp, g_mnkat.
            clear: rt_outtab-qmcol.
            clear:   g_mnkat, g_mngrp.
            select single mnkat mngrp mncod into
                                (g_mnkat, g_mngrp, rt_outtab-qmcol)
                          from viqmma where qmnum = rt_outtab-qmnum
                                and  mngrp eq 'KSE-SM07'
                                and kzloesch eq space.
clear: rt_outtab-kttxt.
            select single kurztext into rt_outtab-kttxt
                         from qpct where katalogart eq g_mnkat
                                and codegruppe eq  g_mngrp
                                and code eq rt_outtab-qmcol
                                and sprache eq sy-langu.
            rt_outtab1 = rt_outtab.
            append rt_outtab1.
          endif.
        enddo.
      endif.
      endif.
    endloop.
    clear: rt_outtab[].
    rt_outtab[] = rt_outtab1[].
    sort rt_outtab by vbeln posnr.
  endform.
      FORM get_repname                                              *
-->  P_VBELN                                                       *
-->  P_POSNR                                                       *
-->  P_PERNR                                                       *
-->  P_ENAME                                                       *
form get_repname using  p_vbeln
                          p_posnr
                 changing  p_pernr
                          p_ename. "
  data: i_vbpa like vbpa occurs 0 with header line.
  clear: i_vbpa[].
  call function 'Z_DETERMINE_ACTIVE_SALES_REP'
       exporting
            g_salesdocument = p_vbeln
            g_sales_item    = p_posnr
       tables
            st_vbpa         = i_vbpa.
  read table i_vbpa index 1.
  if sy-subrc = 0.
    p_pernr = i_vbpa-pernr.
    select single ename into p_ename
      from pa0001
     where pernr = i_vbpa-pernr.
  endif.
endform.                    " get_repname
      FORM E03_EVENTTAB_BUILD                                       *
-->  E03_LT_EVENTS                                                 *
form e03_eventtab_build using e03_lt_events type slis_t_event.
  data: ls_event type slis_alv_event.
  call function 'REUSE_ALV_EVENTS_GET'
       exporting
            i_list_type = 0
       importing
            et_events   = e03_lt_events.
  read table e03_lt_events with key name =  slis_ev_top_of_page
                           into ls_event.
  if sy-subrc = 0.
    move gc_formname_top_of_page to ls_event-form.
    append ls_event to e03_lt_events.
  endif.
endform.
      FORM TOP_OF_PAGE                                              *
form top_of_page.
  call function 'REUSE_ALV_COMMENTARY_WRITE'
       exporting
            it_list_commentary = gt_list_top_of_page.
endform.
*&      Form  USER_COMMAND
form user_command  using r_ucomm like sy-ucomm
                         rs_selfield type slis_selfield.
  case r_ucomm.
    when '&IC1'.
      perform display_delivery using r_ucomm
                                    rs_selfield.
  endcase.
endform.
*&      Form  display_delivery
form display_delivery
using r_ucomm like sy-ucomm
                             rs_selfield type slis_selfield.
  case rs_selfield-sel_tab_field.
    when '1-VBELN'.
      set parameter id 'VL' field rs_selfield-value.
      call transaction 'VL03N' and skip first screen.
    when '1-VBELV'.
      set parameter id 'VF' field rs_selfield-value.
      call transaction 'VF03N' and skip first screen.
  endcase.
endform.
*&      Form  VARIANT_INIT
      text
-->  p1        text
<--  p2        text
form variant_init.
  clear g_variant.
  g_variant-report = g_repid.
endform.                               " VARIANT_INIT
*&      Form  F4_FOR_VARIANT
      text
-->  p1        text
<--  p2        text
form f4_for_variant.
  call function 'REUSE_ALV_VARIANT_F4'
       exporting
            is_variant          = g_variant
            i_save              = g_save
          it_default_fieldcat =
       importing
            e_exit              = g_exit
            es_variant          = gx_variant
       exceptions
            not_found = 2.
  if sy-subrc = 2.
    message id sy-msgid type 'S'      number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  else.
    if g_exit = space.
      p_vari = gx_variant-variant.
    endif.
  endif.
endform.
*&      Form  PAI_OF_SELECTION_SCREEN
      text
form pai_of_selection_screen.
  if not p_vari is initial.
    move g_variant to gx_variant.
    move p_vari to gx_variant-variant.
    call function 'REUSE_ALV_VARIANT_EXISTENCE'
         exporting
              i_save     = g_save
         changing
              cs_variant = gx_variant.
    g_variant = gx_variant.
  else.
    perform variant_init.
  endif.
endform.

Well, I've made some assumptions here, but I think this will work.  Of course you need to create a new field in your internal table to hold the calculated value.  Here I call it INVVALUE.   The issue here is that I'm a little concerned with the SELECT to VBFA, not sure that this is correct if you are trying to get the billing document.
form select_data tables rt_outtab like gt_outtab[].
  clear: r_vbeln[].
* Read all Invoices for the Selection
  select distinct h~vbeln h~kunnr h~kunag
  d~posnr d~matnr d~anzsn
  d~serail d~vgbel d~vgpos
  d~posnv d~lfimg d~arktx
  d~uecha h~lfart h~erdat
  h~ernam h~lfdat d~prodh
  h~vkorg d~vkbur d~vkgrp
  d~mvgr1 h~wadat_ist d~pstyv
  d~werks
  into (rt_outtab-vbeln, rt_outtab-kunnr,
  rt_outtab-kunag, rt_outtab-posnr,
  rt_outtab-matnr, rt_outtab-anzsn,
  rt_outtab-serail, rt_outtab-vgbel,
  rt_outtab-vgpos, rt_outtab-posnv,
  rt_outtab-lfimg, rt_outtab-arktx,
  rt_outtab-uecha, rt_outtab-lfart,
  rt_outtab-erdat, rt_outtab-ernam,
  rt_outtab-lfdat, rt_outtab-prodh,
  rt_outtab-vkorg, rt_outtab-vkbur,
  rt_outtab-vkgrp, rt_outtab-mvgr1,
  rt_outtab-wadat, rt_outtab-pstyv,
  rt_outtab-werks)
  from likp as h inner join lips as d
  on h~vbeln = d~vbeln
  where h~vbeln in s_vbeln
  and h~vkorg in s_vkorg
  and h~lfart in s_lfart
  and h~kunnr in s_kunnr
  and h~erdat in s_erdat
  and d~matnr in s_matnr
  and d~werks in s_werks
  and d~prodh in s_prodh
  and d~vgbel in s_vbelv
  and d~matnr like 'S%'.
    select single * from vbak where vbeln = rt_outtab-vgbel.
    if: sy-subrc eq 0.
      move vbak-vbeln to rt_outtab-vgbel.
      move vbak-auart to rt_outtab-auart.
    endif.
    select single * from mara where matnr = rt_outtab-matnr
    and mtart eq 'FERT'.
    check sy-subrc eq 0.
    if not rt_outtab-posnv is initial.
      rt_outtab-vgpos = rt_outtab-posnv.
    endif.
    clear: vbfa.
<b>    select single vbeln rfwrt into (rt_outtab-vbelv, rt_outtab-netwr)
    from vbfa where vbelv eq rt_outtab-vbeln
    and posnv eq rt_outtab-posnr
    and vbtyp_n eq 'M'.</b>
<b>    data: xvbrp type vbrp.
    select Single * from vbrp into xvbrp
                    where vbeln = rt_outtab-vbeln   " Need to be billing document
                      and posnr = rt_outtab-posnr.
     rt_outtab-INVVALUE = xvbrp-netwr / xvbrp-fkimg. </b>               
    append rt_outtab.
    if not r_vbeln-low is initial.
      if r_vbeln-low gt rt_outtab-vbeln.
        r_vbeln-low = rt_outtab-vbeln.
      endif.
      if r_vbeln-high lt rt_outtab-vbeln.
        r_vbeln-high = rt_outtab-vbeln.
      endif.
    else.
      r_vbeln-low = rt_outtab-vbeln.
      r_vbeln-high = rt_outtab-vbeln.
    endif.
    clear: rt_outtab.
  endselect.
Regards,
Rich Heilman

Similar Messages

  • ALV Report: Input on some line items

    Dear All,
    Can you please help me out in this requirement..
    I have a ALV report with checkbox. If I select some checkbox line items and click on Edit button(Custom button) those line items should get enabled and user should be able to input value for those line items. INPUT in fieldcatalog enables the entire set of output, not individually those line items.
    Please can you suggest on that?
    Thanks and regards,
    Atanu

    Hi,
    Herewith i am sending the sample code for the CHECKBOX ALV REPORT.
    TYPE-POOLS: slis.
    DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
    DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    DATA: s_layout TYPE slis_layout_alv.
    DATA: BEGIN OF itab OCCURS 0,
    icon TYPE icon-id,
    vbeln TYPE vbeln,
    kunnr TYPE kunnr,
    erdat TYPE erdat,
    box TYPE c,
    END OF itab.
    DATA: v_repid TYPE syrepid.
    START-OF-SELECTION.
    Get the data.
    SELECT vbeln kunnr erdat UP TO 100 ROWS
    FROM vbak
    INTO CORRESPONDING FIELDS OF TABLE itab.
    IF sy-subrc <> 0.
    MESSAGE s208(00) WITH 'No data found'.
    LEAVE LIST-PROCESSING.
    ENDIF.
    Modify the record with red light.
    itab-icon = '@0A@'.
    MODIFY itab TRANSPORTING icon WHERE NOT vbeln IS initial.
    v_repid = sy-repid.
    Get the field catalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'ICON'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-seltext_l = 'Status'.
    s_fieldcatalog-icon = 'X'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '2'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-rollname = 'VBELN'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '3'.
    s_fieldcatalog-fieldname = 'KUNNR'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-rollname = 'KUNNR'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '4'.
    s_fieldcatalog-fieldname = 'ERDAT'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-rollname = 'ERDAT'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    Set the layout.
    s_layout-box_fieldname = 'BOX'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = v_repid
    is_layout = s_layout
    i_callback_pf_status_set = 'SET_PF_STATUS'
    i_callback_user_command = 'USER_COMMAND'
    it_fieldcat = t_fieldcatalog[]
    TABLES
    t_outtab = itab.
    FORM SET_PF_STATUS *
    --> EXTAB *
    FORM set_pf_status USING extab TYPE slis_t_extab.
    SET PF-STATUS 'TEST2'.
    ENDFORM.
    FORM user_command *
    --> UCOMM *
    --> SELFIELD *
    FORM user_command USING ucomm LIKE sy-ucomm
    selfield TYPE slis_selfield.
    Check the ucomm.
    IF ucomm = 'DETAIL'.
    LOOP AT itab WHERE box = 'X'.
    itab-icon = '@08@'.
    MODIFY itab TRANSPORTING icon.
    ENDLOOP.
    ENDIF.
    selfield-refresh = 'X'.
    ENDFORM.
    Thanks,
    Shankar

  • How to submit a ALV report in background

    Can you provide a peice of code to submit an ALV report in background?
    and is it possible to provide a  header information  dynmically, (changing when we say page down) in ALV?

    Hello,
    you can submit in background as a normal report.
    If you want to get the header informations. Handle through events. Events can be handle through registring the Event handler method.
    Eg:
    Events
        CREATE OBJECT eventhandler_object.
    register eventhandler
        SET HANDLER  eventhandler_object->handle_print_top_of_list
         FOR g_o_grid.
    CALL METHOD g_o_grid->set_table_for_first_display
    Reward if helps.
    Thanks,
    KrishnaKumar

  • Problem in converting alv report to excel

    Hi all,
         We are trying to convert an alv report to excel and attach it to the mail. We are able to convert and attach it in mail.But in the mail attachment we see in some records some special characters are displayed. I am attaching the part of code of converting the alv report to excel. Kindly suggest us a solution.
    DATA: LD_STORE(50) TYPE C. "Leading zeros
    DATA : L_STRING(270) TYPE C.
    DATA : dmbtr(15) type c,
           wrbtr(15) type c,
           30days(15) type c,
           60days(15) type c,
           90days(15) type c,
           120days(15) type c,
           180days(15) type c,
           above180(15) type c,
           salds(15) type c,
           saldh(15) type c,
           acytd_bal(15) type c,
           zbd1t(15) type c.
    DATA : a type i.
    CONSTANTS:
    CON_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
    CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
    CONCATENATE w_lifnr w_name1 w_docno w_doctype w_ref w_docdate w_postdate w_duedate w_dmbtr w_waers w_wrbtr
                w_30days w_60days w_90days w_120days w_180days w_above180 w_debit w_credit w_accbal
    INTO L_STRING SEPARATED BY CON_TAB.
    CONCATENATE CON_CRET l_string INTO it_objbin.
    APPEND it_objbin.
    LOOP AT IT_FINAL.
    if it_final-lifnr = '0000010065'.
    break-point.
    endif.
    move it_final-dmbtr to dmbtr.
    move it_final-wrbtr to wrbtr.
    move it_final-30days to 30days.
    move it_final-60days to 60days.
    move it_final-90days to 90days.
    move it_final-120days to 120days.
    move it_final-180days to 180days.
    move it_final-above180 to above180.
    move it_final-salds to salds.
    move it_final-saldh to saldh.
    move it_final-acytd_bal to acytd_bal.
    move it_final-zbd1t to zbd1t.
    CONCATENATE
    IT_FINAL-lifnr
    IT_FINAL-name1
    IT_FINAL-belnr
    IT_FINAL-blart
    IT_FINAL-xblnr
    IT_FINAL-bldat
    IT_FINAL-budat
    IT_FINAL-zfbdt
    dmbtr
    IT_FINAL-WAERS
    wrbtr
    30days
    60days
    90days
    120days
    180days
    above180
    *Nondue  TYPE bsik-dmbtr,
    SALDS
    SALDH
    ACYTD_BAL
    INTO L_STRING SEPARATED BY CON_TAB.
    CONCATENATE CON_CRET l_string INTO it_objbin.
    APPEND it_objbin.
    endloop.
    Thanks & Regards,
    Neela

    If you look at the data with some tools, you will see # for the tabs and ## for CRLFs...these are outside the range of printable characters.
    Correct this:
    CONCATENATE CON_CRET l_string INTO it_objbin.
    with...
    CONCATENATE   l_string  CON_CRET INTO it_objbin.  "put the return/linefeed on the end of the string.
    Also, consider.... debug as needed...
    field-symbols <lfs_x> type any.
    loop at it_final into ls_final.
      do.
    assign component sy-index of structure ls_final to <lfs_x>.
    if sy-subrc ne 0. "end of row ecountered.
      exit.
    endif.
    if sy-index eq 1.
    l string = <lfs_x>.
    else.
    concatenate l_string <lfs_x> into l_string separated by con_tab.
    endif.
    enddo.
    concatenate l_string con_ret into l_string.
    condense l_string.
    append l_string to lt_objbin.
    endloop.
    Edited by: BreakPoint on Dec 1, 2011 7:48 PM

  • ALV reports using OOPS

    Hi frnds,
            I want to write an alv report program using oops concepts.CAn anybody send me a simple code to generate an alv reports?
    Thanks a lot in advance.

    Hi
    http://www.sapdev.co.uk/reporting/alv/alvobjgrid/alvobject_sort.htm
    *& Report  ZLCL_ALV_INVOICE                                            *
    REPORT  ZLCL_ALV_INVOICE                        .
    TABLES: VBRK.
    DATA: ITAB LIKE VBRP OCCURS 1 WITH HEADER LINE.
    DATA: O_CONT TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          O_GRID TYPE REF TO CL_GUI_ALV_GRID.
    START-OF-SELECTION.
      SET SCREEN 100.
    *&      Form  GET_DATA
          text
    FORM GET_DATA .
      SELECT *
        FROM VBRP
        INTO TABLE ITAB
        WHERE VBELN = VBRK-VBELN.
    ENDFORM.                    " GET_DATA
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'MENU'.
      IF O_CONT IS INITIAL.
        CREATE OBJECT O_CONT
          EXPORTING
        CONTAINER_NAME              = 'INV_CONT' "Screen custom control name
          EXCEPTIONS
            CNTL_ERROR                  = 1
            CNTL_SYSTEM_ERROR           = 2
            CREATE_ERROR                = 3
            LIFETIME_ERROR              = 4
            LIFETIME_DYNPRO_DYNPRO_LINK = 5
            OTHERS                      = 6
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in custom container'.
          EXIT.
        ENDIF.
        CREATE OBJECT O_GRID
          EXPORTING
            I_PARENT          = O_CONT "Custom container class object
          EXCEPTIONS
            ERROR_CNTL_CREATE = 1
            ERROR_CNTL_INIT   = 2
            ERROR_CNTL_LINK   = 3
            ERROR_DP_CREATE   = 4
            OTHERS            = 5.
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in alv grid linking'.
          EXIT.
        ENDIF.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  SHOW_ALV_GRID  INPUT
          text
    MODULE SHOW_ALV_GRID INPUT.
      PERFORM GET_DATA.
      CALL METHOD O_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME              = 'VBRP'
        CHANGING
          IT_OUTTAB                     = ITAB[]
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          OTHERS                        = 4.
      IF SY-SUBRC <> 0.
        MESSAGE I000(Z00) WITH 'Error in showing alv grid'.
        EXIT.
      ENDIF.
    ENDMODULE.                 " SHOW_ALV_GRID  INPUT
    you can understand very easily

  • Code for Hot spot in ALV report to call transaction

    Hi,
    I  hv never use hot spot to link as a call transaction can u give the link or code how to make hot spot on a particular fields  i am working on a ALV report in that report in the belnr coloumn when user click on belnr i want to call FB03 transaction ref. to that belnr number and fisacl year.
    regards,
      zafar

    Hi,
    In the fieldcatalog you will have to write the hotspot as shown below,
       wa_fieldcat-hotspot   =  'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program       = sy-repid
            i_callback_user_command  = 'USER_COMMAND'"----> this is important
         i_callback_pf_status_set = 'PFSTATUS'
            it_fieldcat              = it_fieldcat
            is_layout                = it_layout
         it_event_exit            = it_eventexit
         i_screen_start_column    = 10
         i_screen_start_line      = 20
         i_screen_end_column      = 70
         i_screen_end_line        = 45
            i_grid_title             = 'Customer-Order Details'
          TABLES
            t_outtab                 = it_data.
    then you will have to catch the user command as follows,
    FORM user_command USING r_ucomm TYPE sy-ucomm
                            rs_selfield TYPE slis_selfield.
      DATA: alv_vbeln TYPE vbeln,
            mess_text(30) TYPE c,
            txt_vbeln(10) TYPE c.
    *User clicks a Order No. in ALV it passed to the following transaction.
      CASE r_ucomm.
        WHEN '&IC1'.
          READ TABLE it_data INDEX rs_selfield-tabindex INTO wa_data.
          alv_vbeln  = wa_data-vbeln..
          IF sy-subrc = 0.
            CLEAR: mess_text, txt_vbeln.
            SUBMIT zprogram
             WITH pr_vbeln = alv_vbeln AND RETURN.
    put your call transaction logic here
          ENDIF.
      ENDCASE.
    ENDFORM.                    "user_command
    Hope it helps you,
    Regards,
    Abhijit G. Borkar

  • ALV report code

    Dear all,
    I get results in rows & columnwise in ALV report. Suppose I select any field & double click , I want to call any function further.
    Pl' tell the example how to give this event action in code ??
    Pl ' give sample examples.....
    Thanks..

    hi
    take help' of  this code
    *& Report  ZTESTDEMO_INTERACTIVE_LIST_2
    REPORT  ZTESTDEMO_INTERACTIVE_LIST_2.
    TABLES: MARA,MARC,MARD.
    * internal table itab_mara 3 fields matnr, ernam,mtart
    DATA: BEGIN OF ITAB_MARA OCCURS 0,
    MATNR LIKE MARA-MATNR,  " material number
    ERNAM LIKE MARA-ERNAM,  " name of person who create
    MTART LIKE MARA-MTART,  " Material Type
    END OF ITAB_MARA.
    * internal table itab_marc 3 fields matnr, werks,lvorm
    DATA: BEGIN OF ITAB_MARC OCCURS 0,
    MATNR LIKE MARC-MATNR,
    WERKS LIKE MARC-WERKS,  " Plant
    LVORM LIKE MARC-LVORM,  " Flag Material for Deletion at Plant Level
    END OF ITAB_MARC.
    * internal table itab_mard 2 fields
    DATA: BEGIN OF ITAB_MARD OCCURS 0,
    MATNR LIKE MARD-MATNR,
    LGORT LIKE MARD-LGORT,  " Storage Location
    END OF ITAB_MARD.
    SELECT-OPTIONS: S_MTART FOR MARA-MTART.
    INITIALIZATION.
    S_MTART-LOW = 'HALB'.
    S_MTART-HIGH = 'HAWA'.
    S_MTART-OPTION = 'BT'.
    APPEND S_MTART.
    START-OF-SELECTION.
    SELECT MATNR ERNAM MTART FROM MARA INTO TABLE ITAB_MARA WHERE MTART IN
    S_MTART.
    PERFORM DISPLAY.
    TOP-OF-PAGE.
    WRITE:/2(15) 'MATERIAL NO',20(20) 'CREATED BY',45(15) 'MATERIAL TYPE'.
    FORM DISPLAY.
    LOOP AT ITAB_MARA.
    WRITE:/ ITAB_MARA-MATNR UNDER 'MATERIAL NO' HOTSPOT ON,ITAB_MARA-ERNAM
    UNDER 'CREATED BY',ITAB_MARA-MTART UNDER 'MATERIAL TYPE'.
    HIDE: ITAB_MARA-MATNR.
    ENDLOOP.
    ENDFORM.
    AT LINE-SELECTION.
    CASE SY-LSIND.
    WHEN 1.
    SELECT MATNR WERKS LVORM FROM MARC INTO TABLE ITAB_MARC WHERE MATNR =
    ITAB_MARA-MATNR.
    PERFORM DISPLAY1.
    WHEN 2.
    SELECT MATNR LGORT FROM MARD INTO TABLE ITAB_MARD WHERE MATNR =
    ITAB_MARC-MATNR.
    PERFORM DISPLAY2.
    when 3.
    sy-lsind = 0.
    ENDCASE.
    FORM DISPLAY1.
    LOOP AT ITAB_MARC.
    WRITE:/ ITAB_MARC-MATNR HOTSPOT ON, ITAB_MARC-WERKS,ITAB_MARC-LVORM.
    HIDE: ITAB_MARC-MATNR.
    ENDLOOP.
    WRITE:/ SY-LSIND.
    ENDFORM.
    FORM DISPLAY2.
    LOOP AT ITAB_MARD.
    WRITE:/ ITAB_MARD-MATNR, ITAB_MARD-LGORT.
    ENDLOOP.
    WRITE:/ SY-LSIND.
    ENDFORM.
    regards
    ravish
    <b>plz reward points if helpful</b>

  • Bar Code in ALV report

    Hello,
          Is it possible to print Barcode(for Work order) in ALV report...

    Hi Perumal
    In ALV there wont be any need for bar code, bcoz barcodes are only printing purpose.
    barcode can be displayed using sapscript in reports.
    regards
    kishore

  • Is there any transaction code for uploding logo in ALV reports.

    is there any transaction code for uploding logo in ALV reports.

    hi,
    call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
                i_logo             = 'Z_LOGO'.
    endform.
    Upload Logo for REUSE_ALV_COMMENTARY_WRITE
    For those who wish to upload and use a picture in your ALV abap reports.
    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 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
    or
    Import Logo and Background Picture for Reporting
    In this step, you can import a customer-specific logo and a background picture into the R/3 System. These will be displayed in the header area of reports in HR Funds and Position Management.
    From the SPRO:
    HR Funds and Position Management --> Dialog Control --> Customize Reporting Interface --> Import Logo and Background Picture for Reporting.
    Activities
    1. Enter the Name of your logo/background picture as an object key in the initial screen.
    2. Make sure that the class name is PICTURES, and the class type is OT.
    3. Choose Execute.
    4. Double-click the document type Picture on the Create tab page. A dialog box will appear in which you can enter the path in which the logo/background picture can be found.
    5. Enter the path and choose Open. The logo will be uploaded into the current R/3 System. If the logo/background picture is to be transported into other systems as well, choose Transport.
    6. Return to the initial screen and repeat the procedure after having entered the Name of your background picture as an object key.
    Please note that the logo/background picture can only be displayed in ALV-based reports with an HTML header. Manually programmed reports such as business distribution plans are not based on the ALV.
    If you have selected several initial objects, ALV-based reports in HR Funds and Position Management will automatically use a hiearchical-sequential display. A logo is not displayed here either. Note also that the logo cannot be printed (see print preview in program).
    Make sure that the logo does not exceed a height of 100 pixels because it would mean that the header of the report will be scrollable.

  • Hi  please send code for displaying index in alv report

    hi
    thanx in advance.
    code please for displaying index in alv report.
    thanx
    rocky

    add one more field to ur internal table
    index type i .
    before u display ALV
    loop at itab.
      itab-index = sy-tabix.
      modify itab index sy-tabix.
    endloop.
    Message was edited by:
            chandrasekhar jagarlamudi

  • Plz send me the code of interctive ALV report

    Hi
    plz send me the code of interctive ALV report
    thanks in advance
    rachu

    Hi
    <u><b>For More alv report examples check  these Tcodes <i>LIBS, BIBS</i>Here u can find more number of examples on alv reports of different kinds</b></u>
    Check this sample code
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
           EBELN LIKE EKKO-EBELN,
           AEDAT LIKE EKKO-AEDAT,
           BUKRS LIKE EKKO-BUKRS,
           BSART LIKE EKKO-BSART,
           LIFNR LIKE EKKO-LIFNR,
           END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
          WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
           EBELN LIKE EKPO-EBELN,
           EBELP LIKE EKPO-EBELP,
           MATNR LIKE EKPO-MATNR,
           MENGE LIKE EKPO-MENGE,
           MEINS LIKE EKPO-MEINS,
           NETPR LIKE EKPO-NETPR,
           END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
          WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    * declaration for events table where user comand or set PF status will
    * be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT.
    * declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    * declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
          I_VARIANT1 TYPE DISVARIANT,
          I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA:  I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA:  I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
      V_REPID = SY-REPID.
      PERFORM BUILD_FIELDCATLOG.
      PERFORM EVENT_CALL.
      PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  BUILD_FIELDCATLOG
    *       Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'AEDAT'.
      WA_FIELDCAT-SELTEXT_M = 'DATE.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'LIFNR'.
      WA_FIELDCAT-NO_OUT    = 'X'.
      WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
    *   we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    *  EXCEPTIONS
    *    LIST_TYPE_WRONG       = 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.                    "EVENT_CALL
    *&      Form  POPULATE_EVENT
    *      Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
      ENDIF.
    ENDFORM.                    "POPULATE_EVENT
    *&      Form  data_retrieval
    *   retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM.                    "data_retrieval
    *&      Form  bUild_listheader
    *       text
    *      -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
      DATA HLINE TYPE SLIS_LISTHEADER.
      HLINE-INFO = 'this is my first alv pgm'.
      HLINE-TYP = 'H'.
    ENDFORM.                    "build_listheader
    *&      Form  display_alv_report
    *       text
    FORM DISPLAY_ALV_REPORT.
      V_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = V_REPID
    *   I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
         I_GRID_TITLE                      = I_TITLE_EKKO
    *   I_GRID_SETTINGS                   =
    *   IS_LAYOUT                         = ALV_LAYOUT
         IT_FIELDCAT                       = I_FIELDCAT[]
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
    *   IT_SORT                           =
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *     i_default                         = 'ZLAY1'
         I_SAVE                            = 'A'
    *     is_variant                        = i_variant
         IT_EVENTS                         = V_EVENTS
        TABLES
          T_OUTTAB                          = IT_EKKO
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "display_alv_report
    *&      Form  TOP_OF_PAGE
    *       text
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
    *    i_logo                   =
    *    I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
    *       text
    *      -->R_UCOMM    text
    *      -->,          text
    *      -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
          READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
          PERFORM BUILD_FIELDCATLOG_EKPO.
          PERFORM EVENT_CALL_EKPO.
          PERFORM POPULATE_EVENT_EKPO.
          PERFORM DATA_RETRIEVAL_EKPO.
          PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
          PERFORM DISPLAY_ALV_EKPO.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG_EKPO
    *       text
    FORM BUILD_FIELDCATLOG_EKPO.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELP'.
      WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MENGE'.
      WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MEINS'.
      WA_FIELDCAT-SELTEXT_M = 'UOM'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'NETPR'.
      WA_FIELDCAT-SELTEXT_M = 'PRICE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG_EKPO
    *&      Form  event_call_ekpo
    *   we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    * EXCEPTIONS
    *   LIST_TYPE_WRONG       = 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.                    "event_call_ekpo
    *&      Form  POPULATE_EVENT
    *        Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT_EKPO.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      ENDFORM.                    "POPULATE_EVENT
    *&      Form  TOP_OF_PAGE
    *       text
    FORM F_TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
    *    i_logo                   =
    *    I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
    *       text
    *      -->R_UCOMM    text
    *      -->,          text
    *      -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM DATA_RETRIEVAL_EKPO.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
    ENDFORM.
    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: HLINE1 TYPE SLIS_LISTHEADER.
    HLINE1-TYP = 'H'.
    HLINE1-INFO = 'CHECKING PGM'.
    ENDFORM.
    FORM DISPLAY_ALV_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = V_REPID
    *   I_CALLBACK_PF_STATUS_SET          = ' '
    *   I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
       I_CALLBACK_TOP_OF_PAGE            = '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_TITLE_EKPO
    *   I_GRID_SETTINGS                   =
    *   IS_LAYOUT                         =
       IT_FIELDCAT                       = I_FIELDCAT[]
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
    *   IT_SORT                           =
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         =
       I_SAVE                            = 'A'
    *   IS_VARIANT                        =
       IT_EVENTS                         = V_EVENTS
      TABLES
        T_OUTTAB                          = IT_EKPO
    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.
    Try this links...
    http://www.****************/Tutorials/ALV/ALVMainPage.htm
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Reward all helpful answers
    Regards
    Pavan
    Message was edited by:
            Pavan praveen

  • ALV report code dumping

    Hello gurus,
    I am trying to write a simple ALV report code. I pasted the code below.
    The program is getting dumped. I am unable to find where the error is.
    Please help me out.
    Thanks in advance.
    Regards,
    Balu
    REPORT  YBP_ALV1                                .
    TABLES  : MARA.
    DATA    : BEGIN OF itab OCCURS 500,
              matnr LIKE mara-matnr,
              ersda LIKE mara-ersda,
              ernam LIKE mara-ernam,
              END OF itab.
    DATA i_repid LIKE sy-repid.
    DATA i_lines LIKE sy-tabix.
    TYPE-POOLS  : slis.
    DATA int_fcat TYPE SLIS_T_FIELDCAT_ALV.
    SELECT-OPTIONS  : s_matnr for mara-matnr matchcode object mat1.
    START-OF-SELECTION.
    select * FROM mara into CORRESPONDING FIELDS OF itab WHERE  matnr in s_matnr.
    ENDSELECT.
    end-of-SELECTION.
    i_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME               = i_repid
    I_INTERNAL_TABNAME           = 'ITAB'
    I_INCLNAME                   = i_repid
    CHANGING
    CT_FIELDCAT                  = int_fcat
    EXCEPTIONS
    INCONSISTENT_INTERFACE       = 1
    PROGRAM_ERROR                = 2
    OTHERS                       = 3.
    IF SY-SUBRC <> 0.
      WRITE: / 'RETURNCODE', sy-subrc, 'from function reuse_alv_fieldcatalog_merge'.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM  = i_repid
    IT_FIELDCAT                    = int_fcat
    I_SAVE                         = 'A'
    TABLES
    T_OUTTAB                       = itab
    EXCEPTIONS
    PROGRAM_ERROR                  = 1
    OTHERS                         = 2.
    IF SY-SUBRC <> 0.
      WRITE :/ 'Returncode', sy-subrc, 'from function reuse_alv_list_display'.
    ENDIF.
    Edited by: Balu on Jan 3, 2008 12:27 PM

    Rich,
    my code after the suggested changes -
    REPORT  YBP_ALV1                                .
    TABLES  : MARA.
    DATA    : BEGIN OF xtab,
              matnr LIKE mara-matnr,
              ersda LIKE mara-ersda,
              ernam LIKE mara-ernam,
              END OF xtab,
              itab LIKE STANDARD TABLE OF xtab WITH HEADER LINE.
    DATA i_repid LIKE sy-repid.
    DATA i_lines LIKE sy-tabix.
    TYPE-POOLS  : slis.
    DATA int_fcat TYPE SLIS_T_FIELDCAT_ALV.
    SELECT-OPTIONS  : s_matnr for mara-matnr matchcode object mat1.
    START-OF-SELECTION.
    select * FROM mara into CORRESPONDING FIELDS OF itab WHERE
      matnr in s_matnr.
    ENDSELECT.
    describe TABLE itab LINES i_lines.
    *if i_lines lt 1.
    write: / 'no material found'.
    exit.
    *endif.
    *clear i_lines.
    end-of-SELECTION.
    i_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = i_repid
       I_INTERNAL_TABNAME           = 'XTAB'
       I_INCLNAME                   = i_repid
      CHANGING
        CT_FIELDCAT                  = int_fcat
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3.
    IF SY-SUBRC <> 0.
      WRITE: / 'RETURNCODE', sy-subrc, 'from function reuse_alv_fieldcatalog_merge'.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM             = i_repid
       IT_FIELDCAT                    = int_fcat
       I_SAVE                         = 'A'
      TABLES
        T_OUTTAB                       = itab
    EXCEPTIONS
       PROGRAM_ERROR                  = 1
       OTHERS                         = 2.
    IF SY-SUBRC <> 0.
      WRITE : / 'Returncode', sy-subrc, 'from function reuse_alv_list_display'.
    ENDIF.
    The dump analysis is as below. Sorry I pasted the wrong analysis before -
    An exception occurred. This exception is dealt with in more detail below
    . The exception, which is assigned to the class 'CX_SY_READ_SRC_LINE_TOO_LONG',
    was neither
    caught nor passed along using a RAISING clause, in the procedure
    "K_KKB_FIELDCAT_MERGE" "(FUNCTION)"
    Since the caller of the procedure could not have expected this exception
    to occur, the running program was terminated.
    The reason for the exception is:
    You tried to read the program "YBP_ALV1" from the database. The READ REPORT
    statement allows you to copy a program's source code into an internal
    table. The lines of source code must not be longer than the width of the
    internal table. The internal table is 72 characters wide. The source
    code line is 80 wide.
    Regards,
    Balu

  • Query regarding calling T-code MIGO from ALV report output

    Dear friends,
    I have to call MIGO transaction  from my ALV report output. Now problem is that I have to set the value 'display' In the first header field, 'Material Document' in 2nd header field when MIGO is called from the report output. Morever there is no parameter ID for these two fields. So how to set the values w/o using parameter ids.
    Regards,
    Rishi

    Hi,
    Try this coding,
    FORM DISPLAY.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM             = SY-REPID
       I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'
       IS_LAYOUT                      = AK_LAYOUT
       IT_FIELDCAT                    = AK_FIELDCAT
      TABLES
       T_OUTTAB                       = ITAB.
    ENDFORM.                    " DISPLAY
    *&      Form  EVENT
    FORM EVENT USING P_AK_EVENT TYPE SLIS_T_EVENT.
      DATA : AK_EVENT1 TYPE SLIS_ALV_EVENT.
      AK_EVENT1-NAME = 'USER_COMMAND'.
      AK_EVENT1-FORM = 'USER_COMMAND'.
      APPEND AK_EVENT1 TO P_AK_EVENT.
    ENDFORM.                    " EVENT
    *&      Form  USER_COMMAND
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                            RS_SELFIELD TYPE SLIS_SELFIELD.
      IF R_UCOMM = '&IC1'.
      " AND SY-LSIND = '1'.
        READ TABLE ITAB INDEX RS_SELFIELD-TABINDEX.
        SET PARAMETER ID 'AUN' FIELD ITAB-BUDAT.
        CALL TRANSACTION 'MIGO' AND SKIP FIRST SCREEN.
      ENDIF.
    ENDFORM.                    " USER_COMMAND
    Regards,
    Nikhil.

  • Authorization of alv report based on plants

    I have created a new alv report for sale order statement.The problem is which can be seen in all plants
    irespective of the user.Suppose our company has 5 palnt
    Plant 1100 to 1500
    The problem is suppose a user he has only rights in a prticular plant but he can see all the palnt sale order details
    How can we authorize this particular alv report based on the plants

    Hello,
    My assumption: You have Company Code(T001-BUKRS) in the selection-screen.
    Plz check the code snippet below:
    DATA:
    IT_PLANT TYPE STANDARD TABLE OF WERKS,
    WA_PLANT LIKE LINE OF IT_PLANT.
    DATA:
    IT_R_WERKS TYPE RANGE_T_WERKS_D,
    R_WERKS TYPE RANGE_S_WERKS_D.
    SELECT BWKEY INTO TABLE IT_PLANT
    FROM T001K
    WHERE BUKRS = '1000'. "--> Here you have to use your sel. scr. parameter
    IF SY-SUBRC = 0.
      SORT IT_PLANT BY WERKS.
    ENDIF.
    LOOP AT IT_PLANT INTO WA_PLANT.
    * Check the authority for the plant
      AUTHORITY-CHECK OBJECT 'M_MSEG_WMB'
               ID 'ACTVT' FIELD '03'
               ID 'WERKS' FIELD WA_PLANT-WERKS.
      IF SY-SUBRC = 0.
        R_WERKS-SIGN = 'I'.
        R_WERKS-OPTION = 'EQ'.
        R_WERKS-LOW = WA_PLANT-WERKS.
        APPEND R_WERKS TO IT_R_WERKS.
        CLEAR R_WERKS.
      ENDIF.
    ENDLOOP.
    IF IT_R_WERKS IS NOT INITIAL.
      "Select data using the Plants for which user is authorised
    ELSE.
      "User has no authority to display any Plant data
    ENDIF.
    Hope this is of some help to you.
    BR,
    Suhas
    Edited by: Suhas Saha on Mar 18, 2009 10:18 AM

  • How to add the dril down functionality in alv report.

    Hi All,
    I have a ALV report and now i want to add drill down functionality in this ALV report.
    See my code below:
    FORM f0002_build_field_catalog.
    Build the field catalog
    CLEAR ws_layout.
    ws_layout-colwidth_optimize = 'X'.
    ws_layout-edit = ' '.
      ws_field_catalog-col_pos = '1'.
      ws_field_catalog-fieldname = 'BUKRS'.
      ws_field_catalog-tabname = 'I_OUTPUT'.
      ws_field_catalog-seltext_l = 'Company Code'.
      ws_field_catalog-seltext_m = 'CCode'.
      ws_field_catalog-seltext_s = 'CCode'.
    ws_field_catalog-fix_column = 'X'.
    ws_field_catalog = 'X'.
    ws_fieldcat-ref_tabname  = 'VBKPF'.
      APPEND ws_field_catalog TO lt_fieldcat.
      CLEAR: ws_field_catalog.
      ws_field_catalog-col_pos = '2'.
      ws_field_catalog-fieldname = 'BELNR'.
      ws_field_catalog-tabname = 'I_OUTPUT'.
      ws_field_catalog-seltext_l    = 'Document no.'.
      ws_field_catalog-hotspot = 'V'.
      ws_field_catalog-seltext_m    = 'Doc.no.'.
      ws_field_catalog-seltext_s    = 'Doc.no.'.
      APPEND ws_field_catalog TO lt_fieldcat.
      CLEAR: ws_field_catalog.
      ws_field_catalog-col_pos = '3'.
      ws_field_catalog-fieldname = 'GJAHR'.
      ws_field_catalog-tabname = 'I_OUTPUT'.
      ws_field_catalog-seltext_l    = 'Year'.
      ws_field_catalog-seltext_m    = 'Year'.
      ws_field_catalog-seltext_s    = 'Year'.
      APPEND ws_field_catalog TO lt_fieldcat.
      CLEAR: ws_field_catalog.
      ws_field_catalog-col_pos = '4'.
      ws_field_catalog-fieldname = 'BSTAT'.
      ws_field_catalog-tabname = 'I_OUTPUT'.
      ws_field_catalog-seltext_l    = 'Status'.
      ws_field_catalog-seltext_m    = 'Status'.
      ws_field_catalog-seltext_s    = 'Status'.
      APPEND ws_field_catalog TO lt_fieldcat.
      CLEAR: ws_field_catalog.
      ws_field_catalog-col_pos = '5'.
      ws_field_catalog-fieldname = 'FLAG'.
      ws_field_catalog-tabname = 'I_OUTPUT'.
      ws_field_catalog-seltext_l    = 'Open/Cleared'.
      ws_field_catalog-seltext_m    = 'Open/Cleared'.
      ws_field_catalog-seltext_s    = 'Open/Cleared'.
      APPEND ws_field_catalog TO lt_fieldcat.
      CLEAR: ws_field_catalog.
      ws_field_catalog-col_pos = '6'.
      ws_field_catalog-fieldname = 'BLART'.
      ws_field_catalog-tabname = 'I_OUTPUT'.
      ws_field_catalog-seltext_l    = 'Doc.Type.'.
      ws_field_catalog-seltext_m    = 'Doc.Type'.
      ws_field_catalog-seltext_s    = 'Doc.Type'.
      APPEND ws_field_catalog TO lt_fieldcat.
      CLEAR: ws_field_catalog.
      ws_field_catalog-col_pos = '7'.
      ws_field_catalog-fieldname = 'WRBTR'.
      ws_field_catalog-tabname = 'I_OUTPUT'.
      ws_field_catalog-seltext_l    = 'Total Amount'.
      ws_field_catalog-seltext_m    = 'Total Amount'.
      ws_field_catalog-seltext_s    = 'Total Amount'.
      APPEND ws_field_catalog TO lt_fieldcat.
      CLEAR: ws_field_catalog.
      ws_field_catalog-col_pos = '8'.
      ws_field_catalog-fieldname = 'WAERS'.
      ws_field_catalog-tabname = 'I_OUTPUT'.
      ws_field_catalog-seltext_l    = 'Currency.'.
      ws_field_catalog-seltext_m    = 'Currency'.
      ws_field_catalog-seltext_s    = 'Currency'.
      APPEND ws_field_catalog TO lt_fieldcat.
      CLEAR: ws_field_catalog.
      ws_field_catalog-col_pos = '9'.
      ws_field_catalog-fieldname = 'LIFNR'.
      ws_field_catalog-tabname = 'I_OUTPUT'.
      ws_field_catalog-seltext_l    = 'Vendor'.
      ws_field_catalog-seltext_m    = 'Vendor'.
      ws_field_catalog-seltext_s    = 'Vendor'.
      APPEND ws_field_catalog TO lt_fieldcat.
      CLEAR: ws_field_catalog.
      ws_field_catalog-col_pos = '10'.
      ws_field_catalog-fieldname = 'NAME1'.
      ws_field_catalog-tabname = 'I_OUTPUT'.
      ws_field_catalog-seltext_l    = 'Vendor Name'.
      ws_field_catalog-seltext_m    = 'Name 1'.
      ws_field_catalog-seltext_s    = 'Name 1'.
      APPEND ws_field_catalog TO lt_fieldcat.
      CLEAR: ws_field_catalog.
      ws_field_catalog-col_pos = '11'.
      ws_field_catalog-fieldname = 'UZAWE'.
      ws_field_catalog-tabname = 'I_OUTPUT'.
      ws_field_catalog-seltext_l    = 'Payment Method Supplement'.
      ws_field_catalog-seltext_m    = 'PmtMthSuppl'.
      ws_field_catalog-seltext_s    = 'PmtMthSuppl'.
      APPEND ws_field_catalog TO lt_fieldcat.
      CLEAR: ws_field_catalog.
      ws_field_catalog-col_pos = '12'.
      ws_field_catalog-fieldname = 'XBLNR'.
      ws_field_catalog-tabname = 'I_OUTPUT'.
      ws_field_catalog-seltext_l    = 'Reference'.
      ws_field_catalog-seltext_m    = 'Ref. No.'.
      ws_field_catalog-seltext_s    = 'Ref. No.'.
      APPEND ws_field_catalog TO lt_fieldcat.
      CLEAR: ws_field_catalog.
    g_variant-report  = sy-repid.
       CLEAR struct_extab.
      MOVE '&XPA' TO struct_extab-fcode.
      APPEND struct_extab TO i_extab.
      MOVE '&OMP' TO struct_extab-fcode.
      APPEND struct_extab TO i_extab.
    Display the list
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
          i_callback_program      = ws_repid
          i_callback_user_command = 'HANDLE_USER_COMMAND'
         is_layout               = ws_layout
          it_fieldcat             = lt_fieldcat[]
          it_excluding            = i_extab[]
         i_default                = 'X'
         i_save                  =  'U'  "For user variants
         is_variant              = g_variant
        TABLES
          t_outtab                = i_output.
    ENDFORM.                    "f0002_build_field_catalog
    *&      Form  f0038_pf_status
          text
         -->I_EXTAB    text
    FORM f0038_pf_status USING i_extab TYPE slis_t_extab.       "#EC CALLED
      CLEAR struct_extab.
      MOVE '&XPA' TO struct_extab-fcode.
      APPEND struct_extab TO i_extab.
      MOVE '&OMP' TO struct_extab-fcode.
      APPEND struct_extab TO i_extab.
      SET PF-STATUS 'Z_PFSTATUS2' EXCLUDING i_extab.
    ENDFORM.                     "f0038_pf_status
    Pls tell me how i use this below dril down ability functionality in my code.
    See the requirement below.
    The Document Number, aka Accounting Document Number (BELNR) of each row will take the user to the appropriate document to edit as follows:
    For Parked documents:-
    If VBKPF-AWTYP (Reference Procedure) = “RMRP”, then the drilldown functionality should be to MIR4 using the Object ID in VBKPF- AWKEY. In this scenario the Object ID represents a Invoice Document Number, not an Accounting Document Number. Not the Object ID is a combination of Invoice Document Number and Fiscal Year
    If VBKPF-AWTYP = Any other value, then the drilldown functionality should be to FBV2 using the Object ID in VBKPF-AWKEY. In this scenario the Object ID represents a true Accounting Document Number. Note the Object ID is a combination of Company Code (VBKPF-BUKRS), Accounting Document Number (VBKPF-BELNR) and Fiscal Year (VBKPF-GJAHR)
    For Posted, not Cleared documents:-
    Drilldown ability should be to FB02. The combination of Company Code (BSIK-BUKRS), Accounting Document Number (BSIK-BELNR) and Fiscal Year (BSIK-GJAHR) will be used to open/drilldown to the correct document in FB02.
    For Cleared documents:-
    Drilldown ability should be to FB03. The combination of Company Code (BSIK-BUKRS), Accounting Document Number (BSIK-BELNR) and Fiscal Year (BSIK-GJAHR) will be used to open/drilldown to the correct document in FB03.
    Its very urgent, pls help on this.
    Thanks!
    Vipin

    Pls refer :
    https://wiki.sdn.sap.com/wiki/display/Snippets/ABAPInteractiveALVwithCallTransaction%28usingParameterID%29
    https://wiki.sdn.sap.com/wiki/display/Snippets/ABAPInteractiveALV+Program
    Regards,
    Anish Thomas
    Pls reward all useful answers

Maybe you are looking for