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

module pool

Former Member
0 Likes
827

hi,

is it possible to call the report program from module pool?

and how to pass the values to the selection screen of report program?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
770

Hi kiran,

1. Yes it is possible to call a report program from a module pool.

2. You can pass the values to the selection screen of report program using the statement <b>Submit</b>.

Read this :

When you start an executable program, the standard selection screen normally appears, containing the selection criteria and parameters of both the logical database connected to the program and of the program itself (see Direct Execution - Reports). When you start an executable program using SUBMIT, there are various additions that you can use to fill the input fields on the selection screen:

<b>SUBMIT... [VIA SELECTION-SCREEN]

[USING SELECTION-SET <var>]

[WITH <sel> <criterion>]

[WITH FREE SELECTIONS <freesel>]

[WITH SELECTION-TABLE <rspar>].</b>

In this the option<b> [via selection-screen ]</b> fulfills your purpose :

<b>The selection screen of the called executable program (report) appears. If you transfer values to the program using one or more of the other options, the corresponding input fields in the selections screen are filled. The user can change these values. By default, the system does not display a selection screen after SUBMIT.</b>

I am giving you the sample code for this .

        • <b>Report1 :</b>

REPORT ZKUN_IMP1 .

DATA : list LIKE TABLE OF abaplist WITH HEADER LINE.

DATA : BEGIN OF list_asc OCCURS 0,

msg(300) TYPE c,

END OF list_asc.

DATA : wa_c_filename(30) TYPE c.

RANGES: r_bukrs FOR vbkpf-bukrs.

RANGES: r_gjahr FOR vbkpf-gjahr.

RANGES: r_belnr FOR vbkpf-belnr.

r_bukrs-sign = 'I'.

r_bukrs-option = 'EQ'.

r_bukrs-low = '1000'.

APPEND r_bukrs.

r_gjahr-sign = 'I'.

r_gjahr-option = 'EQ'.

r_gjahr-low = '2006'.

APPEND r_gjahr.

r_belnr-sign = 'I'.

r_belnr-option = 'EQ'.

r_belnr-low = '0002000001'.

r_belnr-high ='1000000010'.

APPEND r_belnr.

SUBMIT zkun_imp2 via selection-screen

WITH p_bukrs IN r_bukrs

WITH p_gjahr IN r_gjahr

WITH p_belnr IN r_belnr

EXPORTING LIST TO MEMORY

AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = list

EXCEPTIONS

not_found = 1.

CALL FUNCTION 'LIST_TO_ASCI'

EXPORTING

LIST_INDEX = -1 "LIST_INDEX SY-LSIND.

TABLES

listasci = list_asc

listobject = list.

LOOP AT list_asc.

WRITE : / list_asc.

ENDLOOP.

****Report2

REPORT zkun_imp2 .

TABLES vbkpf.

DATA gt_vbkpf1 TYPE STANDARD TABLE OF vbkpf WITH HEADER LINE.

SELECT-OPTIONS:

p_bukrs FOR vbkpf-bukrs,

p_belnr FOR vbkpf-belnr,

p_gjahr FOR vbkpf-gjahr.

data : p_bukrs1 type vbkpf-bukrs,

p_belnr1 type vbkpf-belnr,

p_gjahr1 type vbkpf-gjahr.

p_bukrs1 = p_bukrs-low.

p_belnr1 = p_belnr-low.

p_gjahr1 = p_gjahr-low.

SELECT * FROM vbkpf INTO TABLE gt_vbkpf1

WHERE bukrs = p_bukrs1

AND gjahr = p_gjahr1

AND belnr = p_belnr1.

LOOP AT gt_vbkpf1.

WRITE : / gt_vbkpf1-bukrs.

ENDLOOP.

  • End of the two reports.

This will help you clear your doubt.

Regards,

Kunal.

6 REPLIES 6
Read only

abdul_hakim
Active Contributor
0 Likes
770

hi

u can call the report.

check the SUBMIT variant for passing the values to the selection screen...

Cheers,

Abdul Hakim

Read only

Former Member
0 Likes
770

YOu can go to list processing from a module pool program using "leave to list processing" statement.

If you want to call a report, then you can use a submit report statement.

