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

Selecting view in MM03 (not manually)

Former Member
0 Likes
5,348

Hi all,

In my report am displaying all the material number and its details. If i click any material number then it has to call transaction MM03. After calling transaction MM03 defaultly it is selecting view Accounting but i have to display basic data has a selected view..How to write code to select view in MM03..

1 ACCEPTED SOLUTION
Read only

graghavendra_sharma
Contributor
0 Likes
2,897

can you send me the code .. how you are calling MM03?

Hi all,

In my report am displaying all the material number and its details. If i click any material number then it has to call transaction MM03. After calling transaction MM03 defaultly it is selecting view Accounting but i have to display basic data has a selected view..How to write code to select view in MM03..

7 REPLIES 7
Read only

Former Member
0 Likes
2,897

can u send me ur code so tht i can make changes to tht one only?

Read only

graghavendra_sharma
Contributor
0 Likes
2,898

can you send me the code .. how you are calling MM03?

Read only

0 Likes
2,897

Actually am displaying the datas ALV grid format. if i click the matnerial number it has to call MM03 and defaultly it has to select view Basic data.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = SY-REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

IS_LAYOUT = W_LAYOUT

IT_FIELDCAT = FIELDCAT1

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = I_OUT.

CLEAR : V_COL , S_KOSTL.

CLEAR : RET_TAB[] , S_KOSTL[] , I_COSTCENTER_LIST[].

&----


*& Form USER_COMMAND

&----


  • text

----


  • -->P_UCOMM text

  • -->P_SELFIELD text

----


FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM

P_SELFIELD TYPE SLIS_SELFIELD.

IF P_UCOMM = '&IC1'.

IF P_SELFIELD-FIELDNAME = 'MBLNR' AND P_SELFIELD-VALUE IS NOT INITIAL.

READ TABLE I_MKPF INTO WA_MKPF WITH KEY MBLNR = P_SELFIELD-VALUE.

SET PARAMETER ID 'MBN' FIELD P_SELFIELD-VALUE.

SET PARAMETER ID 'MJA' FIELD WA_MKPF-MJAHR.

CALL TRANSACTION 'MB03' AND SKIP FIRST SCREEN.

CLEAR: P_UCOMM.

ENDIF.

*am having probliem in this statement

IF P_SELFIELD-FIELDNAME = 'MATNR' AND P_SELFIELD-VALUE IS NOT INITIAL.

READ TABLE I_MKPF INTO WA_MKPF WITH KEY MATNR = P_SELFIELD-VALUE.

SET PARAMETER ID 'MAT' FIELD P_SELFIELD-VALUE.

CALL TRANSACTION 'MM03' . "AND SKIP FIRST SCREEN.

CLEAR: P_UCOMM.

ENDIF.

ENDIF.

ENDFORM. "USER_COMMAND<b></b>

Read only

0 Likes
2,897

In MM03, you set Basic data as defualt view and <save> it. That should work.

Read only

0 Likes
2,897

Hi

Please try to make use of FM: <b>MATERIAL_BTCI_SELECTION_NEW</b>.

This will help you.

I hope below code can help you:

PARAMETERS: P_MATNR TYPE MATNR.

DATA: BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE.
DATA: BDCDATA1 TYPE TABLE OF BDCDATA.

START-OF-SELECTION.

PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0060'.
PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                              'RMMG1-MATNR'.
PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                              '=ENTR'.
PERFORM BDC_FIELD       USING 'RMMG1-MATNR'
                              P_MATNR.

CALL FUNCTION 'MATERIAL_BTCI_SELECTION_NEW'
  EXPORTING
    MATERIAL                        = P_MATNR
*   MATERIALART                     = 'ROH'
    SELECTION                       = 'K' " --> Basic Data
    TCODE                           = 'MM03'
* IMPORTING
*   SELSTATUS                       =
*   SELSTATUS_IN                    =
  TABLES
    BTCI_D0070                      = BDCDATA1
 EXCEPTIONS
   MATERIAL_NOT_FOUND              = 1
   MATERIAL_NUMBER_MISSING         = 2
   MATERIAL_TYPE_MISSING           = 3
   MATERIAL_TYPE_NOT_FOUND         = 4
   NO_ACTIVE_DYNPRO_SELECTED       = 5
   NO_AUTHORITY                    = 6
   OTHERS                          = 7.

APPEND LINES OF BDCDATA1 TO BDCDATA.
CALL TRANSACTION 'MM03' USING BDCDATA MODE 'E'.

*----------------------------------------------------------------------*
*        START NEW SCREEN                                              *
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
  CLEAR BDCDATA.
  BDCDATA-PROGRAM  = PROGRAM.
  BDCDATA-DYNPRO   = DYNPRO.
  BDCDATA-DYNBEGIN = 'X'.
  APPEND BDCDATA.
