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

ALV ...Logic required

Former Member
0 Likes
3,140

Hi every body,

I have one requirement like an alv report will display

output which contains a material number.

<b>If i click On the material number it shud go to MM03...Accounting view

Logic required for this.</b>I am a beginner ...Plz help me...

Thanks in advance.

Message was edited by: raja gurrala

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,957

srinivas,

Thanks for ur clarification.

I confused with Fcode...

<b>Some body telling '&1c1' n u ...'DSP_MAT'

what is this where did i get this Fcode?</b>I had one more requirement ...

<b>IF i click on PO number ..which is shown in output ..it should display ME23 screen...what is the Fcode for this?

I am Novice..plz help me.</b>Dont mind if this is simple issue?

Hi,

MAT and BES are the parameter id linked with the fieldname.

U can see that like goto table mara example,

double click on the dataelement > Goto Further Characteristics tab > in that u can seee the parameter id linked.

If u r using a transaction just do an F1 on the fieldname ex material no: then press technical information button, u can see the parameter id at the bottom of the pop up.

Rss selfield name is the name that u r defining in the final internal table ex: i_output has matnr like mara-matnr, then that matnr is the selfield name.

If u specify as material like mara-matnr then material is the selfield name.

Hope u got clarified, else get back.

Reward ponts for those who helped to clarify u.

U can reward for the answers which ever helped u.

Message was edited by: Judith Jessie Selvi

27 REPLIES 27
Read only

Former Member
0 Likes
2,957

when wver you double click on the material,

sy-ucomm will be &IC1.

so select the record from the ouput internal table .

then

call transaction 'MM03' and skip first screen.

tO select the record from the internal atble by using the RSSELFIELD.

Read only

Former Member
0 Likes
2,957

Hi,

See the code sample,

INCLUDE <icon>.
* Predefine a local class for event handling to allow the
* declaration of a reference variable before the class is defined.
CLASS lcl_event_receiver DEFINITION DEFERRED.

DATA : o_alvgrid          TYPE REF TO cl_gui_alv_grid ,
       o_dockingcontainer TYPE REF TO cl_gui_docking_container ,
       o_eventreceiver    TYPE REF TO lcl_event_receiver,
       wa_layout TYPE lvc_s_layo ,
       wa_variant TYPE disvariant.

CONSTANTS : c_a(1) TYPE c VALUE 'A' ,                     " All Layouts
            c_x(1) TYPE c VALUE 'X'.
CLASS lcl_event_receiver DEFINITION.

  PUBLIC SECTION.
    CLASS-METHODS:
* Hot Spot Click
       handle_hotspot
         FOR EVENT hotspot_click OF cl_gui_alv_grid
            IMPORTING e_row_id
                      e_column_id
                      es_row_no,
* Double Click
 handle_double_click
      FOR EVENT double_click OF cl_gui_alv_grid
          IMPORTING e_row
                    e_column
                    es_row_no,
ENDCLASS.                    "lcl_event_receiver DEFINITION
* Implementation
CLASS lcl_event_receiver IMPLEMENTATION.
*&---------------------------------------------------------------------*
*&      Method handle_hotspot
*&---------------------------------------------------------------------*
* This method is called when the user clicks on a hotspot to drill down.
* The following types are exported from the ALV
* LVC_S_ROW
* LVC_S_COL
* LVC_S_ROID
*&---------------------------------------------------------------------*
  METHOD handle_hotspot.
* The hotspot processing coded in the form below.
    PERFORM f9900_handle_hotspot USING e_row_id
                                       e_column_id
                                       es_row_no.

  ENDMETHOD.                    "handle_hotspot
*&---------------------------------------------------------------------*
*&      Method handle_double_click
*&---------------------------------------------------------------------*
  METHOD handle_double_click.
* The double click processing should be coded in the form below.
    PERFORM f9901_handle_double_click USING e_row
                                            e_column
                                            es_row_no.

  ENDMETHOD.                    "HANDLE_DOUBLE_CLICK
FORM f9900_handle_hotspot  USING    p_row_id
                                    p_column_id
                                    p_row_no.

*Read internal table for proper value.
  READ TABLE  i_output
              INDEX p_row_id
              INTO wa_output.
* Call the transaction MMBE
  SET PARAMETER ID 'MAT' FIELD wa_output-matnr.
  CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
