Top Banner
Print workbench sample using inactive node for only display purpose, and calling that explicitly from active node By Arnab Roy, IBM India In some cases there can be requirements when the text node (exit) where the data is manipulated or fetched are not expected to be displayed in the same place. They are required to be displayed at some specific place along with some other data. In these cases the text nodes are created and marked as inactive (to stop implicit calling for display) and that is called explicitly for display from another text node. In the following example it is displayed how an inactive (which is suppressed by SAP to be displayed) text node can be explicitly called and displayed. Along with this, the basic technique of using during loop is explained. Go To Transaction Code PWB. Create an application form of form class IS_U_CS_MOVE_IN_WELCOME_LETTER as displayed below
28
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Application Form EFRM

Print workbench sample using inactive node for only display purpose, and calling that explicitly from active node

By Arnab Roy, IBM India

In some cases there can be requirements when the text node (exit) where the data is manipulated or fetched are not expected to be displayed in the same place.

They are required to be displayed at some specific place along with some other data.

In these cases the text nodes are created and marked as inactive (to stop implicit calling for display) and that is called explicitly for display from another text node.  

In the following example it is displayed how an inactive (which is suppressed by SAP to be displayed) text node can be explicitly called and displayed. Along with this, the basic technique of using during loop is explained.  

Go To Transaction Code PWB.

Create an application form of form class IS_U_CS_MOVE_IN_WELCOME_LETTER as displayed below  

 

Page 2: Application Form EFRM

 

One installation can have multiple register; here we are displaying those register (logical register number) details.

 

DATA: LT_LOGIC_NO TYPE EASTL. (Locally Defined)

To access this table from other part of the program we need to pass the values into some custom defined global internal table in ‘During Loop’  

Page 3: Application Form EFRM

DATA: T_EQUIP TYPE TABLE OF V_EGER (Globally Defined, hence can be accessed from any where from the object)  

 

We are creating one text node in the following node hierarchy, and making this text node as inactive (unclick the check box as described below) and text exit for this node is not created. As the result the

Page 4: Application Form EFRM

implicit calling of this exit during display will be suppressed. To display the output of this text node, we have to call it explicitly.

   

Activate.

Page 5: Application Form EFRM

Click here to continue...

...Previous

Create the display of the text node.

And give the following details.  

 

Page 6: Application Form EFRM

Activate

 

Create a During Loop as explained.

(‘During exit’ is an exit that is created in the loop of standard data fill flow of PWB(generated function module), in the same manner we can create ‘Before Exit’ and ‘After Exit’ that is called before and after the loop of standard data fill flow of PWB (generated function module) respectively.  

Page 7: Application Form EFRM

Activate

 

Page 8: Application Form EFRM

 

 

APPEND WA_LOGIC_NO TO GIT_LOGICNUM.  

Append the work area into a global internal table, so that can be accessed from other part of object, also create work areas for the internal table GIT_LOGICNUM and T_EQUIP)

Page 9: Application Form EFRM

 

Declare the internal table in the PWB top include.

 

Click here to continue...

Page 10: Application Form EFRM

...Previous

Activate.  

Create another text node with text exit (to call the inactive node) in the following hierarchy as displayed.  

 

Create the Exit to write the code.

 

Page 11: Application Form EFRM

Write the following code in it.  

  

LOOP AT GIT_LOGICNUM INTO L_WA_LOGICNUM.    READ TABLE T_EQUIP INTO L_WA_EQUIP                       WITH KEY LOGIKNR = L_WA_LOGICNUM-LOGIKNR.    IF SY-SUBRC = 0.      PERFORM OUTPUT_TEXT        USING        'ISU_DISP_REGSTR'        'MAIN'        'BODY'        'APPEND'.    ENDIF.  ENDLOOP.

Page 12: Application Form EFRM

Activate  

Execute with proper data.  

 

Page 13: Application Form EFRM

 

Two rows should come in the output of inactive node calling part, as two entries are there in the table where loop is executed.

 

Page 14: Application Form EFRM

 

Rate type data is not there in the table; hence it is blank in output.

Page 15: Application Form EFRM

Step-by-step guide to build object using Print Workbench

By Arnab Roy, IBM India

What is Print Workbench?  

Print Workbench is the tool used as Basic or Central development environment for creating standardized outgoing correspondence, and is used for printing purpose in IS-Utilities. We find this as a very efficient and improved way of creating forms from the perspective of easy data retrieval and understandability. This tool is available in SAP IS-Utilities 4.6 and above.  

