2006 May 18 7:04 AM
Hi frieds,
How to call a Tcode using a push button in another report.
Eg: Tcode = Ztest. (for invoice list report, using
the program zinvlist).
This Ztest should be called in another report
Zrep1 (program name Zsale) using the push button.
Regards,
A S VINCENT
2006 May 18 7:08 AM
Hi,
to call a transaction use the command : CALL TRANSACTION ... (see the help).
A pushbutton could be a parameter or a pf-status.
Look the documentation with the key words : parameters or set pf-status.
Rgd
Frédéric
2006 May 18 7:11 AM
Write following in the FCODE for the Push button:
Leave to transaction 'ZTEST' (optional AND SKIP FIRST SCREEN).
Regds
Sandip
Message was edited by: Sandip Kamdar
2006 May 18 7:15 AM
give fcode to the pushbutton in pf-ststus.
case sy-ucomm.
when 'fcode'.
call transaction tcode.
endcase.
2006 May 18 7:19 AM
Could u pls give any sample code (complete code) for this case.
Regards.
2006 May 18 7:25 AM
Case sy-ucomm .
when 'PUSH' .
call transaction 'MM01' .
Endcase .
As u are going to execute an report i.e. Tcode Ztest. so in that case you can also use SUBMIT to execute that report .
Case sy-ucomm .
when 'PUSH' .
submit zprg set p_para = 'abc' .
Endcase .
****zprg is a report
****p_para is parameter name of that report
similiar way u can pass no. of parameters
Regards
Siddharth
Message was edited by: siddharth neekhra
2006 May 18 7:29 AM
Hai Vincent
&----
*& Form DISPLAY_SEC1
&----
TO CALL TRANSACTION ME23
----
form DISPLAY_SEC1.
<b> SET PARAMETER ID 'BES' FIELD IT_EKKO-EBELN.
CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.</b>endform. " DISPLAY_SEC1
also I will send you Some Sample Code
&----
*& Report ZSSSS1 *
*& *
&----
*& *
*& *
&----
REPORT ZSSSS1 LINE-SIZE 120
LINE-COUNT 25(3)
MESSAGE-ID ZSAN.
********************************************************************
*Program Desc: INTERACTIVE REPORT FOR PURCHASE ORDER DETAILS
BASIC LIST CONTAINS HEADER DETAILS
SECONDARY LIST CONTAINS ITEM DETAILS
AND CONDETION RECORD DETAILS
********************************************************************
T A B L E S U S E D *
********************************************************************
TABLES: EKKO,EKPO,KONV,LFA1,T001.
********************************************************************
S E L E C T I O N S C R E E N *
********************************************************************
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
SELECT-OPTIONS:
S_LIFNR FOR EKKO-LIFNR,
S_BUKRS FOR EKKO-BUKRS.
SELECTION-SCREEN END OF BLOCK B1.
********************************************************************
D A T A D E C L A R A T I O N S *
********************************************************************
DATA: BEGIN OF IT_EKKO OCCURS 0,
BUKRS LIKE EKKO-BUKRS,
LIFNR LIKE EKKO-LIFNR,
EBELN LIKE EKKO-EBELN,
KNUMV LIKE EKKO-KNUMV,
END OF IT_EKKO.
DATA: BEGIN OF IT_EKPO OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
INFNR LIKE EKPO-INFNR,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
END OF IT_EKPO.
DATA: BEGIN OF IT_KONV OCCURS 0,
KNUMV LIKE KONV-KNUMV,
KSCHL LIKE KONV-KSCHL,
KAWRT LIKE KONV-KAWRT,
KBETR LIKE KONV-KBETR,
KPOSN LIKE KONV-KPOSN,
END OF IT_KONV.
DATA: BEGIN OF IT_LFA1 OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
STRAS LIKE LFA1-STRAS,
ORT01 LIKE LFA1-ORT01,
PSTLZ LIKE LFA1-PSTLZ,
LAND1 LIKE LFA1-LAND1,
END OF IT_LFA1.
DATA: V_BUTXT LIKE T001-BUTXT,
FNAM(20) TYPE C,
FVAL(20) TYPE C.
********************************************************************
A T S E L E C T I O N - S C R E E N O N <FIELD> *
********************************************************************
AT SELECTION-SCREEN ON S_BUKRS.
PERFORM VALIDATE.
********************************************************************
S T A R T - O F - S E L E C T I O N *
********************************************************************
START-OF-SELECTION.
PERFORM SELECT_DATA. " SELECTION OF ALL DATA
PERFORM DISPLAY_DATA. " DISPLAY OF BASIC LIST
********************************************************************
A T L I N E S E L E C T I O N *
********************************************************************
AT LINE-SELECTION.
GET CURSOR FIELD FNAM VALUE FVAL.
CASE FNAM.
WHEN 'IT_EKKO-EBELN'.
PERFORM DISPLAY_SEC1.
WHEN 'IT_EKKO-LIFNR'.
PERFORM DISPLAY_SEC2.
WHEN OTHERS.
PERFORM DISPLAY_SEC3.
ENDCASE.
********************************************************************
T O P - O F - P A G E *
********************************************************************
TOP-OF-PAGE.
PERFORM WRITE_HEADER.
********************************************************************
T O P - O F - P A G E D U R I N G L I N E S E L *
********************************************************************
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM WRITE_HEADER2.
********************************************************************
E N D - O F - P A G E *
********************************************************************
END-OF-PAGE.
PERFORM WRITE_FOOTER.
&----
*& Form SELECT_DATA
&----
THIS FORM CONTAINS ALL SELECTION OF DATA STATEMENTS
----
form SELECT_DATA.
SELECT BUKRS LIFNR EBELN KNUMV
FROM EKKO
INTO TABLE IT_EKKO
WHERE LIFNR IN S_LIFNR
AND BUKRS IN S_BUKRS.
IF NOT IT_EKKO[] IS INITIAL.
SELECT EBELN EBELP MATNR INFNR MENGE MEINS NETPR
FROM EKPO
INTO TABLE IT_EKPO
FOR ALL ENTRIES IN IT_EKKO
WHERE EBELN = IT_EKKO-EBELN.
IF SY-SUBRC = 0.
LOOP AT IT_EKKO.
LOOP AT IT_EKPO.
SELECT KNUMV KSCHL KAWRT KBETR KPOSN
FROM KONV
INTO IT_KONV
WHERE KNUMV = IT_EKKO-KNUMV
AND KPOSN = IT_EKPO-EBELP.
APPEND IT_KONV.
ENDSELECT.
ENDLOOP.
ENDLOOP.
ENDIF." END OF IF FOR CHECK OF SY-SUBRC
SELECT LIFNR NAME1 STRAS ORT01 PSTLZ LAND1
INTO TABLE IT_LFA1
FROM LFA1
FOR ALL ENTRIES IN IT_EKKO
WHERE LIFNR = IT_EKKO-LIFNR.
ENDIF." END OF IF FOR IT_EKKO IS NOT INITIAL
endform. " SELECT_DATA
&----
*& Form DISPLAY_DATA
&----
DISPLAY THE BASIC DATA
----
form DISPLAY_DATA.
DATA: LINNO TYPE I.
SORT IT_EKKO BY BUKRS LIFNR EBELN.
LOOP AT IT_EKKO.
READ TABLE IT_LFA1 WITH KEY LIFNR = IT_EKKO-LIFNR.
SELECT SINGLE BUTXT
FROM T001
INTO (V_BUTXT)
WHERE BUKRS = IT_EKKO-BUKRS.
WRITE:/1 SY-VLINE,
(10) IT_EKKO-EBELN HOTSPOT ON,
SY-VLINE,
(10) IT_EKKO-LIFNR HOTSPOT ON,
SY-VLINE,
(15) IT_LFA1-NAME1 HOTSPOT ON,
SY-VLINE,
(10) IT_EKKO-BUKRS HOTSPOT ON,
SY-VLINE,
(15) V_BUTXT,
75 SY-VLINE.
HIDE: IT_EKKO-EBELN,
IT_EKKO-LIFNR.
WRITE:/1(75) SY-ULINE.
AT END OF LIFNR.
LINNO = SY-LINCT - SY-LINNO - 1.
SKIP LINNO.
ENDAT.
ENDLOOP.
endform. " DISPLAY_DATA
&----
*& Form DISPLAY_SEC3
&----
form DISPLAY_SEC3.
LOOP AT IT_EKPO.
CLEAR: IT_EKPO, IT_KONV.
READ TABLE IT_EKPO WITH KEY EBELN = IT_EKKO-EBELN.
IF SY-SUBRC = 0.
FORMAT COLOR 3.
WRITE:/1 SY-VLINE,
(10) IT_EKPO-EBELN,
SY-VLINE,
(10) IT_EKPO-EBELP,
SY-VLINE,
(18) IT_EKPO-MATNR,
SY-VLINE,
(10) IT_EKPO-INFNR,
SY-VLINE,
(15) IT_EKPO-MENGE,
SY-VLINE,
(10) IT_EKPO-MEINS,
SY-VLINE,
(12) IT_EKPO-NETPR,
105 SY-VLINE.
FORMAT COLOR OFF.
WRITE:/1(105) SY-ULINE.
FORMAT COLOR 4.
READ TABLE IT_KONV WITH KEY KPOSN = IT_EKPO-EBELP.
IF SY-SUBRC = 0.
WRITE:/1 SY-VLINE,
(10) IT_KONV-KNUMV,
SY-VLINE,
(10) IT_KONV-KSCHL,
SY-VLINE,
(15) IT_KONV-KAWRT,
SY-VLINE,
(12) IT_KONV-KBETR,
SY-VLINE.
WRITE:/1(95) SY-ULINE.
FORMAT COLOR OFF.
ENDIF.
ENDIF.
ENDLOOP.
endform. " DISPLAY_SEC3
&----
*& Form DISPLAY_SEC1
&----
TO CALL TRANSACTION ME23
----
form DISPLAY_SEC1.
SET PARAMETER ID 'BES' FIELD IT_EKKO-EBELN.
CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
endform. " DISPLAY_SEC1
&----
*& Form WRITE_HEADER
&----
HEADER DISPLAY
----
form WRITE_HEADER.
FORMAT COLOR 3.
WRITE:/1 SY-VLINE,
(10) 'PUR.ORDER',
SY-VLINE,
(10) 'VENDOR',
SY-VLINE,
(15) 'NAME',
SY-VLINE,
(10) 'COMP.CODE',
SY-VLINE,
(15) 'COMP.DESC',
75 SY-VLINE.
WRITE:/1(75) SY-ULINE.
FORMAT COLOR OFF.
endform. " WRITE_HEADER
&----
*& Form WRITE_FOOTER
&----
FOOTER OF LIST
----
form WRITE_FOOTER.
FORMAT COLOR 4.
WRITE: /1 'USER:',SY-UNAME,
45 'DATE:', SY-DATUM.
FORMAT COLOR OFF.
endform. " WRITE_FOOTER
&----
*& Form WRITE_HEADER2
&----
HEADER FOR SECONDARY LIST
----
form WRITE_HEADER2.
FORMAT COLOR 4.
WRITE: /30 'INTELLIGROUP ASIA PVT LTD' CENTERED.
WRITE:/50 'HYDERABAD' CENTERED.
FORMAT COLOR 5.
WRITE:/1 SY-VLINE,
(10) 'PUR.ORDR',
SY-VLINE,
(10) 'ITEM',
SY-VLINE,
(18) 'MATERIAL NUMBER',
SY-VLINE,
(10) 'INFO.RECD',
SY-VLINE,
(15) 'QUANTITY',
SY-VLINE,
(10) 'UNITS',
SY-VLINE,
(12) 'NETPRICE',
105 SY-VLINE.
FORMAT COLOR OFF.
WRITE:/1(105) SY-ULINE.
FORMAT COLOR 6.
WRITE:/1 SY-VLINE,
(10) 'COND.RECD',
SY-VLINE,
(10) 'TYPE',
SY-VLINE,
(15) 'BASE VALUE',
SY-VLINE,
(12) 'AMOUNT',
SY-VLINE.
FORMAT COLOR OFF.
WRITE:/1(95) SY-ULINE.
endform. " WRITE_HEADER2
&----
*& Form DISPLAY_SEC2
&----
TO DISPLAY VENDOR DETAILS IN POP UP WINDOW
----
form DISPLAY_SEC2.
READ TABLE IT_LFA1 WITH KEY LIFNR = IT_EKKO-LIFNR.
IF SY-SUBRC = 0.
WRITE:/ 'NAME IS:' , IT_LFA1-NAME1,
/ 'STREET IS:', IT_LFA1-STRAS,
/ 'CITY IS:', IT_LFA1-ORT01,
/ 'POSTEL CODE IS:',IT_LFA1-PSTLZ,
/ 'COUNTRY IS: ', IT_LFA1-LAND1.
WINDOW STARTING AT 1 15
ENDING AT 50 20.
ENDIF.
endform. " DISPLAY_SEC2
&----
*& Form VALIDATE
&----
VALIDATE BUKRS
----
form VALIDATE.
SELECT SINGLE *
FROM T001
WHERE BUKRS IN S_BUKRS.
IF SY-SUBRC <> 0.
MESSAGE E001.
ENDIF.
endform. " VALIDATE
Thanks & regards
Sreenivasulu P
2006 May 18 7:35 AM
Hi vincent,
1. Simple.
2. this small program will display one BUTTON,
and if we press it , it will
open tcode SE11.
3. just copy paste in new program.
4. report abc.
*----
selection-screen : pushbutton 5(15) mybut user-command but.
*----
at selection-screen.
if sy-ucomm = 'BUT'.
call transaction 'SE11'.
endif.
regards,
amit m.