Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to display Adobe form using BSP applications

Subbaka11
Participant
0 Kudos
584

Hello team,

I am displaying adobe form using below code, I am able to display form, But I need to link Input values to the controller.

example In input filed we enter Delivery and click on push button form needs to be displayed with given input.

Please let me know if any one knows how to link Input put values to the controller in BSP applications

METHOD do_request.
*CALL METHOD SUPER->DO_REQUEST

runtime->server->response->delete_header_field( name = 'Cache-Control' ) .
runtime->server->response->delete_header_field( name = 'Expires' ).
runtime->server->response->delete_header_field( name = 'Pragma' ).

DATA: l_name TYPE funcname.
TRY.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = 'ZOTC_FORM_ORD_CONF1'
IMPORTING
e_funcname = l_name
EXCEPTIONS
OTHERS = 0.
CATCH cx_fp_api_repository. "#EC NO_HANDLER
CATCH cx_fp_api_usage. "#EC NO_HANDLER
CATCH cx_fp_api_internal. "#EC NO_HANDLER
ENDTRY.

DATA: l_outputparams TYPE sfpoutputparams.
*Start Form Processing.
l_outputparams-nodialog = 'X'.
l_outputparams-getpdf = 'X'.
l_outputparams-connection = 'ADS'.
l_outputparams-dest = 'LP01'.
l_outputparams-pdltype = 'pdf'.
l_outputparams-getpdf = 'X'.

CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = l_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.

DATA: fp_docparams TYPE sfpdocparams,
reservedonly TYPE bapisbodat-reserved,
booking_data TYPE bapisbonew,
fp_result TYPE fpformoutput.
fp_docparams-fillable = 'X'.
fp_docparams-langu = sy-langu.
fp_docparams-country = 'US'.

DATA: gs_interface TYPE sdoc_s_prt_interface.

CALL FUNCTION l_name
EXPORTING
/1bcdwb/docparams = fp_docparams
sls_prt_com = gs_interface
IMPORTING
/1bcdwb/formoutput = fp_result
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

DATA: pdf TYPE fpformoutput-pdf.
pdf = fp_result-pdf.

CALL FUNCTION 'FP_JOB_CLOSE'
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.

CALL METHOD response->set_content_type
EXPORTING
content_type = 'application/pdf'.

CALL METHOD response->set_data
EXPORTING
data = pdf.
* .

ENDMETHOD.

2 REPLIES 2
Read only

Subbaka11
Participant
0 Kudos
492

I have achieved this using below code, I am able to display form using below code.

But I am unable to pass input values to Controller, could you please help me on this.

METHOD do_request.
*CALL METHOD SUPER->DO_REQUEST

runtime->server->response->delete_header_field( name = 'Cache-Control' ) .
runtime->server->response->delete_header_field( name = 'Expires' ).
runtime->server->response->delete_header_field( name = 'Pragma' ).

DATA: l_name TYPE funcname.
TRY.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = 'ZOTC_FORM_ORD_CONF1'
IMPORTING
e_funcname = l_name
EXCEPTIONS
OTHERS = 0.
CATCH cx_fp_api_repository. "#EC NO_HANDLER
CATCH cx_fp_api_usage. "#EC NO_HANDLER
CATCH cx_fp_api_internal. "#EC NO_HANDLER
ENDTRY.

DATA: l_outputparams TYPE sfpoutputparams.
*Start Form Processing.
l_outputparams-nodialog = 'X'.
l_outputparams-getpdf = 'X'.
l_outputparams-connection = 'ADS'.
l_outputparams-dest = 'LP01'.
l_outputparams-pdltype = 'pdf'.
l_outputparams-getpdf = 'X'.

CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = l_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.

DATA: fp_docparams TYPE sfpdocparams,
reservedonly TYPE bapisbodat-reserved,
booking_data TYPE bapisbonew,
fp_result TYPE fpformoutput.
fp_docparams-fillable = 'X'.
fp_docparams-langu = sy-langu.
fp_docparams-country = 'US'.

DATA: gs_interface TYPE sdoc_s_prt_interface.

CALL FUNCTION l_name
EXPORTING
/1bcdwb/docparams = fp_docparams
sls_prt_com = gs_interface
IMPORTING
/1bcdwb/formoutput = fp_result
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

