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

ABAP Memory

Former Member
0 Likes
1,835

Hi ! I am calling a transaction(Standard Report - ME1P) from within my report. Now, as soon as the user clicks on the Material Name in the Calling Report ALV screen the next screen from ME1P should come for the respective material and the vendor.

Using the code in the calling program:-


CASE LV_UCOMM.
 WHEN '&IC1'.
      READ TABLE DISP INDEX SELFIELD-TABINDEX.
      IF SY-SUBRC = 0.
        CASE SELFIELD-FIELDNAME.
          WHEN 'TXZ01'.
            SET PARAMETER ID 'LIF' FIELD DISP-LIFNR.
            SET PARAMETER ID 'MAT' FIELD DISP-MATNR.
            CALL TRANSACTION 'ME1P' AND SKIP FIRST SCREEN.
        ENDCASE.
     ENDIF.
 ENDCASE.

Now, how can I pass the correct material and vendor number to Transaction ME1P ?

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,740

Try this



data:i_params type table of RSPARAMS.
data:wa_params type rsparams.

CASE LV_UCOMM.
 WHEN '&IC1'.
      READ TABLE DISP INDEX SELFIELD-TABINDEX.
      IF SY-SUBRC = 0.
        CASE SELFIELD-FIELDNAME.
          WHEN 'TXZ01'.

wa_params-selname = 'TK_MATNR'.
wa_params-kind = 'S'.
wa_params-sign = 'I'.
wa_params-option = 'EQ'.
wa_params-low = DISP-MATNR
append wa_params to i_params.


wa_params-selname = 'IF_LIFNR'.
wa_params-kind = 'S'.
wa_params-sign = 'I'.
wa_params-option = 'EQ'.
wa_params-low = DISP-LIFNR
append wa_params to i_params.

  CALL FUNCTION 'SUBMIT_REPORT'
    EXPORTING
      report                 = 'RM06IBP0'
      SKIP_SELSCREEN         = 'X' 
    TABLES
     SELECTION_TABLE        = i_params[]
  EXCEPTIONS
     JUST_VIA_VARIANT       = 1
     NO_SUBMIT_AUTH         = 2
     OTHERS                 = 3
            .
  IF sy-subrc <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
endif.
 ENDCASE.

14 REPLIES 14
Read only

Former Member
0 Likes
1,740

Hi,

Instead of mere CALL TRANSACTION , try with CALL TRANSACTION using BDC DATA ( recorded screen input data).

Hope this may help you.

Regards,

Smart Varghese

Read only

0 Likes
1,740

Actually I tried every possibility, But the thing is that the material no. which is getting passed using the parameter ID is not correct. No matter on which material no. the user clicks, the wrong material no. is coming in the parameter ID. That is why we need to use the ABAP memory to pass the material no.

Please help.

Read only

0 Likes
1,740

In complement of Smart Varghese answer, you should use MODE 'E' so that to remain on the ME1P screen. Note: to fill <itab> of the CALL TRANSACTION ... USING <itab> (BDC DATA as he says), you may use SHDB transaction to see what it should contain.

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,740

Check the screen-field name , i guess for ME1P the selection screen is generated rather than simply defining the parameters.

Read only

0 Likes
1,740

Through the Call Transaction, I am passing 2 values - 1.material No. & 2 Vendor No..

Vendor number is coming correctly, but the Material no. is coming wrong.

Read only

Former Member
0 Likes
1,740

Hi,

In the SELFIELD Structure you will have the line selected value.

and by the below given example you can set the set the values

set PARAMETER ID 'BES' FIELD 'that work area value'.

call TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

With Regards,

Sumodh.P

Read only

Former Member
0 Likes
1,740

Hi ,

Instead of CALL TRANSACTION , USE SUBMIT.

Please check the below code .( Run the below code , which will give you an idea).

REPORT ZTEST.

data: rspar_line TYPE rsparams,

rspar_tab TYPE TABLE OF rsparams.

rspar_line-selname = 'IF_LIFNR'.

rspar_line-kind = 'S'.

rspar_line-sign = 'I'.

rspar_line-option = 'EQ'.

rspar_line-low = '100'. " Change the LIFNR value 100 with your VALUE

APPEND rspar_line TO rspar_tab.

rspar_line-selname = 'TK_MATNR'.

rspar_line-kind = 'S'.

rspar_line-sign = 'I'.

rspar_line-option = 'EQ'.

rspar_line-low = 'P2420000001'. " Change the MATNR value P2420000001 with your VALUE

APPEND rspar_line TO rspar_tab.

SUBMIT RM06IBP0 using selection-SCREEN '1000'

with SELECTION-TABLE rspar_tab

and return.

Hope this will help you.

Regards,

Smart

Read only

0 Likes
1,740

Actually what happens is that, the user runs the ALV report ZPOREPORT and he gets a list of Material Number, Material name , Vendor Name etc..

