SAP Tutorials Blog

 

 

REPORT  ZSIMPLEALVREPORT.



type-pools : slis.

data:   it_fieldcat type slis_t_fieldcat_alv,

        lt_top_of_page type slis_t_listheader,

        ls_layout      type slis_layout_alv,

        gt_events      type slis_t_event.


data : begin of t_lips occurs 0,

          vbeln type lips-vbeln ,

          brgew type lips-brgew,

       end of t_lips.


data : begin of t_vttp occurs 0,

          vbeln type vttp-vbeln,

          tknum type vttp-tknum,

       end of t_vttp.


data : begin of t_vttp2 occurs 0,

          brgew type lips-brgew,

          tknum type vttp-tknum,

       end of t_vttp2.


data :  wa_fieldcat like line of it_fieldcat.


parameters : so like lips-vgbel.



start-of-selection.

*****data selection part***

  perform data_selection.

******data display*****

  perform data_display.

*


form data_selection .


select

  vbeln

  brgew

  from lips into CORRESPONDING FIELDS OF TABLE t_lips

  WHERE vgbel = so.


   SELECT  vbeln

           tknum

    from vttp into CORRESPONDING FIELDS OF TABLE t_vttp

    for ALL ENTRIES IN t_lips[]

    where vbeln = t_lips-vbeln.


Loop at t_lips.

  read table t_vttp WITH key vbeln = t_lips-vbeln.

     t_vttp2-brgew = t_lips-brgew.

     t_vttp2-tknum = t_vttp-tknum.

  APPEND t_vttp2.

  endloop.


endform.                    " DATA_SELECTION



form data_display .


  perform get_values.

  perform grid_display.


endform.                    " DATA_DISPLAY



form get_values .


  wa_fieldcat-fieldname = 'BRGEW'.

  wa_fieldcat-ref_tabname = 'T_VTTP2'.

  wa_fieldcat-seltext_l = 'GROSS WEIGHT'.

  wa_fieldcat-outputlen = 20.

  wa_fieldcat-col_pos     = '1'.

  append wa_fieldcat to it_fieldcat.

  clear wa_fieldcat.




  wa_fieldcat-fieldname = 'TKNUM'.

  wa_fieldcat-ref_tabname = 'T_VTTP2'.

  wa_fieldcat-seltext_l = 'SHIPMENT NO.'.

  wa_fieldcat-outputlen = 20.

  wa_fieldcat-col_pos     = '2'.

  append wa_fieldcat to it_fieldcat.

  clear wa_fieldcat.




endform.                    " GET_VALUES


form grid_display .


  call function 'REUSE_ALV_GRID_DISPLAY'


  exporting

    i_callback_program                = sy-cprog

    is_layout                         = ls_layout

    it_fieldcat                       = it_fieldcat[]


   it_events                         = gt_events[]

   tables

     t_outtab                          = t_vttp2[]

 exceptions

  program_error                     = 1

  others                            = 2

           .

  if sy-subrc <> 0.


  endif.



endform.  


Serkan AKKAVAK

Computer Engineer BSc

SAP Department Manager

Contact : serkurumsal@yandex.com