0% found this document useful (0 votes)
68 views5 pages

If Ex Hrhap00 Smartforms Print Document

This document describes a method for printing smart forms documents in ABAP. It defines data structures and tables to store document data. It retrieves data for a selected document, converts it and removes hidden elements. It then calls the appropriate generated function module to display the document based on the number of columns, passing all the processed document data. It loops through multiple selected documents, adjusting output parameters between documents.

Uploaded by

Darko Projceski
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views5 pages

If Ex Hrhap00 Smartforms Print Document

This document describes a method for printing smart forms documents in ABAP. It defines data structures and tables to store document data. It retrieves data for a selected document, converts it and removes hidden elements. It then calls the appropriate generated function module to display the document based on the number of columns, passing all the processed document data. It loops through multiple selected documents, adjusting output parameters between documents.

Uploaded by

Darko Projceski
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

METHOD if_ex_hrhap00_smartforms~print_document.

* includes
INCLUDE: incl_hap_screen.
* tables
DATA: lt_header_appraiser
TYPE hap_t_header_appraiser,
lt_header_appraisee
TYPE hap_t_header_appraisee,
lt_header_part_appraiser TYPE hap_t_header_part_appraisers,
lt_header_others
TYPE hap_t_header_others,
lt_header_add_data
TYPE hap_t_header_add_data,
lt_body_columns
TYPE hap_t_body_columns,
lt_body_elements
TYPE hap_t_body_elements,
lt_body_cells
TYPE hap_t_body_cells,
lt_body_cell_notes
TYPE hap_t_body_cell_notes,
lt_body_element_descr
TYPE hap_t_body_element_descr,
lt_body_cell_val_values TYPE hap_t_body_cell_val_values,
lt_body_cell_val_ranges TYPE hap_t_body_cell_val_ranges,
lt_body_cell_val_c_like TYPE hap_t_body_cell_val_c_like,
lt_body_cell_val_descr
TYPE hap_t_body_cell_val_descr,
lt_status_notes
TYPE hap_t_status_note.
* workareas
DATA: lw_document_id TYPE hap_s_appraisal_id.
* structures
DATA: ls_header_texts
TYPE
ls_header_dates
TYPE
ls_header_status
TYPE
ls_doc_processing
TYPE
ls_header_display
TYPE
DATA: ls_control_parameters
TYPE
ls_output_options
TYPE
* variables
DATA: l_mode
TYPE char1,
l_fm_name_10 TYPE char30,
l_fm_name_20 TYPE char30,
l_fm_name TYPE char30,
l_lines TYPE i,
l_column_number TYPE i.

hap_s_header_texts,
hap_s_header_dates,
hap_s_header_status,
hap_s_doc_processing,
hap_s_header_display.
ssfctrlop,
ssfcompop.

* set control parameters


CLEAR ls_control_parameters.
DESCRIBE TABLE t_document_id LINES l_lines.
IF l_lines > 1.
* set control parameters for output
ls_control_parameters-no_open = ' '.
ls_control_parameters-no_close = 'X'.
ENDIF.
* get generated function module name for smartform with columns 1- 10
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname
= c_form_10
IMPORTING
fm_name
= l_fm_name_10
EXCEPTIONS
no_form
= 1
no_function_module = 2
OTHERS
= 3.
IF sy-subrc <> 0.
* error handling
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.


EXIT.
ENDIF.
* get generated function module name for smartform with columns 11- 20
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname
= c_form_20
IMPORTING
fm_name
= l_fm_name_20
EXCEPTIONS
no_form
= 1
no_function_module = 2
OTHERS
= 3.
IF sy-subrc <> 0.
* error handling
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
* get current print parameters and set output options
CALL METHOD me->get_print_parameters
EXPORTING
output_type
= space
IMPORTING
s_output_options = ls_output_options.
* get selected document
LOOP AT t_document_id INTO lw_document_id.
*

IF sy-tabix = l_lines AND l_lines > 1.


set control parameters for output
ls_control_parameters-no_open = 'X'.
ls_control_parameters-no_close = ' '.
ENDIF.
read document data
l_mode = c_mode_display. "display mode
CALL FUNCTION 'HRHAP_DOCUMENT_GET_DETAIL'
EXPORTING
mode
= l_mode
plan_version
= plan_version
s_appraisal_id
= lw_document_id
IMPORTING
s_doc_processing
= ls_doc_processing
s_header_texts
= ls_header_texts
t_header_appraiser
= lt_header_appraiser
t_header_appraisee
= lt_header_appraisee
t_header_part_appraiser = lt_header_part_appraiser
t_header_others
= lt_header_others
s_header_status
= ls_header_status
s_header_dates
= ls_header_dates
t_header_add_data
= lt_header_add_data
s_header_display
= ls_header_display
t_body_columns
= lt_body_columns
t_body_elements
= lt_body_elements
t_body_element_descr
= lt_body_element_descr
t_body_cells
= lt_body_cells
t_body_cell_notes
= lt_body_cell_notes

t_status_notes
*

= lt_status_notes.

get number of displayed columns


CALL FUNCTION 'HRHAP_NUMBER_OF_DISP_COLS_GET'
EXPORTING
t_body_columns
= lt_body_columns
IMPORTING
number_of_columns = l_column_number.
CALL METHOD me->remove_hidden_elements
CHANGING
t_body_elements
= lt_body_elements
t_body_element_descr = lt_body_element_descr
t_body_cells
= lt_body_cells
t_body_cell_notes
= lt_body_cell_notes.

*-- Convert Note data for SMARTFORM display


CALL FUNCTION 'HRHAP_CONVERT_NOTE_TO_SMART'
CHANGING
t_body_cell_notes = lt_body_cell_notes.
*

