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

Skip OK Code in BDC

Former Member
0 Likes
1,861

Hi experts,

I did a BDC recording for MM03 & created a program. When i execute the program it gives me the OK Code screen & asks to press ENTER. Same happens for further screens to reach MRP1 screen.But use dont want to do that.

They want to see the MRP1 screen directly.

I am calling this BDC in my ALV report to Display the MRP1 data for a material.

Please give me some Ideas to solve this problem

Regards,

Nik

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,326

Hi Nikhil,

You need to use FM MATERIAL_MAINTAIn_DIALOGUE to call the MRP screen directly.

Regards,

Atish

7 REPLIES 7
Read only

Former Member
0 Likes
1,326

Code is attached here:

FORM BDC_CALL_MRP1 .

PERFORM bdc_dynpro USING 'SAPLMGMM' '0060'.

PERFORM bdc_field USING 'BDC_CURSOR' 'RMMG1-MATNR'.

PERFORM bdc_field USING 'RMMG1-MATNR' p_matnr.

PERFORM bdc_field USING 'BDC_OKCODE' '=AUSW'.

PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.

PERFORM bdc_field USING 'BDC_CURSOR' 'MSICHTAUSW-DYTXT(09)'.

PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(09)' 'X'.

PERFORM bdc_field USING 'BDC_OKCODE' '=ENTR'.

PERFORM bdc_dynpro USING 'SAPLMGMM' '0080'.

PERFORM bdc_field USING 'BDC_CURSOR' 'RMMG1-WERKS'.

PERFORM bdc_field USING 'RMMG1-WERKS' 'BP22'.

PERFORM bdc_field USING 'BDC_OKCODE' '=ENTR'.

clear bdcdata1.

CALL FUNCTION 'MATERIAL_BTCI_SELECTION_NEW'

EXPORTING

material = p_matnr

materialart = 'ROH'

selection = 'D' " --> MRP Data

tcode = 'MM03'

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 'A'.

CLEAR: p_matnr, bdcdata.

ENDFORM. " BDC_CALL_MRP1

  • ----------------------------------------------------------------------

  • start new screen *

  • ----------------------------------------------------------------------

FORM bdc_dynpro USING program dynpro.

CLEAR bdcdata.

bdcdata-program = program.

bdcdata-dynpro = dynpro.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

ENDFORM. "prepare_attachment

  • ----------------------------------------------------------------------

  • insert field *

  • ----------------------------------------------------------------------

FORM bdc_field USING fnam fval.

CLEAR bdcdata.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

APPEND bdcdata.

ENDFORM. "prepare_attachment

Read only

Former Member
0 Likes
1,327

Hi Nikhil,

You need to use FM MATERIAL_MAINTAIn_DIALOGUE to call the MRP screen directly.

Regards,

Atish

Read only

0 Likes
1,326

Hi Atish,

What are the parameters i have to pass in that FM

CALL FUNCTION 'MATERIAL_MAINTAIN_DIALOGUE'

EXPORTING

IRMMG1 = ' '

IRMMG1_REF = ' '

KZ_EIN_DARK = ' '

T_TCODE =

FLG_MATNR_RES = ' '

P_PSTAT = ' '

FLG_STAT_ALL = ' '

CALL_MODE2 = ' '

IMPORTING

MATERIAL_NO =

UPDATE_OK =

TABLES

IAUSWG =

EXCEPTIONS

NO_AUTHORITY = 1

OTHERS = 2

Regards,

Nik

Read only

0 Likes
1,326

HI Nikhil,

Just search forum you will find sample code related to this.

Regards,

Atish

Read only

0 Likes
1,326

Hi Atish,

I searched but only found 1 thread regarding this FM & it also has no comments regardinf this FM.

There is No document for this function module in SAP & where use list only giving 1 result which is passing the tcode only to the FM.

If you have an idea wht are the parameters i have to pass to go directly to MRP1 subscreen it wil be a great help for me.

I treid using that FM by only passing T code 'MM03' it is opening MM03 when i click on material but i want to go to MRP1 screen.

Also when press back it has to come to the ALV report but it is comint out from the report.

Regards,

Nik

Read only

0 Likes
1,326

check below sample code

REPORT zsritest.

TABLES mara.

DATA: lv_bilds LIKE t133a-bilds,

ls_t130m LIKE t130m,

ls_rmmg1 LIKE rmmg1,

lwa_view TYPE mbildtab,

lwa_auswg TYPE mgauswg,

lt_views TYPE STANDARD TABLE OF mbildtab INITIAL SIZE 0,

lt_auswg TYPE STANDARD TABLE OF mgauswg INITIAL SIZE 0.

PARAMETERS: p_matnr LIKE mara-matnr,

p_werks LIKE marc-werks,

p_dytxt LIKE mbildtab-dytxt.

SELECT SINGLE * FROM mara WHERE matnr EQ p_matnr.

CHECK sy-subrc EQ 0.

CALL FUNCTION 'T130M_SINGLE_READ'

EXPORTING

tcode = 'MM03'

kzrfb = 'X'

IMPORTING

wt130m = ls_t130m

EXCEPTIONS

not_found = 1

wrong_call = 2

OTHERS = 3.

CALL FUNCTION 'BILDSEQUENZ_IDENTIFY'

EXPORTING

branche = mara-mbrsh

materialart = mara-mtart

tcode_ref = ls_t130m-trref

KZRFB = ' '

IMPORTING

bildsequenz = lv_bilds

KZ_BILDS_CHANGED =

EXCEPTIONS

wrong_call = 1

not_found = 2

OTHERS = 3.

CALL FUNCTION 'SELECTION_VIEWS_FIND'

EXPORTING

bildsequenz = lv_bilds

pflegestatus = mara-pstat

TABLES

bildtab = lt_views[]

EXCEPTIONS

call_wrong = 1

empty_selection = 2

OTHERS = 3.

ls_rmmg1-matnr = mara-matnr.

ls_rmmg1-werks = p_werks.

READ TABLE lt_views INTO lwa_view WITH KEY dytxt = p_dytxt.

CHECK sy-subrc EQ 0.

lwa_auswg-auswg = lwa_view-auswg.

APPEND lwa_auswg TO lt_auswg.

CALL FUNCTION 'MATERIAL_MAINTAIN_DIALOGUE'

EXPORTING

irmmg1 = ls_rmmg1

IRMMG1_REF = ' '

KZ_EIN_DARK = 'X'

t_tcode = 'MM03'

FLG_MATNR_RES = ' '

p_pstat = mara-pstat

FLG_STAT_ALL = ' '

CALL_MODE2 = ' '

IMPORTING

MATERIAL_NO =

UPDATE_OK =

TABLES

iauswg = lt_auswg[]

EXCEPTIONS

no_authority = 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.

Try with a material, plant and "MRP 2" as p_dytxt. Use this code as reference to arrive at your own logic based on the data you have at hand at the time of call.

Regards,

Atish

Read only

0 Likes
1,326

Hi Atish,

You logic is working fine for my scenario. Thanks Mate.

Regards,

Nik