This sample coding is taken from class CL_IM_HRRCF_REQUI_REQUEST,
IF_HRASR00GEN_SERVICE_ADVANCED~FLUSH method. Demonstrated under SAP standard requisition form.
* PDF as attachment
SELECT SINGLE parent_scenario FROM t5asrsteps INTO scenario_guid WHERE case_guid = step_guid.
CALL METHOD cl_hrasr00_pdf_generation=>generate_pdf
EXPORTING
scenario_guid = scenario_guid
step_guid = step_guid_process
message_handler = message_handler
IMPORTING
xstring = xstring.
CONCATENATE text-a01 '.pdf' INTO lv_request_form. "N1600701
attachment-filename = lv_request_form. "N1600701
attachment-att_type = att_type_request.
attachment-language = sy-langu.
attachment-att_header = text-a01.
attachment-content = xstring.
attachment-mimetype = 'application/pdf'.
APPEND attachment TO attachments.
* Attachments of process
CALL METHOD cl_hrasr00_container_utils=>get_attachments
EXPORTING
step_guid = step_guid_process
RECEIVING
attachments = attachment_others.
IF NOT att_type_others IS INITIAL.
attachment-att_type = att_type_others.
LOOP AT attachment_others INTO attachment_other.
attachment-language = sy-langu.
attachment-att_header = attachment_other-attachment_type_text.
attachment-content = attachment_other-attachment_content.
attachment-mimetype = attachment_other-attachment_mimetype.
attachment-filename = attachment_other-attachment_filename. "N1600701
APPEND attachment TO attachments.
ENDLOOP.
ENDIF.
IF_HRASR00GEN_SERVICE_ADVANCED~FLUSH method. Demonstrated under SAP standard requisition form.
* PDF as attachment
SELECT SINGLE parent_scenario FROM t5asrsteps INTO scenario_guid WHERE case_guid = step_guid.
CALL METHOD cl_hrasr00_pdf_generation=>generate_pdf
EXPORTING
scenario_guid = scenario_guid
step_guid = step_guid_process
message_handler = message_handler
IMPORTING
xstring = xstring.
CONCATENATE text-a01 '.pdf' INTO lv_request_form. "N1600701
attachment-filename = lv_request_form. "N1600701
attachment-att_type = att_type_request.
attachment-language = sy-langu.
attachment-att_header = text-a01.
attachment-content = xstring.
attachment-mimetype = 'application/pdf'.
APPEND attachment TO attachments.
* Attachments of process
CALL METHOD cl_hrasr00_container_utils=>get_attachments
EXPORTING
step_guid = step_guid_process
RECEIVING
attachments = attachment_others.
IF NOT att_type_others IS INITIAL.
attachment-att_type = att_type_others.
LOOP AT attachment_others INTO attachment_other.
attachment-language = sy-langu.
attachment-att_header = attachment_other-attachment_type_text.
attachment-content = attachment_other-attachment_content.
attachment-mimetype = attachment_other-attachment_mimetype.
attachment-filename = attachment_other-attachment_filename. "N1600701
APPEND attachment TO attachments.
ENDLOOP.
ENDIF.
No comments:
Post a Comment