Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
mmcisme1
Active Contributor
3,019
So.. this is an older way to code things. Please do add things at the bottom of the post - you know things like the objects that could have been used. It will help people on the newer versions.

The project: Create something that can save, create, upload, and e-mail documents. It should be easy to use.

The save, retrieve and e-mail part of the project was covered with my first blog.That was a multi-purpose blog begging people to create information on SAP Community again.

So first off - here is the first screen again.



This screen was created using fields, buttons, a table control, a subs screen and  a custom control box.

For the table control - use the wizard to create it. Make the lines selectable, and clickable.

For the subscreen - it was an easy way to create the select options and be able to save parameters.  I created a normal report program for that piece.  Because it was in a different program, I had to send the fields to the main dynpro program:  I filled global fields.
      PERFORM fill_parameters(sapmzdoc)  TABLES so_crt
USING kunnr
lifnr
p_ddes
p_doc
p_item
' '.

Back to the dynpro:
  CALL SUBSCREEN parmaeters.

Then I called the modify module ON CHAIN-REQUEST..  Where I retrieved the line from the table control:
  GET CURSOR FIELD field_name LINE line_number.
line_number = tc_300-top_line + line_number - 1.

Next - The user command, on this part, they probably want the PDF displayed first. To retrieve the PDF. I simply recreate the file name based on the key entries.  I select that from a Z table.  Next the standard Open / do / read / close
* get the data
OPEN DATASET docs-file_name FOR INPUT IN BINARY MODE.

IF sy-subrc <> 0.
CONCATENATE 'Could not open file' docs-file_name
INTO message SEPARATED BY space.
EXIT.
ENDIF.

DO.
READ DATASET docs-file_name INTO pdf LENGTH lv_size.
IF sy-subrc <> 0.
EXIT.
ENDIF.
pdf_size = pdf_size + lv_size.
APPEND pdf.
ENDDO.

CLOSE DATASET docs-file_name.

So I've got the "PDF".   Let's display it in that container.
  TYPES: lt_pdf_line(134) TYPE c.
DATA: l_url(80) TYPE c,
l_pdf_data TYPE STANDARD TABLE OF lt_pdf_line.

l_pdf_data[] = p_pdf[].

* transfer data to data provider
CALL METHOD pdf_html_control->load_data
EXPORTING
url = 'smart.pdf'
size = pdf_size
type = 'text'
subtype = 'pdf'
IMPORTING
assigned_url = l_url
CHANGING
data_table = l_pdf_data[]
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
message = 'Internal IT error'.
ENDIF.

* show data
CALL METHOD pdf_html_control->show_data
EXPORTING
url = l_url
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
message = 'Internal IT error'.
ENDIF.

 

Done - it is displayed!  The e-mail screen looks like this. The details to send the e-mail are in the previous blog.



The message will be displayed at the top of the screen. Similar to our webpage. The user can type anything they want in the body.  Send e-mail and a list of the partner external addresses are displayed to determine which one(s) they want the mail to go to. There is also an option to send the e-mail only to yourself.

Again - new objects - different way of doing things? I would love to read about them!
5 Comments
Labels in this area