Advantages of Print Workbench

Separated and independent data retrieval procedure from layout design with dynamic print programs. Increase performance for mass printing.  

The Print Workbench tool has following components.

Form Classes

Carries the data retrieval hierarchy in the form of modularized accessible subroutines, detailed information about the data for an application, Form class: Application Form cardinality can be 1: N.

Application Forms

These are configuration objects used for the application and integration of Data structure defined in Form Class Can be integrated with different form layouts like Smart Forms, SAP scripts or PDF Forms.

Example:

One very simple Print Workbench example is given below.

As soon as a business partner wants to start consuming any utility service, (move-in is required), the utility company automatically creates a Welcome letter / Move-in letter / Correspondence based on the PWB object name configured and that is sent to the customer.

One standard form class is given in SAP to carry out the necessary data retrieval for this purpose that is IS_U_CS_MOVE_IN_WELCOME_LETTER.

Go to Transaction ‘PWB’

Page 16: Application Form EFRM

Double click on application form, and give the name as ‘Z_TEST_WELCOME_LETTER’ and click on create button.

Use Form Class IS_U_CS_MOVE_IN_WELCOME_LETTER which is a standard Form Class provided by SAP for Move-in Letter.  

Fill the other parameters as described.

An SAP Script is created to display the output. SMARTFORMS or ADOBE FORMS can also be used.  

System will ask for Transport Request. Create a Request.  

Page 17: Application Form EFRM

Next screen is as follows.

Activate it. [SHIFT + F8]

Page 18: Application Form EFRM

 

Double click on Z_TEST_WELCOME_LETTER.

 

User Top Include is for declaring the global data types and data objects.

User Exit Include is for declaring the exits as below.

Start Exit is for the purpose what always should be done prior to start the data fetching.

End Exit is for clearing the global data and/or what always should be done once the whole data fetching is complete.

Page 19: Application Form EFRM

Double click and create Include, and create the exits in the user exit include.

Activate.  

As this is welcome letter we will get the Business Partner details.

In the following hierarchy we can see that the tables are available, so we decide to display our business partner details here.

 

Page 20: Application Form EFRM

 

We are creating a text exits to write our code and display those data just below the CO_ADDRESS.

Click on the node MOVEINDOCC.

Click on Create Text [SHIFT + F4].

Give description and text name and create as child.  

Click on Pencil and ‘T’ to create the Text and Exit respectively.  

Now before writing the display variable population logic, go to the generate function module by double clicking on Z_TEST_WELCOME_LETTER.

Page 21: Application Form EFRM

We can see here that CONTRACT node is populated by the work area WA_CONTRACT,

In this work area all the fields of table EVER will be available.  

 

We will write logic to fetch the Business Partner number by using this.  

In the same manner we can see that installation structure and address structure is filled by using the work area WA_INSTALL and WA_CO_ADDRESS.

Page 22: Application Form EFRM

Write the following code in the text exit created by us.

Page 23: Application Form EFRM

  DATA: L_WA_FKKVKP    TYPE FKKVKP. (Include this in top include).

  SELECT *    FROM FKKVKP    INTO L_WA_FKKVKP    UP TO 1 ROWS    WHERE VKONT = WA_CONTRACT-VKONTO.  ENDSELECT.  

Now we have got all our necessary data into the work areas namely L_WA_FKKVKP (Locally defined in exit of structure for table FKKVKP), WA_INSTALL (output type V_EANL) and WA_CO_ADDRESS (output type EADRDAT) and WA_CONTRACT (Output Type EVER).  

And the move-in letter is generated per contract ( that means for 1 Business Partner and 1 contract account, there is always going to be single entries, that’s why work area is considered instead of internal tables)  

Straight away we can write the WORKAREA-FIELD while displaying the output upon clicking on the pencil button of the text node created (after activating this).

Page 24: Application Form EFRM

Go back to the main screen and again activate this.

Let us create one more text to display the FKKVKP entries that we have fetched.

Don’t create any exit for code in this newly created text exit; this is only for display purpose,

Write the variables you want to display as described below.

Page 25: Application Form EFRM

Now execute the PWB object, with one valid (live) contract.

Page 26: Application Form EFRM

 

Select the following parameters or you can generate spool by checking the SAP script format as spool of the above screenshot and clicking the new spool request of the below screenshot.

Page 27: Application Form EFRM

Here is the output displayed in the script. (Installation Status has no values in the table, hence blank).