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

Create report output from dialog program

0 Likes
2,014

Hi,

I have internal table data in a module/dialog pool that is required on a report. The report should be displayed on the screen and possibly can be printed. In an executable program, this would be done with WRITE or ALV. What to do in a module pool? I was considering passing the data into a sapscript/smartform but was wondering if there are other approaches to consider. Some processing will be required on the data as it gets outputted, i.e. "IF data = this THEN change data to display" etc.

Thanks.

6 REPLIES 6
Read only

emanuel_klenner
Active Participant
0 Likes
1,871

If you really want to stick with the old WRITE commands then you can use the ABAP command:
LEAVE TO LIST-PROCESSING [AND RETURN TO SCREEN dynnr].
Afterwards you can output your data with WRITE statements.
That should be a last alternative. You can probably determine what data you want to output up front, put it into an internal table and then use the ALV to display it.

Read only

0 Likes
1,871

I want to display the data like a PDF in a popup for example, that can be displayed and/or printed off.

That's why I mentioned sapscripts/smartforms - it's that type of report I need to generate.

Imagine the module program is an ALV containing a list of orders. Then I want a button that will format the data as an invoice, for example.

Read only

SimoneMilesi
Active Contributor
0 Likes
1,871

Hello,

you can generate a smartform, invoke it to get the PDF and then show the PDF.

It's something already debated and explained around.
About "processing the data", you can do it before calling the smartform or inside the smartform itself if it's not too complex.

Read only

matt
Active Contributor
0 Likes
1,871

Split your module pool program into three. The module pool itself, a model class that does stuff (reads from the database, updates, gets information etc.) and a view class that is called from the module pool every time there's a user interaction (including starting and finishing the program).

The model class is only called by the view class. Never from the module pool.

This is essentially the MVC pattern for developing UIs.

Once you've done that. You can now easily write your report using the method class.

DATA(model) = NEW z_my_model_class( ).
DATA(report_data) = model->get_data( ).

" Processing to output the report data
Read only

0 Likes
1,871

The program is already written in MVC structure. That's not the question though.

The question is what functionality should be used to generate the report.

Example: imagine the module program is an ALV containing a list of orders. Then I want a button that will format the data as an invoice. How should the invoice be generated is the question - sapscript, smartform, adobe form, WRITE, etc. etc.

Read only

0 Likes
1,871

Thanks, yes it's something I've done many times before, however never from a module pool.

I wanted to hear other people's experiences of generating this type of output from an ALV/dialog program.

Since sapscripts & smartforms are no longer supported by SAP, I should use Adobe Forms.

But anyway if no one has other suggestions, I'll assume this is the de facto best approach! 🙂