Application Development 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: 

Purchase Order Report with Me22n.....Kindly help its

Former Member
0 Kudos

Hi Friends

Here is my requirement.

I have developed a purchase order alv report, and it is working perfectly.Now i want to give a provision to the user to view the desired purchase order from the report itself by taking him to ME22n transaction.

any kind of solution is welcom.

Thanks a lot to all.

Mrutyun

Edited by: Vijay Babu Dudla on Dec 3, 2008 12:20 AM

1 ACCEPTED SOLUTION

former_member181962
Active Contributor
0 Kudos

Make the alv report interactive by defining a form say, user_command.

in the form, code for calling the transaction.

SET PARAMETER ID <Parameter ID for PO> FIELD <value of PO>.

call transaction 'ME22N' and skip first screen.

Regards,

Ravi

4 REPLIES 4

former_member181962
Active Contributor
0 Kudos

Make the alv report interactive by defining a form say, user_command.

in the form, code for calling the transaction.

SET PARAMETER ID <Parameter ID for PO> FIELD <value of PO>.

call transaction 'ME22N' and skip first screen.

Regards,

Ravi

former_member188685
Active Contributor
0 Kudos

Hi Tripathy,

this is simple. when you double click you need to capture the clicked record and then set the parameter ID and then call transaction.

REPORT  ZTEST_ALV_CHECK                         .
TYPE-POOLS: SLIS.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
      IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
      L_LAYOUT type slis_layout_alv,
      x_events type slis_alv_event,
      it_events type SLIS_T_EVENT.

DATA: BEGIN OF ITAB OCCURS 0,
      VBELN LIKE VBAK-VBELN,
      POSNR LIKE VBAP-POSNR,
      CHK(1),
     END OF ITAB.

SELECT VBELN
       POSNR
       FROM VBAP
       UP TO 20 ROWS
       INTO TABLE ITAB.

X_FIELDCAT-FIELDNAME = 'CHK'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
X_FIELDCAT-INPUT = 'X'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-CHECKBOX = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.

X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-SELTEXT_L = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 2.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.

X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-SELTEXT_L = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 3.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_LAYOUT-window_titlebar = 'Popup window'.

  x_events-NAME = SLIS_EV_END_OF_PAGE.
  x_events-FORM = 'END_OF_PAGE'.
  APPEND x_events  TO iT_EVENTS.
  CLEAR x_events .
  x_events-NAME = SLIS_EV_TOP_OF_PAGE.
  x_events-FORM = 'TOP_OF_PAGE'.
  APPEND x_events  TO iT_EVENTS.
  CLEAR x_events .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    I_CALLBACK_PROGRAM       = SY-REPID
    IS_LAYOUT                = L_LAYOUT
<b>    I_CALLBACK_PF_STATUS_SET = 'STATUS'
    I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'</b>
    IT_FIELDCAT              = IT_FIELDCAT
    it_events                = it_events
*    I_SCREEN_START_COLUMN    = 10
*    I_SCREEN_START_LINE      = 1
*    I_SCREEN_END_COLUMN      = 50
*    I_SCREEN_END_LINE        = 20
  TABLES
    T_OUTTAB                 = ITAB
  EXCEPTIONS
    PROGRAM_ERROR            = 1
    OTHERS                   = 2.
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

FORM TOP_OF_PAGE.
* BREAK-POINT.
  WRITE: / 'TOP_OF_PAGE'.
ENDFORM.

FORM END_OF_PAGE.
* BREAK-POINT.
  WRITE: / 'END_OF_PAGE'.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  STATUS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_EXTAB    text
*----------------------------------------------------------------------*
FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.
*- Pf status
  SET PF-STATUS 'STATUS'.
ENDFORM.                 " STATUS
*&---------------------------------------------------------------------*
*&      Form  USER_COMMAND
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->R_UCOMM      text
*      -->RS_SELFIELD  text
*----------------------------------------------------------------------*
FORM USER_COMMAND USING R_UCOMM     LIKE SY-UCOMM
                               RS_SELFIELD TYPE SLIS_SELFIELD.

  case r_ucomm.
    when 'BACK' or 'CANC' or 'EXIT'.
      leave to screen 0.
    when '&IC1'.
      set parameter id 'AUN' field rs_selfield-value.
      call transaction 'VA03' and skip first screen.
  endcase.
ENDFORM.                    "USER_COMMAND

the above code takes you to Sales order Display VA03 similarly you should code,

don't forget to set the pf-satus and user-command. and enable F2 key with &IC1.

Regards

vijay

Former Member
0 Kudos

Hi Tripathi,

If you are using classes then it is quiet easy you need to handle a method <u>HOTSPOT_CLICK</u>, here you can code your requirement.

Kindly refer to the standard program where you can simulate your requirement hotspot : <b>BCALV_TEST_GRID_EVENTS</b>.

<i>Hope This Info Helps YOU.</i>

Regards,

Raghav

Former Member
0 Kudos

Hi

Which kind of ALV are you using? FM (list or grid) ALV? OO ALV?

If you're using the FM:

Transfer the OK_CODE for double click to layout structure:

IS_LAYOUT-F2_CODE = 'EKKO'.

Transfer the name of user-command routine in parameter I_CALLBACK_USER_COMMAND:

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'.

Define the routine for user-command:

FORM USER_COMMAND USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE R_UCOMM.

WHEN 'EKKO'.

SET ID PARAMETER 'BES' ITAB-EBELN.

CALL TRANSACTION 'ME22N' AND SKIP FIRST SCREEN.

ENDCASE.

ENDFORM