cancel
Showing results for 
Search instead for 
Did you mean: 

Reader rights for adding attachment

Former Member
0 Kudos

Hi ,

is it possible to apply reader rights for adding attachments when output pdf form in sap?

where can i find more document on controlling reader rights?

thanks and best regards.

Jun

Accepted Solutions (1)

Accepted Solutions (1)

krishanu_biswas
Active Participant
0 Kudos

Hello Jun,

Had you specified a bit about your system landscape (WD4J/WD4A/NW04/NW04s/SP stack etc), it would have been easier for me to answer your query. Nevertheless, let me try:

- NW04 does not support attachment capability

- NW04s supports it from SP09 (with the latest hotfix release of Web Dynpro runtime - Note: 982023) or SP10 (with the latest hotfix release of Web Dynpro runtime - Note: 984868). SP11 supports it with its base release.

- No need to add any usage rights separately to enable the attachment capability. It is added by default by the integration framework.

Best Regards,

Krish

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Jun,

here is a sample code for seting usage rights:

FORM use_rights

CHANGING p_pdf TYPE xstring.

DATA: l_fp TYPE REF TO if_fp,

l_pdfobj TYPE REF TO if_fp_pdf_object,

l_dest TYPE rfcdest.

MOVE cl_fp=>get_ads_connection( ) TO l_dest.

l_fp = cl_fp=>get_reference( ).

l_pdfobj = l_fp->create_pdf_object( connection = l_dest ).

l_pdfobj->set_document( pdfdata = l_pdf ).

DATA: lt_rights TYPE TFPURIGHT.

PERFORM my_usagerights CHANGING lt_rights.

l_pdfobj->set_usagerights( default_rights = space rights = lt_rights ).

l_pdfobj->execute( ).

l_pdfobj->get_document( IMPORTING pdfdata = l_pdf ).

ENDFORM.

FORM my_usagerights

CHANGING pt_rights TYPE TFPURIGHT.

DATA: ls_rights LIKE LINE OF pt_rights.

REFRESH pt_rights.

ls_rights-right = if_fp_pdf_usage_rights=>formrights.

ls_rights-value = if_fp_pdf_usage_rights=>formright_fillin. "Ukladani

INSERT ls_rights INTO TABLE pt_rights.

ls_rights-value = if_fp_pdf_usage_rights=>formright_export. "Export XML

INSERT ls_rights INTO TABLE pt_rights.

ls_rights-value = if_fp_pdf_usage_rights=>formright_add.

INSERT ls_rights INTO TABLE pt_rights.

ls_rights-value = if_fp_pdf_usage_rights=>formright_delete.

INSERT ls_rights INTO TABLE pt_rights.

ls_rights-value = if_fp_pdf_usage_rights=>formright_submitstandalone.

INSERT ls_rights INTO TABLE pt_rights.

ls_rights-value = if_fp_pdf_usage_rights=>formright_spawntemplate.

INSERT ls_rights INTO TABLE pt_rights.

ls_rights-value = if_fp_pdf_usage_rights=>formright_online.

INSERT ls_rights INTO TABLE pt_rights.

*

ls_rights-right = if_fp_pdf_usage_rights=>signrights.

ls_rights-value = if_fp_pdf_usage_rights=>signright_modify.

INSERT ls_rights INTO TABLE pt_rights.

*

ls_rights-right = if_fp_pdf_usage_rights=>annotrights.

ls_rights-value = if_fp_pdf_usage_rights=>annotright_create.

INSERT ls_rights INTO TABLE pt_rights.

ls_rights-value = if_fp_pdf_usage_rights=>annotright_delete.

INSERT ls_rights INTO TABLE pt_rights.

ls_rights-value = if_fp_pdf_usage_rights=>annotright_modify.

INSERT ls_rights INTO TABLE pt_rights.

ls_rights-value = if_fp_pdf_usage_rights=>annotright_copy.

INSERT ls_rights INTO TABLE pt_rights.

ls_rights-value = if_fp_pdf_usage_rights=>annotright_import.

INSERT ls_rights INTO TABLE pt_rights.

ls_rights-value = if_fp_pdf_usage_rights=>annotright_export.

INSERT ls_rights INTO TABLE pt_rights.

ENDFORM.

Michal

Sigiswald
Contributor
0 Kudos

Hi Jun,

In case you use Web Dynpro on NW04s, please check <a href="https://help.sap.com/javadocs/NW04S/current/wd/com/sap/tc/webdynpro/clientserver/adobe/pdfdocument/api/WDPDFDocumentProtectPermission.html">WDPDFDocumentProtectPermission</a>. You can use it like this.


WDPDFDocumentProtectPermission[] permissions = {
  WDPDFDocumentProtectPermission.ALL };
IWDPDFDocumentInteractiveFormHandler handler =
  WDPDFDocumentFactory.getDocumentHandler(
    view.getContext().getController(),
    "InteractiveForm");
IWDPDFDocumentInteractiveFormContext ctx = handler.getDocumentContext();
ctx.setProtection(null, null, permissions);

In NW04 there's a similar API, <a href="https://help.sap.com/javadocs/NW04/current/wd/com/sap/tc/webdynpro/pdfobject/api/WDFormRights.html">WDFormRights</a>, but I don't know how to apply it to a pdf document created via the InteractiveForm UI element.

Kind regards,

Sigiswald

krishanu_biswas
Active Participant
0 Kudos

Hello Sigiswald,

Although applying usage rights and applying certain permissions to the document are related concepts but the difference must be understood to make use of them when required.

Usage Rights: Applying Usage Rights to a PDF document is all about enabling the Reader rights so that the Reader allows you to do certain operations like form filling, adding attachments etc etc. Usage rights are required to be applied for the interactive form to work as such. Non-appliance of the usage rights would result in print forms (non-editable) to be created.

Permisisons: Permissions are applied on the document mostly at the application level. Some of the permissions are for example, "Changes not allowed", "Print not allowed" etc can be exercised by the application to control certain aspects of the PDF document and its behavior.

Note:

1. Only the couple of permissions mentioned above works. Rest of the permissions will be implemented shortly.

2. Usage of Permissions in your project would require an SSL based communication channel between the WD server and the ADS.

Hope that helps.

Best Regards,

Krish

Sigiswald
Contributor
0 Kudos

Hi Krish,

Thanks for the clear explanation, especially the notes!

Kind regards,

Sigiswald