ENDFORM.

*----------------------------------------------------------------------*
*        INSERT FIELD                                                  *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
    CLEAR BDCDATA.
    BDCDATA-FNAM = FNAM.
    BDCDATA-FVAL = FVAL.
    APPEND BDCDATA.
ENDFORM.

Kind Regards

Eswar

Message was edited by: Addition of Sample Code

Eswar Rao Boddeti

Read only

Former Member
0 Likes
2,897

Hi,

Go to MM03 and give the material number and click views.

If the the Account view is selected then come back and in the first screen of mm03 in the menu options defaults> views> it will display the view screen now select the basic data view and say ok.

This solve your problem.

BR,

Ravi

Read only

amit_khare
Active Contributor
0 Likes
2,897

hi,

Just use SELECTION_VIEWS_FIND function module to dynamically select the view.

For Example.

call function 'BDC_OPEN_GROUP'

exporting

group = 'Z5AK_MM02'

keep = 'X'

user = 'DEVELOPER'.

if sy-subrc <> 0.

message e016.

endif.

loop at it_mater.

select single vpsta from mara into v_vpsta where matnr = it_mater-v_matnum.

call function 'SELECTION_VIEWS_FIND'

exporting

bildsequenz = '21'

pflegestatus = v_vpsta

tables

bildtab = i_bildtab.

endloop.

loop at i_bildtab where guifu = 'SP04'.

concatenate 'MSICHTAUSW-KZSEL(' i_bildtab-idxbd ')' into v_var.

endloop.

loop at it_mater.

clear it_bdc.

it_bdc-program = 'SAPLMGMM'.

it_bdc-dynpro = '0060'.

it_bdc-dynbegin = 'X'.

append it_bdc.

clear it_bdc.

it_bdc-fnam = 'RMMG1-MATNR'.

it_bdc-fval = it_mater-v_matnum.

append it_bdc.

clear it_bdc.

it_bdc-fnam = 'BDC_OKCODE'.

it_bdc-fval = '/00'.

append it_bdc.

clear it_bdc.

it_bdc-program = 'SAPLMGMM'.

it_bdc-dynpro = '0070'.

it_bdc-dynbegin = 'X'.

append it_bdc.

clear it_bdc.

it_bdc-fnam = 'BDC_OKCODE'.

it_bdc-fval = '=RESA'.

append it_bdc.

clear it_bdc.

it_bdc-program = 'SAPLMGMM'.

it_bdc-dynpro = '0070'.

it_bdc-dynbegin = 'X'.

append it_bdc.

clear it_bdc.

it_bdc-fnam = v_var.

it_bdc-fval = 'X'.

append it_bdc.

  • CLEAR it_bdc.

  • it_bdc-fnam = 'MSICHTAUSW-KZSEL(03)'.

  • it_bdc-fval = 'X'.

  • APPEND it_bdc.

clear it_bdc.

it_bdc-fnam = 'BDC_OKCODE'.

it_bdc-fval = '=ENTR'.

append it_bdc.

clear it_bdc.

it_bdc-program = 'SAPLMGMM'.

it_bdc-dynpro = '0080'.

it_bdc-dynbegin = 'X'.

append it_bdc.

clear it_bdc.

it_bdc-fnam = 'RMMG1-WERKS'.

it_bdc-fval = it_mater-v_werks.

append it_bdc.

clear it_bdc.

it_bdc-fnam = 'RMMG1-VKORG'.

it_bdc-fval = it_mater-v_sales.

append it_bdc.

clear it_bdc.

it_bdc-fnam = 'RMMG1-VTWEG'.

it_bdc-fval = it_mater-v_channel.

append it_bdc.

clear it_bdc.

it_bdc-fnam = 'BDC_OKCODE'.

it_bdc-fval = '=ENTR'.

append it_bdc.

clear it_bdc.

it_bdc-program = 'SAPLMGMM'.

it_bdc-dynpro = '4000'.

it_bdc-dynbegin = 'X'.

append it_bdc.

clear it_bdc.

it_bdc-fnam = 'BDC_OKCODE'.

it_bdc-fval = '=BU'.

append it_bdc.

*call transaction 'Z5AK3' using it_bdc mode 'N' MESSAGES INTO ITAB.

call function 'BDC_INSERT'

exporting

tcode = 'MM02'

tables

dynprotab = it_bdc.

if sy-subrc <> 0. .

message e016.

endif.

refresh it_bdc.

endloop.

call function 'BDC_CLOSE_GROUP'.

if sy-subrc <> 0.

message e017.

endif.

Regards,

Amit