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

Start MD48 with pre values

Former Member
0 Likes
1,516

Hi,

I want to run the md48 and when the transaction starts i want to fill the Material field with one value that come from the program that calls the transaction and give the ok code to go to the screen that gives the information of the material.

basicly what i want is, i have a program, he calls the transaction M48 and pass the value for material and gives ok without the user see, and then what the user sees is the screen with the details of the material.

Thanks

Hi,

I want to run the md48 and when the transaction starts i want to fill the Material field with one value that come from the program that calls the transaction and give the ok code to go to the screen that gives the information of the material.

basicly what i want is, i have a program, he calls the transaction M48 and pass the value for material and gives ok without the user see, and then what the user sees is the screen with the details of the material.

Thanks

10 REPLIES 10
Read only

Former Member
0 Likes
1,447

Hi Ricardo,

You can use the option

<b>SET PARAMETER ID pid FIELD f.</b>

and <b>CALL TRANSACTION..SKIP FIRST SCREEN</b>

Consider this sample code.


REPORT zztest.

DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE.

START-OF-SELECTION.
  SELECT * FROM mara INTO TABLE it_mara UP TO 10 ROWS.

  LOOP AT it_mara.

    SET PARAMETER ID mat FIELD it_mara-matnr.

    CALL TRANSACTION 'MD48'
    AND SKIP FIRST SCREEN.

  ENDLOOP.

<b>Other option.</b>

Alternatively you can do a <b>partial BDC recording</b> and then pass the values for the Material.

Regards,

AS

Message was edited by: Arun Sambargi

Read only

Former Member
0 Likes
1,447

Hi ricardo,

1. simple

2. just copy paste

3. just change the material number,

as per your variable.

4.

report abc.

*----


data : bdcdata like table of bdcdata with header line.

clear bdcdata.

perform bdcfield using 'X' 'SAPMM61M' '0103'.

perform bdcfield using '' 'RM61M-MATNR' '30046'.

perform bdcfield using '' 'RM61M-USPRF' 'SAPMPS'.

perform bdcfield using '' 'BDC_OKCODE' '=TCAL'.

*----


call transaction 'MD48' using bdcdata mode 'A'.

*----


*

*----


FORM bdcfield USING p1 p2 p3.

CLEAR bdcdata.

IF p1 = 'X'.

bdcdata-dynbegin = 'X'.

bdcdata-program = p2.

bdcdata-dynpro = p3.

ELSE.

bdcdata-fnam = p2.

bdcdata-fval = p3.

ENDIF.

APPEND bdcdata.

ENDFORM. "show_bdcmsg

regards,

amit m.

Read only

0 Likes
1,447

Hi again,

1. the field layout is selected

via the code.

see bold.

( i had already mentioned this code in the previous reply)

data : bdcdata like table of bdcdata with header line.

clear bdcdata.

perform bdcfield using 'X' 'SAPMM61M' '0103'.

perform bdcfield using '' 'RM61M-MATNR' '30046'.

<b>perform bdcfield using '' 'RM61M-USPRF' 'SAPMPS'.</b>

perform bdcfield using '' 'BDC_OKCODE' '=TCAL'

where SAPMPS is the name of the layout.

regards,

amit m.

Read only

Former Member
0 Likes
1,447

The Material field in the MD48 has a parameterID attached to it, called MAT.

Assign the matnr value to this ID, and then call transaction as follows:

SET PARAMETER ID 'MAT' field matnr.

CALL TRANSACTION 'MD48' AND SKIP FIRST SCREEN.

Hope this helps.

Sudha

Message was edited by: Sudha Mohan

Read only

Former Member
0 Likes
1,447

And the field layout how do i fill it?

Read only

Former Member
0 Likes
1,447

i've used this code:

SET PARAMETER ID pid FIELD f.

and CALL TRANSACTION..SKIP FIRST SCREEN

Consider this sample code.

REPORT zztest.

DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE.

START-OF-SELECTION.

SELECT * FROM mara INTO TABLE it_mara UP TO 10 ROWS.

LOOP AT it_mara.

SET PARAMETER ID mat FIELD it_mara-matnr.

CALL TRANSACTION 'MD48'

AND SKIP FIRST SCREEN.

ENDLOOP.

but he does't skip the first screen because it gives a warning message before skip the first screen. can i skip this?

Read only

Former Member
0 Likes
1,447

Hi Ricardo,

If we analyze the transaction MD48

There are two mandatory parameters:

<b>1)Material

2)Layout.</b>

So we have to pass values for both the fields

Consider this corrected code.


REPORT zztest.

DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE,
       layout TYPE rm61m-usprf.




START-OF-SELECTION.

  layout = 'SAPMPS'.
  SELECT * FROM mara INTO TABLE it_mara UP TO 10 ROWS.

  LOOP AT it_mara.

    SET PARAMETER ID 'MAT' FIELD it_mara-matnr. "Material

  <b> SET PARAMETER ID 'UPR' FIELD layout.         "Layout</b> 


    CALL TRANSACTION 'MD48'
    AND SKIP FIRST SCREEN.

  ENDLOOP.



Test and let me know if ant errors.

Regards,

AS

Read only

Former Member
0 Likes
1,447

it jumps to the first screen with all the values correct but with a warning saying "Verify entry".and i press enter and he goes to the screen i want.

Read only

0 Likes
1,447

hi,

I think its because of incomplete records.

Working on it. Will let you know.

Regards,

AS

Read only

0 Likes
1,447

Hi Ricardo,

This is the default setting for the transaction. Every time a value is entered , it prompts to check the entry.

You can avoid this by doing a partial BDC recording and calling the transaction in <b>Error mode only</b>.

Consider this code.


REPORT zztest.

DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE,
       layout TYPE rm61m-usprf.

DATA:   bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.


START-OF-SELECTION.

 <b> layout = 'SAPMPS'.</b>

  SELECT * FROM mara INTO TABLE it_mara UP TO 2 ROWS.

  LOOP AT it_mara.


    PERFORM bdc_dynpro      USING 'SAPMM61M' '0103'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.

    PERFORM bdc_field       USING 'RM61M-MATNR'
                                  it_mara-matnr.
    PERFORM bdc_field       USING 'RM61M-USPRF'
                                  layout.
<b>    CALL TRANSACTION 'MD48'
    USING bdcdata
    MODE   'E'.</b>
  ENDLOOP.



*----------------------------------------------------------------------*
*        Start new screen                                              *
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
  CLEAR bdcdata.
  bdcdata-program  = program.
  bdcdata-dynpro   = dynpro.
  bdcdata-dynbegin = 'X'.
  APPEND bdcdata.
ENDFORM.                    "BDC_DYNPRO

*----------------------------------------------------------------------*
*        Insert field                                                  *
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.

  CLEAR bdcdata.
  bdcdata-fnam = fnam.
  bdcdata-fval = fval.
  APPEND bdcdata.

ENDFORM.                    "BDC_FIELD

Regards,

AS.