Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8667

Re: ALV List Interactive from Top of Page

$
0
0

Refer to the sample program below.

 

report zrich_0001.

 

 

* Global ALV Data Declarations

type-pools: slis.

 

* Internal Tables

data: beginof itab occurs 0,

      matnr type mara-matnr,

      maktx type makt-maktx,

      endof itab.

 

start-of-selection.

 

  perform get_data.

  perform call_alv.

 

*********************************************************************

*      Form  GET_DATA

*********************************************************************

form get_data.

 

  select mara~matnr makt~maktx

          intocorrespondingfieldsoftable itab

              from mara

                innerjoin makt

                  on mara~matnr = makt~matnr

                            upto20rows.

 

endform.

 

************************************************************************

*  CALL_ALV

************************************************************************

form call_alv.

 

  data: ifc type slis_t_fieldcat_alv.

  data: xfc type slis_fieldcat_alv.

  data: repid type sy-repid.

 

  repid = sy-repid.

 

  clear xfc.refresh ifc.

 

  clear xfc.

  xfc-reptext_ddic = 'Material Number'.

  xfc-fieldname  = 'MATNR'.

  xfc-tabname    = 'ITAB'.

  xfc-outputlen  = '18'.

  append xfc to ifc.

 

  clear xfc.

  xfc-reptext_ddic = 'Material Description'.

  xfc-fieldname  = 'MAKTX'.

  xfc-tabname    = 'ITAB'.

  xfc-outputlen  = '40'.

  append xfc to ifc.

 

* Call ABAP List Viewer (ALV)

  callfunction'REUSE_ALV_GRID_DISPLAY'

      exporting

            i_callback_program    = repid

            i_callback_user_command = 'HANDLE_USER_COMMAND'

            it_fieldcat            = ifc

      tables

            t_outtab              = itab.

 

endform.

 

***********************************************************************

*      FORM handle_User_Command                                      *

***********************************************************************

form handle_user_command using r_ucomm    like sy-ucomm

                              rs_selfield type slis_selfield.

 

  case r_ucomm.

    when'&IC1'.

 

    case rs_selfield-FIELDNAME.

      when'MATNR'.

        setparameterid'MAT'field rs_selfield-value.

        calltransaction'MD04'andskipfirstscreen.

 

 

      endcase.

 

 

  endcase.

 

endform.

Regards,

Thanga


Viewing all articles
Browse latest Browse all 8667

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>