As soon as the user clicks on the Material name, it goes to ME1P transaction with that line specific material no. and the vendor code to pull the purchase order history.

Read only

0 Likes
1,740

Hi ,

WHEN '&IC1'.

READ TABLE DISP INDEX SELFIELD-TABINDEX.

IF SY-SUBRC = 0.

CASE SELFIELD-FIELDNAME.

WHEN 'TXZ01'.

Comment the below 3 lines.

          • SET PARAMETER ID 'LIF' FIELD DISP-LIFNR.

          • SET PARAMETER ID 'MAT' FIELD DISP-MATNR.

          • CALL TRANSACTION 'ME1P' AND SKIP FIRST SCREEN.

Here new code.

PERFORM call_ME1P using <LIFNR> <MATNR>.

ENDCASE.

ENDIF.

ENDCASE.

This is the subroutine code.

FORM call_ME1P using <LIFNR> <MATNR>.

data: rspar_line TYPE rsparams,

rspar_tab TYPE TABLE OF rsparams.

rspar_line-selname = <LIFNR>. " This is your LIFNR

rspar_line-kind = 'S'.

rspar_line-sign = 'I'.

rspar_line-option = 'EQ'.

rspar_line-low = '100'.

APPEND rspar_line TO rspar_tab.

rspar_line-selname = <MATNR>. " This is your MATNR.

rspar_line-kind = 'S'.

rspar_line-sign = 'I'.

rspar_line-option = 'EQ'.

rspar_line-low = 'P2420000001'.

APPEND rspar_line TO rspar_tab.

submit RM06IBP0 using selection-SCREEN '1000'

with SELECTION-TABLE rspar_tab

and return.

ENDFORM.

Regards,

Smart

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,741

Try this



data:i_params type table of RSPARAMS.
data:wa_params type rsparams.

CASE LV_UCOMM.
 WHEN '&IC1'.
      READ TABLE DISP INDEX SELFIELD-TABINDEX.
      IF SY-SUBRC = 0.
        CASE SELFIELD-FIELDNAME.
          WHEN 'TXZ01'.

wa_params-selname = 'TK_MATNR'.
wa_params-kind = 'S'.
wa_params-sign = 'I'.
wa_params-option = 'EQ'.
wa_params-low = DISP-MATNR
append wa_params to i_params.


wa_params-selname = 'IF_LIFNR'.
wa_params-kind = 'S'.
wa_params-sign = 'I'.
wa_params-option = 'EQ'.
wa_params-low = DISP-LIFNR
append wa_params to i_params.

  CALL FUNCTION 'SUBMIT_REPORT'
    EXPORTING
      report                 = 'RM06IBP0'
      SKIP_SELSCREEN         = 'X' 
    TABLES
     SELECTION_TABLE        = i_params[]
  EXCEPTIONS
     JUST_VIA_VARIANT       = 1
     NO_SUBMIT_AUTH         = 2
     OTHERS                 = 3
            .
  IF sy-subrc <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
endif.
 ENDCASE.

Read only

0 Likes
1,740

Thank you very much. But how after seeing the ME1P screen the program comes back to the Report or the ALV screen.

Read only

0 Likes
1,740

there is a parameter return_via_leave in the function module , mark it as X

Read only

0 Likes
1,740

RET_VIA_LEAVE = 'X'. But it is doing nothing.

Read only

0 Likes
1,740

Use this


DATA:i_bdcdata TYPE TABLE OF bdcdata,
     wa_data TYPE bdcdata.

CASE lv_ucomm.
  WHEN '&IC1'.
    READ TABLE disp INDEX selfield-tabindex.
    IF sy-subrc = 0.
      CASE selfield-fieldname.
        WHEN 'TXZ01'.
          CLEAR wa_data.
          wa_data-program  = 'RM06IBP0'.
          wa_data-dynpro   = '1000'.
          wa_data-dynbegin = 'X'.
          APPEND wa_data TO i_bdcdata.
          CLEAR wa_data.
          wa_data-fnam = 'BDC_CURSOR'.
          wa_data-fval = 'TK_MATNR-LOW'.
          APPEND wa_data TO i_bdcdata.
          CLEAR wa_data.
          wa_data-fnam = 'BDC_OKCODE'.
          wa_data-fval = '=ONLI'.
          APPEND wa_data TO i_bdcdata.
          CLEAR wa_data.
          wa_data-fnam = 'IF_LIFNR-LOW'.
          wa_data-fval = '0000003910'."disp-lifnr.
          APPEND wa_data TO i_bdcdata.
          CLEAR wa_data.
          wa_data-fnam = 'TK_MATNR-LOW'.
          wa_data-fval = 'C-201' ."disp-matnr.
          APPEND wa_data TO i_bdcdata.
          CALL TRANSACTION 'ME1P' USING i_bdcdata MODE 'E'.
        ENDIF.
    ENDCASE.