Wednesday, February 9, 2011

Scenario on displaying logo, background image and fetching data from multiple tables

Go to the transaction code SFP.

Let us first create an interface for the form. Say the name of the interface is ZTABLES.

Chose Create (f5) and provide the necessary description for the same.

Save the object either as local object or any package.

Double Click on import in the form interface and choose Create button over there.

Provide the import parameter: PERNR as shown below.

In the types, provide the following code:.

types: begin of ty_final ,
pernr like pa0002-pernr,
begda like pa0002-begda,
endda like pa0002-endda,
vorna like pa0002-vorna,
nachn like pa0002-nachn,
ansal like pa0008-ansal,
lga01 like pa0008-lga01,
bet01 like pa0008-bet01,
end of ty_final.
TYPES: it_final  type table of ty_final,
itab type table of pa0002 ,
itab1 type table of pa0008 .

Provide the following code in the initialization .

select * from pa0002
into table itab
where pernr = pernr .
select * from pa0008
into table itab1
for all entries in itab
where pernr = itab-pernr .
loop at itab into wa_itab .
wa_final-pernr = wa_itab-pernr.
wa_final-begda = wa_itab-begda.
wa_final-endda = wa_itab-endda .
wa_final-vorna = wa_itab-vorna.
wa_final-nachn = wa_itab-nachn .
read table itab1 into wa_itab1 with key pernr = wa_itab-pernr.
wa_final-ansal = wa_itab1-ansal.
wa_final-lga01 = wa_itab1-lga01.
wa_final-bet01 = wa_itab1-bet01.
append wa_final to it_final .

Define the import and output parameters as shown above.

Declare the following variables in the global declarations:

Save and Activate it .

Now create the form as shown.

Enter the description and provide the interface name as ZTABLES, which is created earlier.

Save the object either as local object or under a package .

Drag the import parameter PERNR and output tables and system fields( if needed) onto the context area

First deactivate all the fields in the table itab and then select the fields to be visible in the output (right click on the field and choose activate) as shown below. Repeat the same for the internal tables itab1 and it_final as well .

Click on layout tab.

Now drag the fields from the data view to the design view...and arrange them in a specific order in which you want and create a text element for the header. Here you can change the font and size for the text element in the right side pane.

Inserting logo on the form

Go to pallets -> object then a new window will opens as shown below. (Compare the above and below diagrams)

Double-click on the image dragged from the library (here it is shown below) then it will show a F4 help for selection of the image like this..

Click on the image and choose open then it will be on the body page and you can select the image and increase the size of the image also

For the image to be displayed on the form, it is important to do this. Right Click on the image and click on object and check the EMBED IMAGE DATA checkbox.

How to put the background image on the form

To put the image as a background, select the image into the body page and right click on the image and choose send backward then it will become the back ground like this..

(You need to check the checkbox EMBED IMAGE FIELD for the background image here as well)

Save, Activate and execute it .

Provide a personnel number (input)

Choose execute. Give the input device as LP01 or LOCL

Choose print preview.

How to call this in a program
REPORT Zadobeforms .
ie_outputparams type SFPOUTPUTPARAMS .
ie_outputparams = ie_outputparams .
*---here get the function module name from the form
pernr = '00001000'

No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)


Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

Blog Archive