ENDFORM.                    " f9900_handle_hotspot
*&---------------------------------------------------------------------*
*&      Form  f9901_handle_double_click
*&---------------------------------------------------------------------*
*       Double Click
*----------------------------------------------------------------------*
FORM f9901_handle_double_click  USING    p_row
                                         p_column
                                         p_row_no.

  READ TABLE i_output INDEX p_row INTO wa_output.

  CASE p_column.
    WHEN 'MATNR'.
      IF NOT wa_output-matnr IS INITIAL.
        SET PARAMETER ID 'MAT' FIELD wa_output-matnr.
        CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
      ENDIF.
  ENDCASE.
ENDFORM.                    " f9901_handle_double_click

U can use either hot spot or double click event.

If u r using hotspot set the hotspot = 'X' in fieldcatalog.

Hope this helps.

OR another method without oops concept

FORM user_command USING r_ucomm LIKE sy-ucomm
                  rs_selfield TYPE slis_selfield.
data:lv_matnr    LIKE v_mmim_lc-matnr,   "Material
read table i_output into w_output index rs_selfield-tabindex.
lv_matnr = w_output-matnr.
SET PARAMETER ID 'MAT' FIELD lv_matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
Clear:     lv_matnr.
ENDFORM.

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          = 'SET_PF_STATUS'
<b>     i_callback_user_command           = 'USER_COMMAND'</b>
     i_background_id        = 'ALV_BACKGROUND'
    IS_LAYOUT               = I_LAYOUT
    it_fieldcat             = i_fieldcat "field catalog
   I_SAVE                   = 'A'
   IS_VARIANT               = G_VARIANT
    TABLES
        t_outtab                       = i_output "output table
   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.

Kindly reward points if this helps u, revert back with queries.

Message was edited by: Judith Jessie Selvi

Read only

Former Member
0 Likes
2,957

MCG thanks for ur reply.

what is &1C1?

I am not aware of this RSSSelf field..?

can u just write this 4 lines of code for me..

I am using Fmodules..no class methods...

Plz explain in detail...

Read only

0 Likes
2,957

WHEN '&IC1'.

IF SELFIELD-FIELDNAME = 'MATNR'.

SET PARAMETER ID 'MAT' FIELD SELFIELD-VALUE.

CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.

ENDIF.

Read only

0 Likes
2,957

Hi,

If u want to place a button in ur application toolbar and then by selecting a row fron ur grid and if u press that button it will call a transaction.

That is what MCG has explained.

In that case u have to create a button by going to Screen Painter then give MAT or like &1C1 as he told for the button function code.

Then give a description by double clicking that.

Then in the PAI of ur screen

MODULE user_command_9001 INPUT.

* For getting the row selected
  REFRESH i_fieldrows.
  CALL METHOD o_alvgrid->get_selected_rows
    IMPORTING
      et_index_rows = i_fieldrows.

  LOOP AT i_fieldrows INTO wa_fieldrows.
    READ TABLE i_output INTO wa_output INDEX wa_fieldrows-index.
  ENDLOOP.

  CASE sy-ucomm.
    WHEN 'MAT'.
      IF NOT wa_output-matnr IS INITIAL.
        SET PARAMETER ID 'MAT' FIELD wa_output-matnr.
        CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
      ENDIF.
    WHEN OTHERS.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_9001  INPUT

Also u can create button by double clicking the YSTATUS.
MODULE  status_9001 OUTPUT.

  IF o_dockingcontainer IS INITIAL.
    SET PF-STATUS <b>'YSTATUS'.</b>
    SET TITLEBAR  'YTITLE'.
*   Creating Object
    PERFORM f9000_objects_create.
*   Building the field catalog
    PERFORM f9001_build_field_cat TABLES i_fieldcat
                            USING 'MARC'.
*   Modifying the field catalog
    PERFORM f9002_modify_field_cat TABLES i_fieldcat.
*   For Layout
    PERFORM f9003_layout USING sy-title 'X' 'B' 'X' .
*   To display output
    PERFORM f9004_display_data TABLES i_output
                                      i_fieldcat.
  ENDIF.

ENDMODULE.                 " STATUS_9001  OUTPUT

If u dont want Class then

FORM user_command USING r_ucomm LIKE sy-ucomm
                  rs_selfield TYPE slis_selfield.
data:lv_matnr    LIKE v_mmim_lc-matnr,   "Material
read table i_output into w_output index rs_selfield-tabindex.
lv_matnr = w_output-matnr.
SET PARAMETER ID 'MAT' FIELD lv_matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
Clear:     lv_matnr.
ENDFORM.
 
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                =
*   I_BUFFER_ACTIVE                   = ' '
     i_callback_program                = v_repid
