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

abt reports

Former Member
0 Likes
986

Is it possible to call a transaction or call other program from any report.plz send me the replay to this anybody.

Hi,

To call report from any report

Report - submit Zreport and return.

transaction - call transaction mm01 .

in the first command it will call the report and execute and return to the main program.

in the second command it call the transaction MM01

you can have examples in

transaction code : ABAP_DOCU

Regards,

Madhavi

6 REPLIES 6
Read only

Former Member
0 Likes
949

Yes, its possible

to call transaction use CALL TRANSACTION statement..

to call report... use SUBMIT statement

Regards

Syed A

Read only

Former Member
0 Likes
949

hi,

u can use SUBMIT statement for your problem i.e., calling another program into ur report.

reward me if useful.

gupta pullipudi

Read only

Former Member
0 Likes
949

Hi,

You can call other program from any report by using submit statement.

Submit 'reportname'. "Here report name is, which program do you want to call.

Call transaction is also possible.bY USING THE SYNTAX.

Call transaction 'TCODE'.

You can also create a transaction for report.By using that transaction also you can call another report.

I think it is useful for you.

Read only

Former Member
0 Likes
949

Hi,

To call report from any report

Report - submit Zreport and return.

transaction - call transaction mm01 .

in the first command it will call the report and execute and return to the main program.

in the second command it call the transaction MM01

you can have examples in

transaction code : ABAP_DOCU

Regards,

Madhavi

Read only

Former Member
0 Likes
949

Hi,

To call report from any report

Report - submit Zreport and return.

transaction - call transaction mm01 .

in the first command it will call the report and execute and return to the main program.

in the second command it call the transaction MM01

you can have examples in

transaction code : ABAP_DOCU

Regards,

Madhavi

Read only

Former Member
0 Likes
949

HI....

calling a transaction....

&----


*& Report ZSALESORDERDETAILS_ASHOK

*&

&----


*&

*&

&----


REPORT ZSALESORDERDETAILS_ASHOK

NO STANDARD PAGE HEADING

LINE-SIZE 50

LINE-COUNT 35(5).

********************************************

*data declaration.

*********************************************

tables :vbak.

tables: VBAP.

DATA : TVBAK LIKE VBAK OCCURS 0 WITH HEADER LINE,

TVBAP LIKE VBAP OCCURS 0 WITH HEADER LINE,

TEMP TYPE p decimals 5 VALUE '0.0' ,

A type i,

FIELDNAME TYPE STRING,

FIELDVALUE TYPE VBAP-VBELN.

DATA G_CB.

*

-


selection-screen begin of block screen1 with frame title TEXT-001.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN COMMENT /32(35) COMM1.

SELECTION-SCREEN ULINE /27(35).

SELECTION-SCREEN SKIP.

SELECT-OPTIONS TVBELN FOR VBAK-VBELN.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN ULINE.

SELECTION-SCREEN COMMENT /30(50) COMM2.

SELECTION-SCREEN ULINE /27(40).

SELECTION-SCREEN SKIP.

SELECT-OPTIONS TERDAT FOR VBAK-ERDAT.

SELECTION-SCREEN SKIP.

selection-screen end of block screen1.

*----


*Initialization

**************************************************

Initialization .

TVBELN-low = 4000.

TVBELN-high = 5000.

TVBELN-option = 'BT'.

TVBELN-sign = 'I'.

APPEND TVBELN.

TERDAT-low = '19960202'.

TERDAT-high = '20020302' .

APPEND TERDAT.

*----


AT SELECTION-SCREEN .

SELECT *

FROM VBAK

INTO TABLE TVBAK

WHERE VBELN IN TVBELN AND erdat IN Terdat .

IF sy-subrc ne 0.

MESSAGE 'ENTERED ORDER NOT FOUND' type 'E'.

ENDIF.

*----


START-OF-SELECTION.

REFRESH TVBAK.

SELECT *

FROM VBAK

INTO TABLE TVBAK

WHERE VBELN IN TVBELN AND ERDAT IN TERDAT.

*----


END-OF-SELECTION.

LOOP AT TVBAK.

WRITE: /2 SY-VLINE,

TVBAK-VBELN INPUT ON ,

15 SY-VLINE,TVBAK-ERDAT hotspot on,

30 SY-VLINE, 35 TVBAK-ERNAM,

46 SY-VLINE,

g_cb AS CHECKBOX.

ENDLOOP.

A = SY-LINCT - SY-LINNO - 1.

SKIP A .

RESERVE A LINES.

*----


AT SELECTION-SCREEN OUTPUT.

comm1 ='SELECT SALES ORDER RANGE'.

comm2 ='SELECT SALES ORDER CREATION DATE'.

*----


TOP-OF-PAGE.

ULINE.

WRITE /15 ' SALES ORDER REPORT ' COLOR = 1 .

ULINE.

WRITE : /7 ' VBELN ' COLOR = 5 ,