To pass the selection screen parameters, you can use

submit <report> with <range1> in <select-option1>

<range2> in <select-option2>, etc.

Regards,

Ravi

Read only

Former Member
0 Likes
770

Kiran,

You can do that. Take a look at this thread, where its discussed in detail.

SUBMIT rm07mlbd

with s_datum in r_datum

WITH s_LGORT in r_LGORT

WITH WERKS = '1000'

EXPORTING LIST TO MEMORY AND RETURN.

Regards,

Ravi

Note : There are quite a few of your threads that are open, please close them if your questions are answered

Read only

Former Member
0 Likes
770

Hai Kiran

it is possible with submit statement

go through this document for Submit

SUBMIT rep.

Additions

1. ... LINE-SIZE col

2. ... LINE-COUNT lin

3. ... TO SAP-SPOOL

4. ... VIA SELECTION-SCREEN

5. ... AND RETURN

6. ... EXPORTING LIST TO MEMORY

7. ... USER user VIA JOB job NUMBER n

8. ... Various additions for parameter transfer to rep

9. ... USING SELECTION-SETS OF PROGRAM prog

Effect

Calls the report rep . Leaves the active program and starts the new report rep .

Addition 1

... LINE-SIZE col

Effect

Prints the report with the line width col .

Addition 2

... LINE-COUNT lin

Effect

Prints the report with lin lines (per page).

Addition 4

... VIA SELECTION-SCREEN

Effect

Displays the selection screen for the user. In this case, the selection screen is redisplayed after return from the report list display - the user's entries are retained.

Addition 5

... AND RETURN

Effect

Returns to the calling transaction or program after the called program has been executed. SUBMIT ... AND RETURN creates a new internal mode .

Addition 6

... EXPORTING LIST TO MEMORY

Effect

Does not display the output list of the called report, but saves it in SAP memory and leaves the called report immediately. Since the calling program can read the list from memory and process it further, you need to use the addition ... AND RETURN . Also, since the called report cannot be requested for printing, the addition ... TO SAP-SPOOL is not allowed here. You can read the saved list from SAP memory with the function module 'LIST_FROM_MEMORY' and then (for example) store it in the database with EXPORT . You can process this list further with the function modules 'WRITE_LIST' , 'DISPLAY_LIST' ... of the function group "SLST" .

Addition 7

... USER user VIA JOB job NUMBER n

Effect

