Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Create a custom program..

Former Member
0 Likes
425

Hello Friends,

I have to create a ALV report which has a material number as a first field in the ALV and when click the material number i should call MM03 with the selected material number.

and cursor should be hotpot..

please give me soluction .. I new to R/3.. if possible coding will help me very useful..

advance thanks,

John.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
405

I just so happen to have a little example program showing that.



report zrich_0001.

* Global ALV Data Declarations
type-pools: slis.

* Internal Tables
data: begin of itab occurs 0,
      matnr type mara-matnr,
      maktx type makt-maktx,
      end of itab.

start-of-selection.

  perform get_data.
  perform call_alv.

*********************************************************************
*      Form  GET_DATA
*********************************************************************
form get_data.

  select mara~matnr makt~maktx
          into corresponding fields of table itab
               from mara
                 inner join makt
                  on mara~matnr = makt~matnr
                             up to 20 rows.

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)
  call function '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'.
          set parameter id 'MAT' field rs_selfield-value.
          call transaction 'MM03' and skip first screen.
      endcase.
  endcase.

endform.

Regards,

Rich Heilman

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
406

I just so happen to have a little example program showing that.



report zrich_0001.

* Global ALV Data Declarations
type-pools: slis.

* Internal Tables
data: begin of itab occurs 0,
      matnr type mara-matnr,
      maktx type makt-maktx,
      end of itab.

start-of-selection.

  perform get_data.
  perform call_alv.

*********************************************************************
*      Form  GET_DATA
*********************************************************************
form get_data.

  select mara~matnr makt~maktx
          into corresponding fields of table itab
               from mara
                 inner join makt
                  on mara~matnr = makt~matnr
                             up to 20 rows.

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)
  call function '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'.
          set parameter id 'MAT' field rs_selfield-value.
          call transaction 'MM03' and skip first screen.
      endcase.
  endcase.

endform.

Regards,

Rich Heilman

Read only

0 Likes
405

Hello,

anyone knows how to skip the first screen in the vendor master display 'MK03' from the ALV report.

I have vendor number the ALV report and when I click vendor # it should take mw to MK03 and skip the first screen.

Thanks,

John.

Read only

0 Likes
405

Hello Friends,

I have found a soluction by myself. Thanks for your greek help. Please help me furhter come..

Thanks,

John.