<b>     i_callback_pf_status_set          = 'SET_PF_STATUS'
     i_callback_user_command           = 'USER_COMMAND'</b>
     i_background_id        = 'ALV_BACKGROUND'
    IS_LAYOUT               = I_LAYOUT
    it_fieldcat             = i_fieldcat "field catalog
   I_SAVE                   = 'A'
   IS_VARIANT               = G_VARIANT
    TABLES
        t_outtab                       = i_output "output table
   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.

Hope this helps.

Message was edited by: Judith Jessie Selvi

Read only

0 Likes
2,957

Hi,

It is quite obvous that when you click the matnr field in alv diplay, MM03 will be called and probably you will want that Material Number to be set in that MM03 screen field..thats why you were told to track on User command &IC1 and get the value from RS_SELFFEILD-value.

something like this...

if r-ucomm = '&IC1'.

set parameter ID 'MAT' field RS_SELFIELD-value.

CALL TRANSACTION 'MM03'.

Endif.

you must set the hotspot attribute of matnr field in alv display, while creating the field-catalog.

and write this code snippet to handle the hotspot click, in user_command module

Read only

Former Member
0 Likes
2,957

FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM "#EC *

SELFIELD TYPE SLIS_SELFIELD. "#EC *

CASE UCOMM.

WHEN '&IC1'.

IF SELFIELD-FIELDNAME = 'MATNR'.

SET PARAMETER ID 'MAT' FIELD SELFIELD-VALUE.

CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.

ENDIF.

endcase.

endform

Read only

Former Member
0 Likes
2,957

Hi Judith,

I think almost i got the solution.

How this Fmodule 'USER_COMMAND' gets called.

what we need to declare in the progtam?

what i_ouput meant for ?

Plz explain the procedure ...How the process goes..so that i can understand better..

My requirement starts from ...clicking on the material number...explain from that point..

your answer will be appreciated.

Read only

0 Likes
2,957

all function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = w_repid2

i_grid_title = w_title

i_bypassing_buffer = c_xflag_alv_flg

i_grid_settings = st_settings

is_layout = st_layout

it_sort = it_sort

it_fieldcat = it_fieldcat

it_events = it_events

i_callback_user_command = 'user_comand'

i_default = c_xflag_alv_flg

i_save = c_aflag_alv_flg

is_variant = w_variant2

tables

t_outtab = it_alv_data

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.

When ever we call the alv list display function module the function module call the form user_command.

If the form user_command you write the code for calling the 'MM03'

Read only

0 Likes
2,957

Hi,

The form user-command gets called explicitly when any action takes place, that is when u click on the material number this will automatically calls the form.

So in the reuse FM dont forget to call User_command.

This will call the form.

i_output is nothing but ur final internal table that is getting displayed in ur output grid.

U might be havibng some differnt name then u can use that where ever needed.

Get back if any further queries.

Read only

0 Likes
2,957

Hi Raja,

USER_COMMAND is not a function module but it is a routine that you have to define in your program. When the ALV is displayed, any user action on the ALV grid will trigger this routine and the control comes to you to do whatever you want to do. In this routine you will write the logic that others have provided.

In other words, your USER_COMMAND routine should look something like this.


form user_command using ucomm    like sy-ucomm
                        selfield type slis_selfield.

  data: l_line like myalvitab,
        l_matnr like mara-matnr.

  read table myalvitab index selfield-tabindex
                             into l_line.
  move myalvitab-matnr to l_matnr.
  case ucomm.
    when 'DSP_MAT'.
*-- Set the parameter ID for the material
    set parameter id 'MAT' field l_matnr.

    call transaction 'MM03' and skip first screen.

endform.

Read only

Former Member
0 Likes
2,957

Hi Guys..

Thanks to all of u.

Ucomm = &1C1 like that..know

<b>I had one more requirement like..

If i click on the PO number if shud goto ME23...</b>what is the UCOMM code for this???

Your answers will be appreciated

Read only

0 Likes
2,957

Ucomm is nothing but the function code u r giving.Eg. In pf-status u r writing code to exit from the program then u will pass that to ucomm = 'EXIT'.

Do the same and note the mandatory fields for the transaction then find the parameter-id for the mandt fields and then call transaction.

If u have two fields mandt then

