cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to Pass parameter value from MD04 to custom tcode

RaghavanKathamuthu
Active Contributor

Accepted Solutions (1)

Accepted Solutions (1)

Dominik_Tylczynski
SAP Champion
SAP Champion

Hello @RaghavanKathamuthu 

You don't need to set values for material number, plant, MRP area, MRP controller and planning scenario. These are preset dynamically based on the current values in MD04 - include MM61RF90_GLOBAL_PID_SET:

FORM GLOBAL_PID_SET USING MATNR LIKE MARC-MATNR
                          WERKS LIKE MARC-WERKS
                          BERID LIKE RM61R-BERID
                          PLSCN LIKE RM61R-PLSCN
                          DISPO LIKE MDKP-DISPO.        "46c

*--> Material übergeben
  IF NOT MATNR IS INITIAL.
    SET PARAMETER ID 'MAT' FIELD MATNR.
  ENDIF.
*--> Werk übergeben
  IF NOT WERKS IS INITIAL.
    SET PARAMETER ID 'WRK' FIELD WERKS.
  ENDIF.
*--> Dispobereich übergeben
  IF NOT BERID IS INITIAL.
*    IF NOT T000MD-DISFG IS INITIAL.
      SET PARAMETER ID 'BERID' FIELD BERID.
*    ENDIF.
  ENDIF.
*--> Szenario übergeben
  IF NOT PLSCN IS INITIAL.
    SET PARAMETER ID 'PLS' FIELD PLSCN.
  ENDIF.
*--> Disponent übergeben     new 46c
  IF NOT DISPO IS INITIAL.
    SET PARAMETER ID 'DGR' FIELD DISPO.
  ENDIF.

ENDFORM.

Then a transaction defined in a navigation profile is called by CALL_TRANSACTION_ERP function. You can put a breakpoint there and see how PIDs are handled. Global PIDs are passed to the transaction as well as any additional PIDs defined in the navigation profile. Values of the additional PIDs can be static only, i.e. hard coded in the navigation profile configuration.

Unfortunately MDVP that you intend to call doesn't read PID WRK for production plant selection criterion. The PID is not defined for S_WERKS in MDVP - include RLD05TOP:

SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE text-bl2.
SELECT-OPTIONS:
  s_plnum   FOR plsv-plnum,
  s_werks   FOR plaf-plwrk, "<--- missing MEMORY ID wrk
  s_dispo   FOR plaf-dispo,
  s_fevor   FOR plaf-plgrp,
  s_matnr   FOR plsv-matnr  MATCHCODE OBJECT mat1.
* Selektionskriterien für Serienaufträge
SELECT-OPTIONS so_verid FOR rm61e-verid.
sel_opt_mdv0x ra_mdv01 ra_mdv02.
SELECT-OPTIONS s_mdpbv   FOR plaf-mdpbv.
PARAMETERS pa_kapfx LIKE iocsel-av_kapfx.
PARAMETERS pa_peonl LIKE rm61e-kzpeonly.
PARAMETERS pa_nmont LIKE iocsel-av_no_mont.
SELECTION-SCREEN END OF BLOCK bl2.

S_WERKS misses MEMORY ID wrk addition. 

Therefore, you can't call MDVP from MD04 and pass plant value, unless you modify S_WERKS definition in MDVP and add the missing MEMORY ID addition.

Best regards

Dominik Tylczynski

Answers (1)

Answers (1)

Prasath
Contributor

Hello Raghavan, You can enter the Parameter ID as selection screen navigated transaction and you get it from Technical information under field data.

MD04 Navigation Profile-1.jpg

Also, you can enter the parameter value as Plant, Example mine case plant US01

MD04 Navigation Profile.jpg

Happy to help if anything needed.

Regards

Prasath

RaghavanKathamuthu
Active Contributor
0 Kudos
can we pass it dynamically from the input screen of md04 like hotspot
heinz_lutsch
Explorer
0 Kudos
We face the same issue. It is not the parameter, but how can the parameter value be processed dynamically for a custom transaction dependent on plant and material number? Is there an easy way or must this be assed in the program code? Maybe there is a note explaning this.
Dominik_Tylczynski
SAP Champion
SAP Champion
0 Kudos
That won't work because MDVP doesn't read PID WRK