now call the generated function module


IF l_column_number <= 10.
l_fm_name = l_fm_name_10.
ELSE.
l_fm_name = l_fm_name_20.
ENDIF.

"------------------------------------------------"prevod
DATA: lv_text TYPE string.
"body elements
FIELD-SYMBOLS: <lfs_body_elements> LIKE LINE OF lt_body_elements.
LOOP AT lt_body_elements ASSIGNING <lfs_body_elements>.
IF NOT <lfs_body_elements>-name IS INITIAL.
CLEAR lv_text.
lv_text = <lfs_body_elements>-name.
CALL FUNCTION 'ZBC_LAT_CYR_CONVERSION'
EXPORTING
data_in = lv_text
IMPORTING
data_out = lv_text.
IF sy-subrc EQ 0.
<lfs_body_elements>-name = lv_text.
ENDIF.
ENDIF.
ENDLOOP.
"ls_header_texts
CALL FUNCTION 'ZBC_LAT_CYR_CONVERSION'
EXPORTING
data_in = ls_header_texts-appraisal_txt
IMPORTING
data_out = ls_header_texts-appraisal_txt.
CALL FUNCTION 'ZBC_LAT_CYR_CONVERSION'
EXPORTING
data_in = ls_header_texts-appraisal_name

IMPORTING
data_out = ls_header_texts-appraisal_name.
CALL FUNCTION 'ZBC_LAT_CYR_CONVERSION'
EXPORTING
data_in = ls_header_texts-status_txt
IMPORTING
data_out = ls_header_texts-status_txt.
CALL FUNCTION 'ZBC_LAT_CYR_CONVERSION'
EXPORTING
data_in = ls_header_texts-apper_type_txt
IMPORTING
data_out = ls_header_texts-apper_type_txt.
*
*
*
*
*
*
*
*
*
*
*
*

ls_header_texts-apper_type_txt
ls_header_texts-apper_type_txt_m
ls_header_texts-appee_type_txt
ls_header_texts-appee_type_txt_m
ls_header_texts-p_apper_type_txt
ls_header_texts-p_apper_type_m
ls_header_texts-other_type_txt
ls_header_texts-val_period_txt
ls_header_texts-exe_period_txt
ls_header_texts-obj_date_txt
ls_header_texts-rev_date_txt
ls_header_texts-app_date_txt
""end prevod
"------------------------------------------------"Datum na odrzuvanje na obukata
FIELD-SYMBOLS: <header_appraiser> LIKE LINE OF lt_header_appraiser,
<header_appraisee> LIKE LINE OF lt_header_appraisee.
"proverka kade e obukata
UNASSIGN: <header_appraiser>.
READ TABLE lt_header_appraiser ASSIGNING <header_appraiser> WITH KEY type =

'E'.
IF sy-subrc EQ 0.
IF NOT <header_appraiser>-id IS INITIAL AND NOT <header_appraiser>-plan_ve
rsion IS INITIAL.
CLEAR: ls_header_dates-ap_date_earliest, ls_header_dates-ap_date_latest.
SELECT SINGLE begda endda
FROM hrp1026
INTO (ls_header_dates-ap_date_earliest, ls_header_dates-ap_date_latest)
WHERE plvar EQ <header_appraiser>-plan_version
AND otype EQ <header_appraiser>-type
AND objid EQ <header_appraiser>-id.
ENDIF.
ELSE.
UNASSIGN: <header_appraisee>.
READ TABLE lt_header_appraisee ASSIGNING <header_appraisee> WITH KEY type
= 'E'.
IF sy-subrc EQ 0.
IF NOT <header_appraisee>-id IS INITIAL AND NOT <header_appraisee>-plan_
version IS INITIAL.
CLEAR: ls_header_dates-ap_date_earliest, ls_header_dates-ap_date_lates
t.
SELECT SINGLE begda endda
FROM hrp1026
INTO (ls_header_dates-ap_date_earliest, ls_header_dates-ap_date_latest
)

WHERE plvar EQ <header_appraisee>-plan_version


AND otype EQ <header_appraisee>-type
AND objid EQ <header_appraisee>-id.
ENDIF.
ENDIF.
ENDIF.
"------------------------------------------------CALL FUNCTION l_fm_name
EXPORTING
control_parameters
= ls_control_parameters
output_options
= ls_output_options
s_doc_processing
= ls_doc_processing
s_header_display
= ls_header_display
s_header_texts
= ls_header_texts
s_header_status
= ls_header_status
t_header_appraiser
= lt_header_appraiser
t_header_appraisee
= lt_header_appraisee
t_header_part_appraiser = lt_header_part_appraiser
t_header_other
= lt_header_others
s_header_dates
= ls_header_dates
t_header_add_data
= lt_header_add_data
t_body_columns
= lt_body_columns
t_body_elements
= lt_body_elements
t_body_cells
= lt_body_cells
t_body_cell_notes
= lt_body_cell_notes
t_body_element_descr
= lt_body_element_descr
t_body_cell_val_values = lt_body_cell_val_values
t_body_cell_val_ranges = lt_body_cell_val_ranges
t_body_cell_val_c_like = lt_body_cell_val_c_like
t_body_cell_val_descr = lt_body_cell_val_descr
EXCEPTIONS
formatting_error
= 1
internal_error
= 2
send_error
= 3
user_canceled
= 4
OTHERS
= 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF l_lines > 1.
set control parameters for output
ls_control_parameters-no_open = 'X'.
ls_control_parameters-no_close = 'X'.
ENDIF.
ENDLOOP.
"at all documents
ENDMETHOD.
*

You might also like