for eg: this will call MD04

    WHEN 'MATNR'.
      IF NOT wa_output-matnr IS INITIAL.
        SET PARAMETER ID 'MAT' FIELD wa_output-matnr.
        SET PARAMETER ID 'WRK' FIELD wa_output-werks.
        CALL TRANSACTION 'MD04' AND SKIP FIRST SCREEN .
      ENDIF.

Similarly u can proceed.

Read only

0 Likes
2,957

WHEN '&IC1'.

IF SELFIELD-SEL_TAB_FIELD = 'IT_PO_DATA-EBELN'.

READ TABLE IT_PO_DATA INDEX SELFIELD-TABINDEX.

SET PARAMETER ID 'BES' FIELD it_po_data-ebeln.

CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

enidif

here also sy-ucomm is '&IC1'.

Read only

Former Member
0 Likes
2,958

srinivas,

Thanks for ur clarification.

I confused with Fcode...

<b>Some body telling '&1c1' n u ...'DSP_MAT'

what is this where did i get this Fcode?</b>I had one more requirement ...

<b>IF i click on PO number ..which is shown in output ..it should display ME23 screen...what is the Fcode for this?

I am Novice..plz help me.</b>Dont mind if this is simple issue?

Read only

0 Likes
2,957

Ok, when you are calling the ALV grid function module, are you giving any PF-STATUS? You will do this by passing a routine name to this parameter of the function module I_CALLBACK_PF_STATUS_SET, In this routine, you will set your own PF-STATUS. You can define your own menu options and buttons in this case, but then you will not be able to use the standard ALV functions. In my example, I was talking about a scenario where I use my own function key.

If you see '&1C1', that means they are assuming you are using standard ALV function code for double click. Assuming you are not setting your own menu, you should use this code for UCOMM not the custom one that I mentioned. For displaying a PO you will do exactly as you did in the material display case, but you will set the parameter BES instead of MAT.

To know exactly which field the user double clicked, you will have that information in the field FIELDNAME of the parameter selfield(type slis_selfield).

Srinivas

Srinivas

Read only

0 Likes
2,957

Hi Raja,

Here is small code for you -

<b>

REPORT ZTEST.

TYPE-POOLS SLIS.

DATA FLCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA WA LIKE LINE OF FLCAT .

TABLES MARA.

DATA I_MARA LIKE MARA OCCURS 0 WITH HEADER LINE.

SELECT * UP TO 10 ROWS INTO TABLE I_MARA FROM MARA.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_STRUCTURE_NAME = 'MARA'

CHANGING

CT_FIELDCAT = FLCAT

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LOOP AT FLCAT INTO WA WHERE FIELDNAME = 'MATNR'.

WA-HOTSPOT = 'X'.

MODIFY FLCAT FROM WA.

ENDLOOP.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = 'ZTEST34'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

IT_FIELDCAT = FLCAT

TABLES

T_OUTTAB = I_MARA

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.

&----


*& Form USER_COMMAND

&----


  • text

----


  • -->UCOMM text

  • -->SELFIELD text

----


FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM

SELFIELD TYPE SLIS_SELFIELD.

CASE UCOMM.

WHEN '&IC1'.

IF SELFIELD-FIELDNAME = 'MATNR'.

SET PARAMETER ID 'MAT' FIELD SELFIELD-VALUE.

CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.

ENDIF.

ENDCASE.

ENDFORM. "USER_COMMAND</b>

Above is for material & MM03. Now if you want to have hotspot on your PO number field , you will have to modify your field catalog for the corresponding field i.e. EBELN. In your field catalog you should have EBELN.

Then in routine USER_COMMAND ->

<b> IF SELFIELD-FIELDNAME = 'EBELN'.

SET PARAMETER ID 'BES' FIELD SELFIELD-VALUE.

CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.

ENDIF.</b>

Cheers.

Sanjay

Read only

0 Likes
2,957

Dont confuse with fcode

do simply as below

FORM user_command USING r_ucomm LIKE sy-ucomm
                  rs_selfield TYPE slis_selfield.

read table i_output into w_output index rs_selfield-tabindex.
lv_matnr = w_output-matnr.
IF SELFIELD-FIELDNAME = 'MATNR'.
SET PARAMETER ID 'MAT' FIELD lv_matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .

lv_ebeln = w_output-ebeln.
ELSEIF SELFIELD-FIELDNAME = 'EBELN'.
SET PARAMETER ID 'BES' FIELD lv_ebeln.
CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
ENDIF.

Clear:     lv_matnr, lv_ebeln.
ENDFORM.