DATA: pdf TYPE fpformoutput-pdf.
pdf = fp_result-pdf.

CALL FUNCTION 'FP_JOB_CLOSE'
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.

CALL METHOD response->set_content_type
EXPORTING
content_type = 'application/pdf'.

CALL METHOD response->set_data
EXPORTING
data = pdf.
* .

ENDMETHOD.

Read only

Subbaka11
Participant
0 Kudos
492

This issue got solved, I am able to display form without using Controller in BSP

I have used Layout and ONInputProcessing below is the sample code to display PO form using only Order.

Layout

<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<html>
<title>Display form</title>
<h1>Display form</h1>
<body>
<form method = "post" name="x">
<table border="1">
<tr>
<td>Order:</td>
<td>
<input type="text" size="10" maxlength="10" name="in_vbeln">
</td>
</tr>
<tr>
<td>Delivery</td>
<td>
<input type="text" size="10" maxlength="10" name="in_delivery">
</td>
</tr>
</table>
<table border="1">
<tr>
<td>
<input type=submit name="onInputProcessing(Print)" value="Print">
</td>
<td>
<input type=submit name="onInputProcessing(cancel)" value="Cancel">
</td>
</table>
</form>

ONInputProcessing

* event handler for checking and processing user input and
* for defining navigation
DATA: i_vbeln TYPE vbeln,
lwa_vbdka TYPE vbdka,
lwa_SDOC_S_PRT_HEAD_DETAIL TYPE SDOC_S_PRT_HEAD_DETAIL .

DATA: gs_interface TYPE sdoc_s_prt_interface.
CLEAR lwa_vbdka .
CASE event_id.
WHEN 'Print'.
* Sets value of parameters, i.e. gets value from screen
navigation->set_parameter( name = 'in_vbeln').
navigation->set_parameter( name = 'in_delivery').

* Gets value of parameter, so can be moved into abap field
* Note: zzkunnavn and zzcurr are declared in page attributes
i_vbeln = navigation->get_parameter( name = 'in_vbeln').
* i_delivery = navigation->get_parameter( name = 'in_delivery').

runtime->server->response->delete_header_field( name = 'Cache-Control' ) .
runtime->server->response->delete_header_field( name = 'Expires' ).
runtime->server->response->delete_header_field( name = 'Pragma' ).

DATA(vbeln) = in_vbeln .
lwa_vbdka-vbeln = vbeln .
lwa_SDOC_S_PRT_HEAD_DETAIL-vbdka = lwa_vbdka .
gs_interface-head_detail = lwa_SDOC_S_PRT_HEAD_DETAIL .

DATA: l_name TYPE funcname.
TRY.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = 'ZPO_FORM_NAME'
IMPORTING
e_funcname = l_name
EXCEPTIONS
OTHERS = 0.
CATCH cx_fp_api_repository. "#EC NO_HANDLER
CATCH cx_fp_api_usage. "#EC NO_HANDLER
CATCH cx_fp_api_internal. "#EC NO_HANDLER
ENDTRY.

DATA: l_outputparams TYPE sfpoutputparams.
*Start Form Processing.
l_outputparams-nodialog = 'X'.
l_outputparams-getpdf = 'X'.
l_outputparams-connection = 'ADS'.
l_outputparams-dest = 'LP01'.
l_outputparams-pdltype = 'pdf'.
l_outputparams-getpdf = 'X'.

CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = l_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.

DATA: fp_docparams TYPE sfpdocparams,
reservedonly TYPE bapisbodat-reserved,
booking_data TYPE bapisbonew,
fp_result TYPE fpformoutput.
fp_docparams-fillable = 'X'.
fp_docparams-langu = sy-langu.
fp_docparams-country = 'US'.


CALL FUNCTION l_name
EXPORTING
/1bcdwb/docparams = fp_docparams
sls_prt_com = gs_interface
IMPORTING
/1bcdwb/formoutput = fp_result
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

DATA: pdf TYPE fpformoutput-pdf.
pdf = fp_result-pdf.

CALL FUNCTION 'FP_JOB_CLOSE'
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.


CALL METHOD _m_response->set_content_type
EXPORTING
content_type = 'application/pdf'.

CALL METHOD _m_response->set_data
EXPORTING
data = pdf.


WHEN 'cancel'.
navigation->next_page('TOMAIN').

ENDCASE.