Schedules the specified report in the job specified by the job name job and the job number n . The job runs under the user name user and you can omit the addition USER user . The assignment of the job number occurs via the function module JOB_OPEN (see also the documentation for the function modules JOB_CLOSE and JOB_SUBMIT . This addition can only be used with the addition ...AND RETURN .

Note

When scheduling a report with the SUBMIT ... VIA JOB job NUMBER n statement, you should always use the addition ...TO SAP-SPOOL to pass print and/or archive parameters. Otherwise, default values are used to generate the list and this disturbs operations in a production environment.

Addition 9

... USING SELECTION-SETS OF PROGRAM prog

Effect

Uses variants of the program prog when executing the program rep .

Note

Important

The programs prog and rep must have the same SELECT-OPTIONS and PARAMETER s. Otherwise, variants of the program prog may be destroyed.

Note

When using this addition, the specified variant vari of the program prog is taken in USING SELECTION-SET vari . On the other hand, all variant-related actions on the selection screen of rep (Get , Save as variant , Display , Delete ) refer to the variants of prog .

Example

SUBMIT REPORT01

VIA SELECTION-SCREEN

USING SELECTION-SET 'VARIANT1'

USING SELECTION-SETS OF PROGRAM 'REPORT00'

AND RETURN.

Effect

Executes the program REPORT01 with the variant VARIANT1 of the program REPORT00 .

Note

Runtime errors

LOAD_PROGRAM_NOT_FOUND : The specified program was not found.

SUBMIT_WRONG_TYPE : The specified program is not a report.

SUBMIT_IMPORT_ONLY_PARAMETER : Only one value passed to a report parameter.

SUBMIT_WRONG_SIGN : Invalid value passed to a selection with the addition SIGN .

SUBMIT_IN_ITAB_ILL_STRUCTURE : Table passed to a selection with WITH sel IN itab had an unexpected structure.

Try with this Example

Data: listobject like abaplist occurs 1 with header line.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = listobject

EXCEPTIONS

OTHERS = 1 .

IF sy-subrc <> 0.

message ID '61' TYPE 'E' NUMBER '731'

with 'LIST_FROM_MEMORY'.

ENDIF.

Thanks & regards

Sreenivasulu P

Read only

0 Likes
770

hi ponnadi

i am not getting currect result i am calling from module pool program can u explain me

Read only

Former Member
0 Likes
771

Hi kiran,

1. Yes it is possible to call a report program from a module pool.

2. You can pass the values to the selection screen of report program using the statement <b>Submit</b>.

Read this :

When you start an executable program, the standard selection screen normally appears, containing the selection criteria and parameters of both the logical database connected to the program and of the program itself (see Direct Execution - Reports). When you start an executable program using SUBMIT, there are various additions that you can use to fill the input fields on the selection screen:

<b>SUBMIT... [VIA SELECTION-SCREEN]

[USING SELECTION-SET <var>]

[WITH <sel> <criterion>]

[WITH FREE SELECTIONS <freesel>]

[WITH SELECTION-TABLE <rspar>].</b>

In this the option<b> [via selection-screen ]</b> fulfills your purpose :

<b>The selection screen of the called executable program (report) appears. If you transfer values to the program using one or more of the other options, the corresponding input fields in the selections screen are filled. The user can change these values. By default, the system does not display a selection screen after SUBMIT.</b>

I am giving you the sample code for this .

        • <b>Report1 :</b>

REPORT ZKUN_IMP1 .

DATA : list LIKE TABLE OF abaplist WITH HEADER LINE.

DATA : BEGIN OF list_asc OCCURS 0,

msg(300) TYPE c,

END OF list_asc.

DATA : wa_c_filename(30) TYPE c.

RANGES: r_bukrs FOR vbkpf-bukrs.

RANGES: r_gjahr FOR vbkpf-gjahr.

RANGES: r_belnr FOR vbkpf-belnr.

r_bukrs-sign = 'I'.

r_bukrs-option = 'EQ'.

r_bukrs-low = '1000'.

APPEND r_bukrs.

r_gjahr-sign = 'I'.

r_gjahr-option = 'EQ'.

r_gjahr-low = '2006'.

APPEND r_gjahr.

r_belnr-sign = 'I'.

r_belnr-option = 'EQ'.

r_belnr-low = '0002000001'.

r_belnr-high ='1000000010'.

APPEND r_belnr.

SUBMIT zkun_imp2 via selection-screen

WITH p_bukrs IN r_bukrs

WITH p_gjahr IN r_gjahr

WITH p_belnr IN r_belnr

EXPORTING LIST TO MEMORY

AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = list

EXCEPTIONS

not_found = 1.

CALL FUNCTION 'LIST_TO_ASCI'

EXPORTING

LIST_INDEX = -1 "LIST_INDEX SY-LSIND.

TABLES

listasci = list_asc

listobject = list.

LOOP AT list_asc.

WRITE : / list_asc.

ENDLOOP.

****Report2

REPORT zkun_imp2 .

TABLES vbkpf.

DATA gt_vbkpf1 TYPE STANDARD TABLE OF vbkpf WITH HEADER LINE.

SELECT-OPTIONS:

p_bukrs FOR vbkpf-bukrs,

p_belnr FOR vbkpf-belnr,

p_gjahr FOR vbkpf-gjahr.

data : p_bukrs1 type vbkpf-bukrs,

p_belnr1 type vbkpf-belnr,

p_gjahr1 type vbkpf-gjahr.

p_bukrs1 = p_bukrs-low.

p_belnr1 = p_belnr-low.

p_gjahr1 = p_gjahr-low.

SELECT * FROM vbkpf INTO TABLE gt_vbkpf1

WHERE bukrs = p_bukrs1

AND gjahr = p_gjahr1

AND belnr = p_belnr1.

LOOP AT gt_vbkpf1.

WRITE : / gt_vbkpf1-bukrs.

ENDLOOP.

  • End of the two reports.

This will help you clear your doubt.

Regards,

Kunal.