Read only

Former Member
0 Likes
2,957

Thanks i got clarification about Fcode..

<b>Then what abt this 'MAT' for material number..and

'BES' for PO...How do u know abt this?

RSS selffield name is always matnr , EBEln...?

depends on final itab</b>

Message was edited by: raja gurrala

Read only

0 Likes
2,957

just press f1 and f9 for the field PO #in me23 . There will be something called parameter id.this is BES.

Read only

0 Likes
2,957

MAT, BES etc are parameter ids for the fields in those transaction screens. Go to the corresponding transactions, press F1 and go to the technical info, you will see the parameter info there.

RS_SELFIELD will contain the name of the internal table fieldname where the user double clicked. Since you were asking about going to MM03, ME23, we took those two names.

Srinivas

Read only

0 Likes
2,957

Hi,

MAT and BES are the parameter id linked with the fieldname.

U can see that like goto table mara example,

double click on the dataelement > Goto Further Characteristics tab > in that u can seee the parameter id linked.

If u r using a transaction just do an F1 on the fieldname ex material no: then press technical information button, u can see the parameter id at the bottom of the pop up.

Rss selfield name is the name that u r defining in the final internal table ex: i_output has matnr like mara-matnr, then that matnr is the selfield name.

If u specify as material like mara-matnr then material is the selfield name.

Hope u got clarified, else get back.

Reward ponts for those who helped to clarify u.

U can reward for the answers which ever helped u.

Message was edited by: Judith Jessie Selvi

Read only

0 Likes
2,957

Hi,

If you get the accouting view after some screens from MM03,you can run a BDC to fill the data required upto that screen.

By this way,you can directly get the corresponding screen.

Kindly reward points if it helps.

Read only

Former Member
0 Likes
2,957

HI every body,

Please advice me

if i click on the material number..i need to go to MM03--accounting view..

can any body plz send me the code...

Read only

0 Likes
2,957

Hey,

What happened is this code not working?

FORM user_command USING r_ucomm LIKE sy-ucomm
                  rs_selfield TYPE slis_selfield.
 
read table i_output into w_output index rs_selfield-tabindex.
lv_matnr = w_output-matnr.
IF SELFIELD-FIELDNAME = 'MATNR'.
SET PARAMETER ID 'MAT' FIELD lv_matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .

If u want to goto some other screens in the transaction after calling MM03 then u have to run BDC.

Kindly close the thread if ur problem got solved.

Or revert back.

Message was edited by: Judith Jessie Selvi

Read only

Former Member
0 Likes
2,957

Judith,

I need to go to<b> accounting view</b> directly by clicking on Material number..cud any body provide some solution..

Plz hlep me

Read only

0 Likes
2,957

If u want to goto some other screens in the transaction after calling MM03 then u have to run <b>BDC</b>.

Goto SHDB and then do a recording until u reach the screen u want.

Then see the source code copy and paste the changes in ur original prgoram where u r calling transaction.

IF .....
SET PaRA.....
Perform call transaction.

Declare a messtab
Form call transaction.
DATA: i_bdcdata TYPE STANDARD TABLE OF bdcdata,
* Internal table to hold BDC messages
i_messtab TYPE STANDARD TABLE OF bdcmsgcoll

* Work area to hold bdcdata value
DATA: w_bdcdata TYPE bdcdata,
* Work area to hold BDC messages
w_messtab TYPE bdcmsgcoll.
CONSTANTS : c_e type bdcmsgcoll-msgtyp value 'E', "E
c_a type bdcmsgcoll-msgtyp value 'A', "A
nodata type c value '/'. "/
perform f1000_bdc_mm03 using lv_matnr lv_werks.
FORM f1000_bdc_mm03 USING P_LV_MATNR
P_LV_WERKS.

perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
p_lv_matnr.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(15)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(15)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '0080'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-WERKS'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMG1-WERKS'
p_lv_werks.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=ZU01'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_dynpro using 'SAPLMGMM' '4300'.
perform bdc_field using 'BDC_OKCODE'
'=ZU08'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_dynpro using 'SAPLMGMM' '4110'.
perform bdc_field using 'BDC_OKCODE'
'=GESV'.
*perform bdc_field using 'BDC_CURSOR'
* 'RMMG1-MATNR'.
call transaction c_transaction_call_MM03 using i_bdcdata MODE 'N'MESSAGES INTO i_messtab.
ENDFORM.

Hope this solves ur problem.