19 ' ERDAT ' COLOR = 5,

34 ' ERNAM ' COLOR = 5.

ULINE.

*----


END-OF-PAGE.

IF SY-LSIND = 0.

ULINE.

WRITE : /2 'NUMBER OF LINE IN THIS PAGE = ', SY-LINNO.

SKIP.

WRITE: /30 'PAGE NUMBER = ', SY-PAGNO.

ULINE.

ELSEIF SY-LSIND = 1.

ULINE.

WRITE : /12 'TOTAL PRICE = ' ,TEMP.

CLEAR TEMP.

SKIP.

WRITE : /30 'PAGE NUMBER = ', SY-PAGNO.

ULINE.

ENDIF.

*----


at line-selection.

GET CURSOR FIELD FIELDNAME VALUE FIELDVALUE.

IF FIELDNAME = 'TVBAK-VBELN'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = FIELDVALUE

IMPORTING

OUTPUT = FIELDVALUE.

WINDOW STARTING AT 60 2 ENDING AT 120 25.

IF SY-LSIND = 1.

SELECT

*

FROM VBAP

INTO TABLE TVBAP

WHERE VBELN EQ FIELDVALUE.

LOOP AT TVBAP.

TEMP = TEMP + TVBAP-NETPR.

WRITE : /2 SY-VLINE, TVBAP-matnr,

17 SY-VLINE,TVBAP-VBELN,

30 SY-VLINE,TVBAP-NETPR currency 'IN',

49 SY-VLINE.

ENDLOOP.

ULINE.

A = SY-LINCT - SY-LINNO - 1.

SKIP A .

RESERVE A LINES.

ENDIF.

ELSEIF SY-LSIND = 2.

call transaction 'MM01' .

ENDIF.

*----


TOP-OF-PAGE DURING LINE-SELECTION.

WRITE : / SY-ULINE,

/7 ' DETAIL OF GIVEN SALES ORDER ' COLOR = 5,

/ SY-ULINE,

/4 'MATNR',

22 'VBELN',

35 'NETPR',

/ SY-ULINE.

*----


You use Submit to call an ABAP report from within another report. For example

submit 'ZREPORT1' using pernr = g_pernr

exporting list to memory

and return.

In this case we are submitting the report ZREPORT1, passing the parameter pernr a value of g_pernr (from the calling program) sending the output list to ABAP memory, and retruning to the calling program.

You can retrieve the list using the function module LIST_FROM_MEMORY.

**********************************

SUBMIT

Syntax

SUBMIT {rep|(name)} selscreen_options

list_options

job_options

AND RETURN.

Addition:

... AND RETURN

Effect

The SUBMIT statement accesses an executable program rep. The executable program is executed as described under Calling Executable Reports.

The program name rep can either be specified directly or as the content of a character-like data object name. The data object name must contain the name of the program to be accessed in block capitals. If the program specified in name is not found, an irretrievable exception is generated.

The selscreen_options additions can be used to determine the selection screen for the program accessed and to supply it with values.

The list_options additions allow you to influence the output medium and the page size in the basic list for the program accessed.

SUBMIT - selscreen_options

Syntax

... USING SELECTION-SCREEN dynnr

VIA SELECTION-SCREEN

selscreen_parameters ... .

Extras:

1. ... USING SELECTION-SCREEN dynnr

2. ... VIA SELECTION-SCREEN

Effect

The addition USING SELECTION-SCREEN specifies the selection screen, VIA SELECTION-SCREEN specifies whether it is displayed. The additions selscreen_parameters provide values for the parameters, selection criteria, and the free selection of the called selection screen.

The values are transferred to the selection screen between the events INITIALIZATION and AT SELECTION-SCREEN OUTPUT The following hierarchy applies for transferring values:

First, the variant of the addition USING SELECTION-SET is transferred, which sets all parameters and selection criteria to the values of the variant. The values previously set in the called program are overwritten.

The values of the table of the addition WITH SELECTION-TABLE are then transferred. All parameters and selection criteria specified there are overwritten accordingly.

Finally, the values of the additions WITH sel value are transferred. All parameters and selection criteria are overwritten accordingly. If the addition WITH sel value is used more than once for the same parameter, this is overwritten with the last specified value. If the addition WITH sel value is used more than once for the same selection criterion, a selection table with the corresponding number of lines is transferred.

Providing values for free selections is independent of this hierarchy.

Notes

The options for parameter transfer enable a selection screen to be viewed as a parameter interface of an executable program. This applies particularly for background selection screen processing and for parameters and selection criteria that are defined without screen elements using the addition NO-DISPLAY

When transferring data, note that any adjustments made to the screen format, such as abbreviations or the execution of conversion routines, are not executed for fields for which there are no screen elements on the selection screen. This applies for all parameters and selection criteria defined with NO DISPLAY. It also applies for all lines of a selection table with the exception of the first line.

