Hi, I provide training in SAP UI5. Also feel free to checkout my new web page https://saptechblog.com
Adobe forms

Alternatives in adobe form

This tutorial explains the usage of Alternative in Adobe form.

The Alternative condition is comparatively an IF... ELSE Condition. A set of logical operation with the AND or OR combinations can be specified. If the condition is True then data mapped under the TRUE is displayed and False in the other case.

Now let us see an simple example that potrays the usage of Alternative option in Adobe Forms.

Scenario: Say we have an Flag, based on the Flag we need to display data from either one of the table SFLIGHT or SBOOK.

The tutorial is split into Two part.

1.      Creation of Interface

2.      Creation of Form

 

Part 1: Creation of Interface:

Step 1: Go to the Tcode SFP and create an Form Interface.

clip_image001[1]

Enter the description for the interface and press enter.

clip_image003[1]

 

Assign the interface to the package or save it in the local object.

 

Step 2: In the importing parameters of the form interface create an importing parameter flag of Type C and make it optional.

clip_image005[1]

 

Step 3: In the Types of Global definitions declare the type declarations for the tables SFLIGHT and SBOOK with necessary fields.

clip_image007[1]

 

Code:

types : begin of t_sflight,
        carrid
type
sflight-carrid,
        connid
type
sflight-connid,
        fldate
type
sflight-fldate,
        seatsmax
type
sflight-seatsmax,
        seatsocc
type
sflight-seatsocc,
       
end of
t_sflight.

types : tt_sflight type standard table of
t_sflight.

types : begin of
t_sbook,
        carrid
type
sbook-carrid,
        connid
type
sbook-connid,
        fldate
type
sbook-fldate,
       
class type
sbook-class,
        forcuram
type
sbook-forcuram,
     
end of
t_sbook.
     

types : tt_sbook type standard table of
t_sbook.

 

Step 4:  Go to the global data of the global definition and create the internal tables to hold the datas from the two tables.

clip_image009[1]

 

Step 5: Go to the code initialization option and create the importing and exporting paramters. Technically we are specifying the name of the variables which we have created earlier coming and going of the method.

clip_image011[1]

Fill the internal tables with data based on the flag.

clip_image013[1]

 

Code:

if flag is not initial.

 
select * from
sflight
     
into corresponding fields of table
it_sflight
     
up to 5
rows.

else.

 
select * from
sbook
      
into  corresponding fields of table
it_sbook
       
up to 5
rows.

endif.

 

Save and activate the whole interface.

Thus first part of creation of interface is now completed.

 

Part 2: Creation of Adobe Form

Step 1: Go to the Tcode SFP (Form Builder) and create an form as shown below.

clip_image014[1]

Enter the description for the form and specify the name of the interface which we have create in the Part 1.

clip_image016[1]

 

Assign the form to the package or save it in the local object.

Step 2: Drag and drop the importing parameter of the interface to the context of the Form as shown below.

clip_image018[1]

Step 3: Right click on the context of the form and create an alternative condition.

clip_image020[1]

clip_image022[1]

 

Step 4: Drag and drop the Global internal tables of the interface to the true and false conditions of the alternative as shown below.

clip_image024[1]

 

Step 5: Click on the alternative condition to specify the condition.

clip_image026[1]

Specify the condition for the alternative using the variable Flag.

clip_image027[1]

 

Step 6: Go to the layout tab of the form and choose the data view.

clip_image029[1]

 

Save and activate the whole form.

 

Ouptut: Click on execute to test the form.

In the function module interface created for the form, test by specifying the flag X and then as Space to check the alternative conditions true and false.

When Flag = X

clip_image031[1]

 

When Flag = Space

clip_image033[1]

 

 

 

 

 

 

About Arun

0 Comments:

Post a Comment

Powered by Blogger.