- contributed by : Indrajit Ganguly (SAP ABAP Consultant)
Note: Before to create Adobe Form, first you have to install ADB (Adobe Lifecycle Designer). Then you only able to create Adobe Form.
Here we are using a table type ‘YTBLTYP_MARA’.
1. Go to T-code ‘SFP’.
To create form first you have to create the Interface.
a) Click on append row and add the parameter bashed on Table type. Then active the Interface.
b) Create the form bashed on the Interface name.
C) Following screen will appear. Just you have to drag & drop form left side GT_MARA into the context area (Right side).
D) GT_MARA will be appear in the Context area. Here I am using only MATNR, ERSDA, ERNAM, and MATKL. Then click on Layout.
(If you want form here you can activate or deactivate the Fields, just go to the Fields name then Right click, click on Deactivate. Also you can create Node form here).
E) Following screen will be appear. Here see the Hierarchy table, click in the Data View.
F) Then you can drag & drop the Table into your Design View tab.
Note: Here we have Three kind of tabs, like Design View, Master Page and Preview PDF.
- Design View : For example if you print like Item details, then we use Design View.
- Master Page : For example if you print like Header details, the we use Master Page.
Master Page will reflect in all remaining pages.
Here you can adjust the design
G) Here you can use Data Binding with fields, In this case this is not required because we have used drag & drop. Thatswhy it is already binded with respective fields. Example MATNR.
Activate the form.
2) Write a Program to Call the Adobe Form
Go to Transaction code SE38 and Create a Test Program "YCALL_ADOBE_FORM".
*&---------------------------------------------------------------------*
*& Report YCALL_ADOBE_FORM
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ycall_adobe_form.
TYPES: BEGIN OF ty_mara,
matnr TYPE matnr,
ersda TYPE ersda,
ernam TYPE ernam,
matkl TYPE matkl,
END OF ty_mara.
DATA: lt_mara TYPE ytbltyp_mara, "Created Table type
fm_form TYPE fpname VALUE 'YFIRST_FORM', "Form name
gv_fname TYPE rs38l_fnam, "Function module name
fp_docparams TYPE sfpdocparams, "Form Parameters for Form Processing
fp_outputparams TYPE sfpoutputparams. "Form Processing Output Parameter
*Get the name of the generated function module
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = fm_form
IMPORTING
e_funcname = gv_fname
* E_INTERFACE_TYPE =
* EV_FUNCNAME_INBOUND =
.
*Opening spool job
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
*Fetch the Data
*SELECT matnr ersda ernam matkl
* FROM mara INTO TABLE lt_mara UP TO 10 ROWS.
SELECT * FROM mara INTO TABLE lt_mara UP TO 15 ROWS.
*Call the generated function module
CALL FUNCTION gv_fname
EXPORTING
* /1bcdwb/docparams = fp_docparams
gt_mara = lt_mara.
* IMPORTING
* /1BCDWB/FORMOUTPUT =
* EXCEPTIONS
* usage_error = 1
* system_error = 2
* internal_error = 3
* OTHERS = 4.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
* Closing spool job
CALL FUNCTION 'FP_JOB_CLOSE'
* IMPORTING
* E_RESULT =
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
*& Report YCALL_ADOBE_FORM
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ycall_adobe_form.
TYPES: BEGIN OF ty_mara,
matnr TYPE matnr,
ersda TYPE ersda,
ernam TYPE ernam,
matkl TYPE matkl,
END OF ty_mara.
DATA: lt_mara TYPE ytbltyp_mara, "Created Table type
fm_form TYPE fpname VALUE 'YFIRST_FORM', "Form name
gv_fname TYPE rs38l_fnam, "Function module name
fp_docparams TYPE sfpdocparams, "Form Parameters for Form Processing
fp_outputparams TYPE sfpoutputparams. "Form Processing Output Parameter
*Get the name of the generated function module
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = fm_form
IMPORTING
e_funcname = gv_fname
* E_INTERFACE_TYPE =
* EV_FUNCNAME_INBOUND =
.
*Opening spool job
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
*Fetch the Data
*SELECT matnr ersda ernam matkl
* FROM mara INTO TABLE lt_mara UP TO 10 ROWS.
SELECT * FROM mara INTO TABLE lt_mara UP TO 15 ROWS.
*Call the generated function module
CALL FUNCTION gv_fname
EXPORTING
* /1bcdwb/docparams = fp_docparams
gt_mara = lt_mara.
* IMPORTING
* /1BCDWB/FORMOUTPUT =
* EXCEPTIONS
* usage_error = 1
* system_error = 2
* internal_error = 3
* OTHERS = 4.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
* Closing spool job
CALL FUNCTION 'FP_JOB_CLOSE'
* IMPORTING
* E_RESULT =
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
Thanks for sharing this Information, Got to learn new things from your Blog on SAP SF.SAP SF
ReplyDeleteYour style is very unique in comparison to other people I’ve read stuff from. Thanks for posting when you’ve got the opportunity, Guess I will just bookmark this site.
ReplyDelete