Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
yashoratna
Participant
Introduction: In SAP CRM actions, we don't have any option to configure, develop and print Adobe form. It allows printing of Smart Forms only.

But we can tweak system to make this feature possible, by doing some config/coding changes.

In SPRO, we have Actions available which gets configured with all the required business functionality. For the purposes of this explanation, I'll use Actions in Billing as an illustration, and I'll assume that we are aware of the fundamental criteria for developing action profiles and definitions. I'm going to skip right to maintaining Processing Types.

Follow the SPRO path mentioned below, to maintain Adobe Form printing.

Customer Relationship Management –> Basic Functions –> Actions –>Actions in Billing –> Change Actions and Conditions –>Define Action Profiles and Actions


There is no option available to maintain Adobe Form in action profile. Only Smart Forms options can be addressed over here.


To achieve adobe form printing from action profile, we need to create and activate one smart form (T-code- smartforms), let's say ZINVOICE_FORM, but don't put any logic in the form. It will have only Main window and other details what system creates automatically.


 

Create custom class (ZCL_BEA_ADB_PROCESSING_PPF ) and assign superclass as a CL_BEA_SF_PROCESSING_PPF and create a new method (e.g. EXEC_ADOBE_FORM)


Create Adobe form (T-code SFP), e.g. ZINVOICE_FORM (I just took same name as Smart Form, it can be different name as well). This adobe form will have all the business functionalities and the logic to handle the requirement.

Method EXEC_ADOBE_FORM will have the logic to call the adobe form and below code snippet will play a key role to execute the same.

 
  TRY .

*If we have same name for Smartform and adobe form then we can assign importing parameter else it will have exact adobe form created in SFP t-code.

DATA(lv_adobe_form) = ip_smart_form.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = lv_adobe_form
IMPORTING
e_funcname = lv_adobe_fm_name.
CATCH cx_fp_api_repository
cx_fp_api_usage
cx_fp_api_internal.
IF sy-subrc <> 0.
* add an error message to processing protocol
MESSAGE i015(sppf_media) WITH lv_adobe_form INTO lv_dummy.
CALL METHOD cl_log_ppf=>add_message
EXPORTING
ip_problemclass = '1'
ip_handle = ip_application_log.
RETURN.
ENDIF.
ENDTRY.

*-----------fill archive parameters for archive link -------------------
IF is_output_options-tdarmod = '2'
OR is_output_options-tdarmod = '3'.

* archive_index_tab
ASSIGN ct_archive_index_tab[ 1 ] TO FIELD-SYMBOL(<fs_archive_index>).
IF sy-subrc EQ 0 AND <fs_archive_index> IS ASSIGNED.
* just fill the id of actual BOR object
<fs_archive_index>-object_id = lv_bea_guid.
IF <fs_archive_index>-object_id IS INITIAL.
DELETE ct_archive_index_tab INDEX 1.
ENDIF.
ENDIF.
ENDIF.

*-----------language of smart form--------------------------------------
* determin here the language of the smart form

DATA(ls_control_parameters) = is_control_parameters.
ls_control_parameters-langu = lv_sf_langu.

DATA(ls_output_options) = is_output_options.

IF NOT ls_printer_profile_data IS INITIAL.
ls_output_options = CORRESPONDING #( ls_printer_profile_data ).
ENDIF.

* Logic for all the required exporting parameters (Here bdh, bdi, bdh_cond, bdi_cond : related to CRM billing) will be filled up as per business functionality.

CALL FUNCTION lv_adobe_fm_name
EXPORTING
archive_index = is_archive_index
archive_index_tab = ct_archive_index_tab
archive_parameters = is_archive_parameters
control_parameters = ls_control_parameters
mail_appl_obj = is_mail_appl_obj
mail_recipient = is_mail_recipient
mail_sender = is_mail_sender
output_options = ls_output_options
user_settings = ip_user_settings
bdh = <s_bdh>
bdi = <t_bdi>
bdh_cond = lt_bdh_cond
bdi_cond = lt_bdi_cond
IMPORTING
document_output_info = es_document_output_info
job_output_info = es_job_output_info
job_output_options = es_job_output_options
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
* add an error message to processing protocol
CASE sy-subrc.
WHEN 1.
MESSAGE e016(sppf_media) INTO lv_dummy.
WHEN 2.
MESSAGE e017(sppf_media) WITH lv_adobe_fm_name INTO lv_dummy.
WHEN 3.
MESSAGE e018(sppf_media) WITH lv_adobe_fm_name INTO lv_dummy.
ENDCASE.
CALL METHOD cl_log_ppf=>add_message
EXPORTING
ip_problemclass = '1'
ip_handle = ip_application_log.
ENDIF.

* get error table
CALL FUNCTION 'SSF_READ_ERRORS'
IMPORTING
errortab = et_error_tab.

 

Let's go back to action profiles to assign the Processing Class, Processing Method and Form Name (Smart Form Name) with the Permitted Processing Types of Action as a (Smart Forms Print)


Next assign the Action Definition on following SPRO path

Customer Relationship Management –> Basic Functions –> Actions –>Actions in Billing –> Change Actions and Conditions  –>Define Conditions


 

Now see the print preview or process the action (Actions in Billing) to see the result. (In the same way how, we execute smart form)


Here, we can see a printout that was created directly in PDF format (Not as OTF format in case of Smart Form). This step completes the capabilities of printing Adobe forms (in SAP CRM actions) under Smart Form framework.


 

Hope you have enjoyed this one. Please keep reading along and feel free to provide any suggestions or comments.

Please read next blog, where I am covering few more important points such as printing multiple copies of the form and enabling the same functionality in CRM Web-UI screen.

 
Labels in this area