cancel
Showing results for 
Search instead for 
Did you mean: 

How to get lgort from initial screen in MDG for materials

0 Kudos

Hello,

We implement MDG for materials 8.0.

I’m faced with issue when trying to get value from the initial screen for the CR type MAT02 ( edit material ) at the specified storage location <LGORT>. I can’t find reference to the variables from the initial selection screen.

I try to use the BadI USMD_SSW_RULE_CONTEXT_PREPARE with adding the <LGORT> for the decision tables in BRF+ (User Agent Decision tables) .

I have following code

…..

* test get type of CR

CALL METHOD read_crequest

EXPORTING
iv_cr_number = iv_cr_number

IMPORTING
es_crequest = lv_crequest.


CALL METHOD read_material

EXPORTING
iv_cr_number = iv_cr_number

IMPORTING
es_material = ls_material.

….

I’m going to get necessary <LGORT> at the structure LS_MATERIAL which is equal to value from initial screen.

Could you give me advance, how to solve this problem.

Best regards,

Natalia

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hello,

I would like to add few words:

I’m faced with issue if material has been already created on different storage location level.

I use the BadI USMD_SSW_RULE_CONTEXT_PREPARE with adding the <LGORT> for the decision tables in BRF+ .

I need to determine person who will be approved CR on level LGORT, which is equal to value from initial screen.

I need to get value from the initial screen for the CR type MAT02 ( edit material ) at the specified storage location <LGORT>.

….

The METHOD read_material:

. . .

CALL METHOD lr_model->create_data_reference

EXPORTING
i_fieldname = if_mdg_bs_mat_gen_c=>GC_FIELDNAME_MARDSTOR
i_struct = lr_model->gc_struct_key_attr
if_table = abap_true
i_tabtype = lr_model->gc_tabtype_sorted

IMPORTING
er_data = lr_data.

ASSIGN lr_data->* TO <lt_data>.

CLEAR lt_sel.
ls_sel-fieldname = if_mdg_bs_mat_gen_c=>gc_fieldname_material.
ls_sel-sign = lc_incl.
ls_sel-option = lc_equal.
ls_sel-low = lv_matnr.INSERT ls_sel INTO TABLE lt_sel.
ls_sel-fieldname = usmd0_cs_fld-crequest.
ls_sel-low = iv_cr_number.INSERT ls_sel INTO TABLE lt_sel.
CALL METHOD lr_model->read_char_value

EXPORTING
i_fieldname = if_mdg_bs_mat_gen_c=>gc_fieldname_MARDSTOR
it_sel = lt_sel
i_readmode = if_usmd_model_ext=>gc_readmode_default
if_use_edtn_slice = abap_false

IMPORTING
et_data = <lt_data>.

...

<lt_data>contain ALL lgort, which material was extended.

I’m going to get the needed <LGORT> at the structure LS_MATERIAL which is equal to value from initial screen (only one).

For solution my problem , I try to use this method:

Data : LV_RS_INITIAL_SCREEN_VALUES TYPE MDG_BS_MAT_S_MP_SETTINGS_DATA.

CALL METHOD CL_MDG_BS_MAT_SETTINGS=>GET_INITIAL_SCREEN_VALUES(
RECEIVING
RS_INITIAL_SCREEN_VALUES = LV_RS_INITIAL_SCREEN_VALUES ).

Unfortunately this method does not work correctly.

LV_RS_INITIAL_SCREEN_VALUES is empty.

Where is my error ?

Please, explain in code or something that how to get lgort from initial screen. ?

Best regards, Natalia

0 Kudos

Hello Natalia,

Can you please advise if you were able to fix this issue? I have received a similar issue when we are trying to execute a few scripts based of the template material number?