cancel
Showing results for 
Search instead for 
Did you mean: 

How to Pass parameter value from MD04 to custom tcode

RaghavanKathamuthu
Active Contributor
View Entire Topic
DominikTylczyn
Active Contributor

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