The additions selscreen_parameters only work the first time the called program is executed. If a selection screen is displayed in the called program, the runtime environment calls the program again after it is finished, thereby replacing the values specified in selscreen_parameters with the previous input values.

Addition 1

... USING SELECTION-SCREEN dynnr

Effect

This addition specifies which selection screen is called. dynnr is a data object that must contain the screen number of a selection screen defined in the called program when the SUBMIT statement is called.

If the addition USING SELECTION-SCREEN is omitted or the screen number 1000 is entered, the standard selection screen is called. If no standard selection screen is defined in the called program, no selection screen is called.

If a screen number that is not 1000 is entered in the addition USING SELECTION-SCREEN, the corresponding independent selection screen is called. If no selection screen with this screen number is defined in the called program, this leads to an untreatable exception.

Addition 2

... VIA SELECTION-SCREEN

Effect

If this addition is specified, the selection screen is displayed on the screen. Otherwise, background selection screen processing takes place. In background selection screen processing, the selection screen events are triggered without the selection screen being displayed.

SUBMIT - list_options

Syntax

... LINE-SIZE width

LINE-COUNT page_lines

{ EXPORTING LIST TO MEMORY

| TO SAP-SPOOL spool_options } ... .

Extras:

1. ... LINE-SIZE width

2. ... LINE-COUNT page_lines

3. ... EXPORTING LIST TO MEMORY

4. ... TO SAP-SPOOL spool_options

Effect:

These additions affect the basic list in the program accessed. While LINE-SIZE and LINE-COUNT influence the formatting, the other two additions determine the output type of the list.

EXPORTING LIST TO MEMORY saves the list to the ABAP Memory and TO SAP-SPOOL sends it as a print list to the SAP spool system. If you do not specify these additions, the basic list is displayed as a screen list.

Note:

The additions only take effect the first time the program accessed is executed. If a selection screen is displayed in the program accessed, the runtime environment accesses the program again after completion, without taking account of the list_options additions. This is particularly important to the addition TO SAP-SPOOL, because the basic list is displayed as a screen list and not as a print list when the program is accessed again. For this reason, it is advisable not to use the addition VIA SELECTION-SCREEN when using list_options.

Addition 1

... LINE-SIZE width

Addition 2

... LINE-COUNT page_lines

Effect

These additions define the line width and page length of the basic list. They have the same effect as the additions of the same name in the program initiating statement for the program accessed. If the program accessed has the same additions in the program initiating statement, these overwrite the values specified for SUBMIT.

Addition 3

... EXPORTING LIST TO MEMORY

Effect

This addition stores the basic list for the program accessed in the ABAP Memory. It can only be used together with the addition AND RETURN.

The list is stored in the ABAP Memory as an internal table of the row type ABAPLIST, ABAPLIST being a structured data type in the ABAP Dictionary.

The calling program can access the list stored once program access is completed, using function modules belonging to the function group SLST.

The function module LIST_FROM_MEMORY loads the list from the ABAP Memory to an internal table of the row type ABAPLIST.

The function module WRITE_LIST inserts the content of an internal table of the row type ABAPLIST in the current list.

The function module DISPLAY_LIST displays the content of an internal table of the row type ABAPLIST in a separate list screen.

Note

The addition can only work provided the function key Enter is not linked to a function code in the GUI status last defined for the program accessed.

Example

Once the program report has been accessed, the list stored there in the ABAP Memory is read by means of function modules and inserted in the current list.

DATA list_tab TYPE TABLE OF abaplist.

SUBMIT report EXPORTING LIST TO MEMORY

AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = list_tab

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc = 0.

CALL FUNCTION 'WRITE_LIST'

TABLES

listobject = list_tab.

ENDIF.

Addition 4

... TO SAP-SPOOL spool_options

Effect

This addition causes a new print list level to be opened in the internal session of the program called and assures that the first output statement for the basic list creates a new spool request. All list outputs of the program called are transferred as print lists, page by page, to the SAP spool system. Using the spool_options additions, the print parameters and archiving parameters of the spool request are specified.

Note

It is not possible to switch from the print list to a screen list in the program called. The statement NEW-PAGE PRINT OFF does not work on print list levels created using SUBMIT TO SAP-SPOOL.

Example

Accessing an executable program and creating a spool request.

DATA: print_parameters TYPE pri_params,

archi_parameters TYPE arc_params,

valid_flag(1) TYPE c.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

archive_mode = '3'

IMPORTING

out_parameters = print_parameters

out_archive_parameters = archi_parameters

valid = valid_flag

EXCEPTIONS

invalid_print_params = 2

OTHERS = 4.

IF valid_flag = 'X' AND sy-subrc = 0.

SUBMIT submitable TO SAP-SPOOL

SPOOL PARAMETERS print_parameters

ARCHIVE PARAMETERS archi_parameters

WITHOUT SPOOL DYNPRO.

ENDIF.

Regards

Vasu