Shared Top Border

Enterprise Resource
Planning Portal

 

Advertise | Founder BLOG

ERPGenie.COM ABAP Tips and Tricks Database

THE ultimate
ERP website

 

Forums | Vote for us |

Google    Other Search Options

Login

Login to view more content!!!





Lost Password?
No account yet? Register

Registered Access

Poll

What area of ABAP are you interested in?
 
Home arrow Sample Code arrow Control Object Programming arrow To Call Transaction In ALV
To Call Transaction In ALV PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Sujata   
Monday, 02 April 2007

In my report, I am using ALV grid display to display purchase order number, material docu. number.  If I click on purchasing docu number it has to call transaction ME23N for the purchase order number that I have clicked and if I click material document number it has to  call trainsaction MIGO for the corresponding material document number. How can I do it in ALV?

 

*&---------------------------------------------------------------------*
*& Report  Z001
*&---------------------------------------------------------------------*

REPORT  Z001.
TYPE-POOLS:  slis.
tables: rseg.

DATA: begin of TAB_ARSEG occurs 0.
        INCLUDE STRUCTURE RSEG.
DATA: END OF TAB_ARSEG.
DATA: T_FIELDCAT TYPE slis_t_fieldcat_alv.
DATA: c_user_command TYPE slis_formname VALUE 'USER_COMMAND'.

START-OF-SELECTION.

*********  <<<  YOUR CODE  >>> ***********************
select * from rseg into table tab_arseg where BELNR = '5300000022'.

END-OF-SELECTION.

perform build_fieldcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
    i_buffer_active                   = space
    i_callback_program                = sy-repid
   I_CALLBACK_USER_COMMAND            = c_user_command
*   I_STRUCTURE_NAME                  =
*   IS_LAYOUT                         =
   IT_FIELDCAT                        = T_FIELDCAT[]
  TABLES
    T_OUTTAB                          = TAB_ARSEG
 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  USER_COMMAND
**&---------------------------------------------------------------------*
FORM USER_COMMAND USING F_UCOMM LIKE SY-UCOMM
                I_SELFIELD TYPE SLIS_SELFIELD.

  DATA: F_SUBRC LIKE SY-SUBRC,
        s_arseg like tab_arseg.
  READ TABLE tab_arseg INDEX i_selfield-tabindex INTO s_arseg.

    CASE F_UCOMM.
        WHEN '&IC1'.
        CASE i_SELFIELD-SEL_TAB_FIELD.
        WHEN 'TAB_ARSEG-BELNR'.
          CHECK NOT S_ARSEG-BELNR IS INITIAL.
          SET PARAMETER ID 'RBN' FIELD S_ARSEG-BELNR.
          SET PARAMETER ID 'GJR' FIELD S_ARSEG-GJAHR.
          CALL TRANSACTION 'MIR4' AND SKIP FIRST SCREEN.
        ENDCASE.
    ENDCASE.
ENDFORM.

**&---------------------------------------------------------------------*
**&      Form  build_fieldcat
**&---------------------------------------------------------------------*

FORM build_fieldcat .
 DATA: FIELDCAT TYPE SLIS_FIELDCAT_ALV.
  CLEAR FIELDCAT.
  FIELDCAT-FIELDNAME     = 'BELNR'.
  FIELDCAT-TABNAME       = 'TAB_ARSEG'.
  FIELDCAT-REF_TABNAME   = 'RSEG'.
  FIELDCAT-REF_FIELDNAME = 'BELNR'.
  fieldcat-hotspot   = 'X'.
  FIELDCAT-COL_POS       = 1.
  APPEND FIELDCAT TO t_fieldcat.

  CLEAR FIELDCAT.
  FIELDCAT-FIELDNAME     = 'GJAHR'.
  FIELDCAT-TABNAME       = 'TAB_ARSEG'.
  FIELDCAT-REF_TABNAME   = 'RSEG'.
  FIELDCAT-REF_FIELDNAME = 'GJAHR'.
  FIELDCAT-COL_POS       = 2.
  APPEND FIELDCAT TO t_fieldcat.

ENDFORM.                    " build_fieldcat


Related Items:

 
< Prev   Next >

Google Search

Statistics

Contribution Activity
Utilities: 38
Tips and Tricks: 333
Sample Code: 164
Total Contributions: 550

Member Activity
Members: 6198 since 2/1/2007!
New: 6 since yesterday!
Visitors: 1024676

Newest Members

Welcome our newest members:

Google Ads

Shared Bottom Border

Contact Us | Polls | Add URL | Contribute | Privacy | Terms | Feedback

Discussion Forum | BLOG | Consultants: Post your resume | Companies: Advertise on ERPGenie.COM | Post Job
Financials Consultant | Consultant Review | Gallia Consulting | Supply Chain Project | SAP Financials Forum
GenieHoldings.COM, Inc. | Genie Press | WorkflowGenie | ESAGenie | ERPTopSites | ABAP Tips and Tricks | SAP Solutions Database

EDIGenie | Searching Survivor