Define Ranges in Module Pool
Hi,
i have defined an range in the Module Pool as shown ibelow.
data : ar_vbeln TYPE RANGE OF vbak-vbeln,
ars_vbeln LIKE LINE OF ga_vbeln.
but how to show this range in the Layout of the Module Pool , i mean the input & Output in the Moduel Pool,
Can anybody please help me.
rgds
Ranjith singh
hi,
search it first in SCN... too many posts on this.
this wiki will help.
[select option in module pool|http://wiki.sdn.sap.com/wiki/display/ABAP/SELECT-OPTIONSonDialogprogrammingscreen]
main idea is: create a sub screen in your program and assign it to a sub screen area of your module pool screen in PBO.
hope this helps
Similar Messages
-
Num ranges in module pool prog
Hi all,
i want to maintain a number range for my custom screen.
whenever i enter data in to the custom screen and press SAVE,it should create a automatic number and tht should b saved in the concern ZTABLE.
this screen belongs to Production Planning.
am maintaining this generated number as primary key in the ZTABLE.
any help will b rewarded with maximum points...
thanQHello,
(a) We need to create number ranges in transaction SNRO
(b) Enter the number range object name and press CREATE.
(c) Enter the description, Long text and Number Length domain andWarning %(when you are about to expire the number range a warning must be given eg:if the range is 1 to 100 and 90 is created we need to be notified that 90 is over and only 10 are remaining ..accordingly we should reset the number range or do other necessary actions..eg:10% => when it reaches 90 in number range of 1 to 100 message is displayed)
enter Number length domain..which is the length of the range eg:if we put "NUM10" as the domain(check in se11->domain->num10) we can declare an interval with 1 to maximum of 9999999999 or less than that according to our requirement
(d) Press SAVE
(e)Now click on u201CNumber Rangesu201D button on the application toolbar
(f) Click on u201CChange Intervalsu201D.
(g) Click on u201CInsert Intervalu201D.
(h) enter the range which needs to be created eg:1 to 100
Click u201CInsertu201D and then SAVE. The number range object is generated
in the program we can use the function module, NUMBER_GET_NEXT, to get the next number of any number range object.
Also keep in mind that number range NUMBER_GET_NEXT be called on the click of that 'SAVE' button just before updating the Ztable .incase we have any errors in the module pool we need not worry about accidently creating numbers... if the code is wriiten in 'SAVE' action after complete requirement checks the issue will no occur
Regards
Byju -
How to define RADIO BUTTONS in MODULE POOL PROG.?
Hi Experts,
I need to keep the RADIO BUTTONS in 1000_screen of my_module_pool prog., like,
I hv 2 fields in this screen, as expected, the first shuld hv DEFAULT selection.
So, I just simply, dragged & dropped 2 radio buttons from left menu of the screen builder & given them the names as
R_SUMMARY
R_DETAIL
Then i executed the transaction, but, these above 2 fields are getting selected, as default??
I know that, if its a REPORT prog. we can define as w/ a GROUP, then the 1st one is hv the default selection.
so,
1 - How to define RADIO BUTTONS in this screen of a module pool prog.
2 - How to use these names in the prog.(PAI - i guess)?
thanq
Edited by: Srinivas on Jul 12, 2008 11:59 PMHi Srinivas,
Please check this link
Re: urgent:Regd radio buttons in module pool
http://saplab.blogspot.com/2007/10/sample-abap-program-for-module-pool_18.html
http://****************/Tutorials/ABAP/Checkbox/page1.htm
http://****************/Tutorials/ABAP/Checkbox/page2.htm
Best regards,
raam -
How to define our line size in module pool?
Dear Friends,
I have requirment to increse the length or size of a list which is calling itself from a module pool using leave list processing.
Please suggest me the way?
Regards
RickyIt is very much same like report programming.
Report z****** Message-id 38 Line-Size 190 Line-Count 0 No Standard Page Heading.
use this report command on top of page to define the line size. -
Hi,
COuld any body tell me how to give range of values as in input in module pool program same as Select-options on standard selection screen.
Regards,
SatyaHi,
The two statements:
SELECTION-SCREEN BEGIN OF SCREEN numb [TITLE tit] [AS WINDOW].
SELECTION-SCREEN END OF SCREEN numb.
define a user-defined selection screen with screen number numb. All PARAMETERS, SELECT-OPTIONS, and SELECTION-SCREEN statements that occur between these two statements define the input fields and the formatting of this selection screen. Screen number numb can be any four-digit number apart from 1000, which is the number of the standard selection screen. You must also ensure that you do not accidentally assign a number to a selection screen which is already in use for another screen of the program.
From your screen program in which selection screens are defined, you can call these screens at any point of the program flow using the following statement:
CALL SELECTION-SCREEN <numb> [STARTING AT <x1> <y 1>]
[ENDING AT <x2> <y 2>].
Look at the DEMO program <b>DEMO_DYNPRO_SUBSCREENS.</b>
Regards
Sudheer -
Hi all plz any one send me the doc for Module pool programmiing to learn on my own
thanks & regards
vamsinHi,
This is the material find the attachment.
hi,
Pool table
A database table defined in the ABAP Dictionary whose database instance is assigned to more than one table defined in the ABAP Dictionary. Multiple pool tables are assigned to a table pool in the database. The key fields of a pool table have to be character-type fields. The table pool's primary key consists of two fields: TABNAME for the name of a pool table, and VARKEY for the interdependent contents of the key fields in the corresponding pool table. The non-key fields of the pool table are stored in compressed format in their own column, called VARDATA, of the table pool. The only way to access pool tables is by using Open SQL. Joins are not allowed.
Table Pool
Database table in the database that contains the data of several pool tables.
Cluster Table
Database table defined in the ABAP Dictionary, whose version on the database is not only assigned to one table defined in the ABAP Dictionary. Several cluster tables are assigned to a table cluster in the database. The intersection of the key fields of the cluster tables forms the primary key of the table cluster. The other columns of the cluster tables are stored in compressed form in a single column VARDATA of the table cluster. You can access cluster tables only via Open SQL, and only without using joins.
Table Cluster
Database table in the database that contains the data of several cluster tables.
Note: Never mix up with a database table that has the necessary structure for storing data clusters in database tables and in the shared memory. Those are called INDX-type, with reference to the database table INDX supplied by SAP. Data clusters are groupings of data objects for transient and persistent storage in a selectable storage medium. A data cluster can be processed using the statements IMPORT, EXPORT, and DELETE FROM
P.Naganjana ReddyDAY-4 CONTENTS
SCREEN PAINTER
��
Introduction to Dialog Programming
��
Transactions
Screens (dynpros)
ABAP/4 module pool
Transferring Field Data
Field Attributes
Error Dialogs
Data Consistency
Dynpro
Layout
��
Exercise
TABLE CONTROL
��
Functional scope
��
Programming
��
Attributes
��
EXERCISE
TABSTRIP CONTROLS
��
Defining the Tabstrip Control Area and Tab Titles
��
Assigning a Subscreen Area to a Tab Title
��
Paging in the SAPgui
��
Programming the Flow Logic
��
EXERCISE
P.Naganjana Reddy
SCREEN WITH FIELDS
Introduction to Dialog Programming
Transactions
A transaction is a program that conducts a dialog with the user. In a typical dialog, the
system displays a screen on which the user can enter or request information. As a reaction on
the the user input or request, the program executes the appropriate actions: it branches to the
next screen, displays an output, or changes the database.
Example
A travel agent wants to book a flight. The agent enters the corresponding data on the
screen. The system either confirms the desired request, that is, the agent can book the flight
and the customer travels on the desired day on the reserved seat to the chosen destination,
or the system displays the information that the flight is already booked up.
To fulfil such requirements, a dialog program must offer:
_a user-friendly user interface
_format and consistency checks for the data entered by the user
_easy correction of input errors
_access to data by storing it in the database.
ABAP/4 offers a variety of tools and language elements to meet the requirements stated
above in the dialog programs.
Structure of a Dialog Program
A dialog program consists of the following basic components:
P.Naganjana Reddy
Screens (dynpros)
Each dialog in an SAP system is controlled by dynpros. A dynpro (Dynamic PROgram) consists of a screen and its flow logic and controls exactly one dialog step. The flow logic determines which processing takes place before displaying the screen (PBO-Process Before Output) and after receiving the entries the user made on the screen (PAI-Process After Input).
The screen layout fixed in the Screen Painter determines the positions of input/output
fields, text fields, and graphical elements such as radio buttons and checkboxes. In addition, the Menu Painter allows to store menus, icons, pushbuttons, and function keys in one or more GUI statuses. Dynpros and GUI statuses refer to the ABAP/4 program that control the sequence of the dynpros and GUI statuses at runtime.
ABAP/4 module pool
Each dynpro refers to exactly one ABAP/4 dialog program. Such a dialog program is also called a module pool, since it consists of interactive modules. The flow logic of a dynpro contains calls of modules from the corresponding module pool. Interactive modules called at the PBO event are used to prepare the screen template in accordance to the context, for example by setting field contents or by suppressing fields from the display that are not needed. Interactive modules called at the PAI event are used to check the user input and to trigger appropriate dialog steps, such as the update task.
All dynpros to be called from within one transaction refer to a common module pool. The dynpros of a module pool are numbered. By default, the system stores for each dynpro the dynpro to be displayed next. This dynpro sequence or chain can be linear as well as cyclic. From within a dynpro chain, you can even call another dynpro chain and, after processing it, return to the original chain.
Transferring Field Data
How do I display fields known in an ABAP/4 module on the screen? How do I transfer
user entries on the screen to the module? In contrast to report programming, you cannot write field data to the screen using the WRITE statement. The system instead transfers data by comparing screen field names with ABAP/4 variable names. If both names are the same, it transfers screen field values to ABAP/4 program fields and vice versa. This happens immediately before and immediately after displaying the screen.
Field Attributes
For all screen fields of a dynpro, field attributes are defined in the Screen Painter. If a
field name in the screen corresponds to the name of an ABAP/4 Dictionary field, the system automatically establishes a reference between these two fields. Thus, a large number of field attributes in the dynpro is automatically copied from the ABAP/4 Dictionary. The field attributes together with data element and domain of the assigned Dictionary field form the basis for the standard functions the dynpro executes in a dialog (automatic format check for screen fields, automatic value range check, online help, and so on).
Error Dialogs
Another task of the dynpro processor is to conduct error dialogs. Checking the input data is carried out either automatically using check tables of the ABAP/4 Dictionary or by the ABAP/4 program itself. The dynpro processor includes the error message into the received screen and returns the screen to the user. The message may be context-sensitive, that is, the system replaces placeholders in the message text with current field contents. In addition, only fields whose contents is related to the error and for which a correction may solve the error can accept input.
P.Naganjana Reddy
Data Consistency
To keep data consistent within complex applications, ABAP/4 offers techniques for
optimizing database updates that operate independent of the underlying database and correspond to the special requests of dialog programming. For more information on database updates, see Programming Database Updates.
Dynpro
Each screen contains fields used to display or request information. Fields can be text strings, input or output fields, radio buttons, checkboxes, or pushbuttons. The screen of Transaction TZ10 contains only texts and input/output fields.
An SAP dynpro consists of several components:
Flow logic: Calls of the ABAP/4 modules for a screen.
Screen layout: Positions of the texts, fields, pushbuttons, and so on for a screen.
Screen attributes: Number of the screen, number of the subsequent screen, and others.
Field attributes: Definition of the attributes of the individual fields on a screen.
SCREEN PAINTER
You create and edit all components of a dynpro in the Screen Painter. To call the Screen
Painter, create a dynpro in the Object Browser or double-click on an existing dynpro. The Object Browser then calls the Screen Painter. There, you can enter the flow logic of the new dynpro. By pressing the corresponding pushbutton you can maintain the Screen attributes, branch to the Full Screen-Editor or you choose the pushbutton Field list and change the attributes of fields.
Screen Attributes
From the users point of view, a transaction is a sequence of screens, displayed one after
another. How do I determine this sequence? The transactionss attributes determine the first screen to be displayed. The attributes of the individual dynpros determine which screen to display
P.Naganjana Reddy
after the current screen. You can also set the number of the subsequent screen dynamically from within the ABAP/4 program.
Layout
Choose Fullscreen to go to the screen editor. Here you can determine the layout of the
screen. For Transaction TZ10, the desired fields can be copied from Table SPFLI of the
ABAP/4 Dictionary.
Field Attributes
To display and modify the attributes of the individual fields (input/output fields, input
required, possible entries button, invisible, and so on), use the Field list.The fields Company (SPFLI-CARRID) and Flight number (SPFLI-CONNID) are defined as input/output fields. All other fields are used only for outputting the flight data.
Flow Logic
The flow control code of a dynpro consists of a few statements that syntactically ressemble ABAP/4 statements. However, you cannot use flow contol keywords in ABAP/4 and vice versa. You enter the flow control code in the Screen Painter as one component of the dynpro.
The flow control for the dynpro of Transaction TZ10 looks like this:
PROCESS BEFORE OUTPUT.
MODULE SET_STATUS_0100.
PROCESS AFTER INPUT
MODULE USER_COMMAND_0100.
The PROCESS statement names the event type for the dynpro and the MODULE statement tells the system which ABAP/4 routine to call for this event. In this example, there is only one MODULE for each event PBO and PAI. However, an event can contain several statements with several keywords. (The flow control language contains only few statement types. The most important are MODULE, FIELD, CHAIN, LOOP, CALL SUBSCREEN.) To display information on the statement syntax in the flow logic, choose Utilities Help on... in the flow logic editor. In the subsequent dialog window, mark Flow logickeyword, enter the name of the desired keyword, and press ENTER.
ABAP/4 Module Pool
In the Object Browser, the module pool code belongs to one of the following categories:
Global fields: data declarations that can be used by all modules in the module pool
PBO modules: modules that are called before displaying the screen
PAI modules: modules that are called in response to the user input
Subroutines: subroutines that can be called from any position within the module pool.
You use the ABAP/4 Dictionary to store frequently used data declarations centrally. Objects defined in the Dictionary are known throughout the system. Active Dictionary definitions can be accessed by any application. Data defined in the Dictionary can be included in a screen or used by an ABAP/4 program. You declare global data in the TOP module of the transaction, using the TABLES, STRUCTURE, LIKE statements and others. Transaction TZ10 accesses the Dictionary definition of Table SPFLI to provide the desired flight data display. If the TOP include contains the TABLES: SPFLI declaration, all modules in the module pool can access the table fields of
P.Naganjana Reddy
Table SPFLI. The PAI module USER_COMMAND_0100 checks which pushbutton the user activated (CASE OK_CODE). The Display pushbutton in Transaction TZ10 has the function code
SHOW. (For more information on handling function codes, see Processing User Requests). The program then tries to select those records in the SPFLI database that correspond to the data the user entered. The WHERE condition determines matching records by comparing the fields SPFLI-CARRID and SPFLI-CONNID with the database key fields CARRID and CONNID. As soon as a matching record is found, the database transfers all accompanying SPFLI fields to the program table.
When the screen is displayed again, the complete information appears in the output fields
of the screen. The system automatically displays these fields, since the ABAP/4 field names SPFLI-CARRID and SPFLI-CONNID are the same as the screen field names.
In the PBO module STATUS_0100 of Transaction TZ10, the screen 100 receives a GUI status (using SET PF-STATUS) and a GUI title (using SET TITLEBAR):
SET PF-STATUS TZ0100.
SET TITLEBAR 100.
A GUI status is a subset of the interface elements used for a certain screen. The status
Comprise those elements that are currently needed by the transaction. The GUI status for a transaction may be composed of the following elements:
The GUI title is the screen title displayed in the title bar of the window. In contrast to the
GUI status that can be used for several screens, a GUI title belongs to one screen.To create and edit GUI status and GUI title, you use the Menu Painter. To start the Menu Painter, create a GUI status or GUI title in an object list in the Object Browser (or double-click on an existing status or title).
Interaction between Dynpro and ABAP/4 Module Pool
In its most simple form, a transaction is a collection of screens and ABAP/4 routines, controlled and executed by a dialog processor. The dialog processor processes screen after screen, thereby triggering the appropriate ABAP/4 processing for each screen. For each screen, the system executes the flow logic that contains the corresponding ABAP/4 processing. The control passes from screen flow logic to ABAP/4 code and back.
The sequence of events for Transaction TZ10, for example, looks like this:
P.Naganjana Reddy
1.
In the PBO event, the statement MODULE STATUS_0100 passes control to the corresponding ABAP/4 module.In the ABAP/4 module pool, the screen to be displayed receives a menu interface.
2.
After processing the module STATUS_0100, control returns to the flow logic.For the PBO event, no further processing is required. The system display the screen and receives entries from the user. The entries are:
the values for the fields Company and Flight number.
the four-character function code that tells which pushbutton the user activated.
3.
The user input triggers the PAI event. The first PAI statement passes control to the ABAP/4 module USER_COMMAND_0100.Module USER_COMMAND_0100 processes the requests of the user.
4. After processing MODULE USER_COMMAND_0100, control returns to PAI. This terminates the dialog.
P.Naganjana Reddy
EXERCISE
Goto to ABAP editor, and enter the program name ZKA_SCREEN.
Declare the tables and call the screen.
In order to create the object, double click on the screen no, you will automatically guided to the screen painter SE51.
P.Naganjana Reddy
Enter the short description and click on the FLOW LOGIC tab.
Uncomment the flow logic, both PAI and PBO.
P.Naganjana Reddy
Now click on the LAYOUT button.
Click on the DICTIONARY/PROGRAM FIELDS WINDOW F6 button. Type in the table name and click on GET FROM DIC button and select the fields required for the screen and click on the COPY button.
P.Naganjana Reddy
Now drag and place the INPUT/OUTPUT fields box on the screen.
Now click on the TEXT FIELD button and place in the screen and stretch the box for the size required. Now double click on the box, U will get the attributes screen. Enter the name and Text for the field.
P.Naganjana Reddy
Now we need to place the bush buttons. So Click on the push button on the left side and place it on the screen. Double click on it, u will get the attributes screen. Enter the name, text and the icon required and mainly the FCTCODE. It is the one which links the screen painter with the code.
Once everything is set up, SAVE, CHECK and ACTIVATE the screen.
P.Naganjana Reddy
Click on the BACK button. U will be guided to the FLOW LOGIC screen.
Double click on PAI, Because for the screen painter with the fields, Process After the Input is done and so u will guided to the Editor screen.
P.Naganjana Reddy
Now we need to set the System-Uses commands which links the code to the Editor.
So the conditions would be:
IF SY-UCOMM = 'DISPLAY'.
SELECT SINGLE * FROM ZKA_CENTER WHERE CENTERNO = ZKA_CENTER-CENTERNO.
ELSEIF SY-UCOMM ='SAVE'.
INSERT ZKA_CENTER.
ELSEIF SY-UCOMM = 'REFRESH'.
CLEAR ZKA_CENTER.
ELSEIF SY-UCOMM = 'GOTO'.
LEAVE TO SCREEN '0002'.
ELSEIF SY-UCOMM = 'EXIT'.
LEAVE PROGRAM.
ENDIF.
If u create many screens and need links between the screens then u can use GOTO to guide to the other screen.
SAVE, CHECK and ACTIVATE and click on TEST.
P.Naganjana Reddy
Now click on the DISPLAY button.
Also verify with SAVE, REFRESH and EXIT buttons. Thus the screen painter.
P.Naganjana Reddy
TABLE CONTROL
Basic form
CONTROLS ctrl TYPE TABLEVIEW USING SCREEN scr.
Effect
Creates a table control ctrl of the type TABLEVIEW . The reference screen for the initialization is the screen scr . Area of use The table control (referred to here as TC ) facilitates the display and entry of one-line, tabular data in dialog transactions. The functional scope has been defined so that you can implement many typical set operations usually handled by an elementary STEP-LOOP with the standard methods of a TC . Functional scope
Resizeable table grid for displaying and editing data.
Column width and column position modifiable by user and by program.
Storing and loading of user-specific column layout.
Selection column for line selection with color selection display.
Variable column headers as pushbuttons for column selection.
Simple selection, multiple selection, Select/deselect all.
Scrolling functions (horizontal and vertical) via scroll bar.
Fixing of any number of key columns.
Setting attributes for each cell at runtime.
Programming The data exchange between the application and the SAPgui is achieved with a STEP-LOOP , i.e. an ABAP/4 module is called to transfer data for each page.
Example
Processing without an internal table
PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL ctrl.
MODULE ctrl_pbo.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP WITH CONTROL ctrl.
MODULE ctrl_pai.
ENDLOOP.
In this case, the module ctrl_pbo OUTPUT is called once for each output line before the screen is displayed, in order to fill the output fields. After the user has entered data on the screen, the module ctrl_pai INPUT is executed to check the input and copy the new contents.
Example
Processing with an internal table
P.Naganjana Reddy
PROCESS BEFORE OUTPUT.
LOOP AT itab WITH CONTROL ctrl CURSOR ctrl-CURRENT_LINE.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT itab WITH CONTROL ctrl.
MODULE ctrl_pai.
ENDLOOP.
Here, the system fills the output fields before displaying the screen by reading the internal table itab. When the user has entered data, the module ctrl_pai INPUT must be executed to check the input and to refresh the contents of the internal table. Vertical scrolling with the scroll bar is followed by the event PAI for the displayed page. Then, cntl-TOP_LINE is increased and PBO is processed for the next page. Program-driven scrolling and the most of the functionality described above is achieved by manipulating the control attributes.
Attributes The CONTROLS statement creates a complex data object of the type CXTAB_CONTROL with the name of the control. You maintain the initial values in the Screen Painter and assign the screen with the initial values for a control using the addition USING SCREEN . Initialization is achieved automatically in the "1st access to the control" (setting or reading values). You can use the customizing button (in the top right corner) to save the current setting (column widths and column positions) and use it as the initial value for the next call. All the initial values can be overwritten by the program using the MOVE ... TO TC attributes statement.
EXERCISE
Enter the Editor with SE38.
Declare the Tables and an internal table.
Then use the CONTROLS statement to have the controls for the Table control.
P.Naganjana Reddy
CONTROLS: <var> TYPE TABLEVIEW USING SCREEN '<screenno>'.
Now call the screen with the CALL SCREEN statement. Click on the screen to draw the table.
Fill in the attributes screen with the short description and click on the LAYOUT button.
Now click on the TABLE CONTROL button and draw the table to the size required. Double click on the table and enter the Attributes giving the Table-control name.
And select the check boxes for the vertical & horizontal resizing and separators.
Click on the DICTIONARY/PROGRAM FIELDS WINDOW F6 button. Type in the table name and click on GET FROM PROGRAM button and select the fields required for the screen and click on the COPY button.
P.Naganjana Reddy
Enter the header with the TEXT FIELDS button by double clicking on the TEXT FIELD and fill in the ATTRIBUTES button with the name and text.
P.Naganjana Reddy
SAVE, CHECK & ACTIVATE.
Click the BACK button and go the FLOW LOGIC screen.
P.Naganjana Reddy
REPORT ZKA_TC .
TABLES: ZKA_EMP.
DATA: ITAB LIKE ZKA_EMP OCCURS 0 WITH HEADER LINE.
CONTROLS: TC TYPE TABLEVIEW USING SCREEN '0001'.
CALL SCREEN '0001'.
*& Module STATUS_0001 OUTPUT
text
MODULE STATUS_0001 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
SELECT * FROM ZKA_EMP INTO TABLE ITAB.
ENDMODULE. " STATUS_0001 OUTPUT
*& Module USER_COMMAND_0001 INPUT
P.Naganjana Reddy
text
MODULE USER_COMMAND_0001 INPUT.
IF SY-UCOMM = 'EXIT'.
LEAVE PROGRAM.
ENDIF.
ENDMODULE. " USER_COMMAND_0001 INPUT
P.Naganjana Reddy
TABSTRIP CONTROLS
A tabstrip control is a screen object consisting of two or more pages. Each tab page consists of a tab title and a page area. If the area occupied by the tabstrip control is too narrow to display all of the tab titles, a scrollbar appears, allowing you to reach the titles that are not displayed. There is also a pushbutton that allows you to display a list of all tab titles.
Tabstrip controls allow you to place a series of screens belonging to an application on a single screen, and to navigate between them easily. The recommended uses and ergonomic considerations for tabstrip controls are described in the Tabstrip Control section of the SAP Style Guide.
From a technical point of view, a tab page is a subscreen with a pushbutton assigned to it, which is displayed as the tab title.
The tabstrip control is the set of all the tab pages. Tabstrip controls are therefore subject to the same restrictions as subscreens. In particular, you cannot change the GUI status
P.Naganjana Reddy
when you switch between pages in the tabstrip control. However, they are fully integrated into the screen environment, so present no problems with batch input.
To use a tabstrip control on a screen, you must be using a SAPgui with Release 4.0 or higher, and its operating system must be Motif, Windows 95, MacOS, or Windows NT with version 3.51 or higher.
When you create a tabstrip control, you must:
Define the tab area on a screen and the tab titles.
Assign a subscreen area to each tab title.
Program the screen flow logic.
Program the ABAP processing logic.
You must then decide whether you want to page through the tabstrip control at the SAPgui or on the application server. In the first case, each tab page has its own subscreen. In the second, there is a single subscreen area that is shared by all tab pages.
Defining the Tabstrip Control Area and Tab Titles
You define both the tabstrip area and the tab titles in the screen layout. The tabstrip area has a unique name and a position, length, and height. You can also specify whether the tabstrip area can be resized vertically or horizontally when the user resizes the window. If the area supports resizing, you can specify a minimum size for it.
When you define a tabstrip area, it already has two tab titles. Tab titles are technically exactly the same as pushbuttons. To create additional tab titles, simple create pushbuttons in the row containing the tab titles. Tab titles have the same attributes as pushbuttons, that is, each has a name, a text, and a function code. You can also use icons and dynamic texts with tab titles.
Assigning a Subscreen Area to a Tab Title
You must assign a subscreen area to each tab title. There are two ways of doing this:
Paging in the SAPgui
You need to assign a separate subscreen area to each tab title, and define the function codes of the tab titles with type P (local GUI function). In the screen flow logic, you call all the subscreens in the PBO event. This means that all of the tab pages reside locally on the SAPgui.
When the user chooses a tab title, paging takes place within the SAPgui. In this respect, the tabstrip control behaves like a single screen. In particular, the PAI event is not triggered when the user chooses a tab title, and no data is transported. While this improves the performance of your tabstrip control, it also has the negative effect that when the user does trigger the PAI event, all of the input checks for all of the subscreens are performed. This means that when the user is working on one tab page, the input checks may jump to an unfilled mandatory field on another page.
P.Naganjana Reddy
Local paging at the SAPgui is therefore most appropriate for screens that display data rather than for input screens.
Paging on the Application Server
One subscreen area is shared by all tab titles and called in the PBO event. You define the function codes of the individual tab titles without a special function type. When the user chooses a tab page, the PAI event is triggered, and you must include a module in your flow logic that activates the appropriate tab page and assigns the correct subscreen to the subscreen area.
Since the PAI event is triggered each time the user chooses a tab title, this method is less economical for the application server, but the input checks that are performed only affect the current tab page.
Procedure in Either Case
You create the subscreen areas within the tabstrip area. You assign the subscreen areas to one or more tab titles in the Screen Painter by selecting one or more titles. You can also assign a subscreen area to a tab title in the tab title attributes by entering the name of the subscreen area in the Reference field attribute.
The procedure for the alphanumeric Screen Painter is described under Creating Tabstrip Controls.
If you are paging at the SAPgui, create a subscreen area for each tab title. If you are paging at the application server, select all tab titles and create a single subscreen area. The subscreen areas may not cover the top line of the tab area. However, within a tab area, more than one subscreen area can overlap.
Programming the Flow Logic
In the flow logic, all you have to do by hand is include the correct subscreens. The screen flow and data transport to the ABAP program is the same as for normal subscreens. There are two ways of programming the screen flow logic, depending on how you have decided to page through the tabstrip control.
Paging in the SAPgui
When you page in the SAPgui, you must include a subscreen for each subscreen area:
PROCESS BEFORE OUTPUT. ... CALL SUBSCREEN: <area1> INCLUDING [<prog 1>] <dynp 1>, <area2> INCLUDING [<prog 2>] <dynp 2>, <area3> INCLUDING [<prog 3>] <dynp 3>, ... ...
P.Naganjana Reddy
PROCESS AFTER INPUT. ... CALL SUBSCREEN: <area1>, <area2>, <area3>, ... ...
Paging on the Application Server
When you page on the application server, you only have to include a subscreen for the one subscreen area:
PROCESS BEFORE OUTPUT. ... CALL SUBSCREEN <area> INCLUDING [<prog>] <dynp>. ...
PROCESS AFTER INPUT. ... CALL SUBSCREEN <area>. ...
Handling in the ABAP Program
Before you can use a tabstrip control in your ABAP program, you must create a control for each control in the declaration part of your program using the following statement:
CONTROLS <ctrl> TYPE TABSTRIP.
where <ctrl> is the name of the tabstrip area on a screen in the ABAP program. The control allows the ABAP program to work with the tabstrip control. The statement declares a structure with the name <ctrl> . The only component of this structure that you need in your program is called ACTIVETAB.
Use in the PBO event
Before the screen is displayed, you use the control to set the tab page that is currently active. To do this, assign the function code of the corresponding tab title to the component ACTIVETAB:
<ctrl>-ACTIVETAB = <fcode>.
When you page at the SAPgui, you only need to do this once before the screen is displayed. This initializes the tabstrip control. The default active tab page is the first page. After this, the page activated when the user chooses a tab title is set within SAPgui.
When you page on the application server, you must assign the active page both before the screen is displayed for the first time, and each time the user pages. At the same time, you must set the required subscreen screen.
P.Naganjana Reddy
You can suppress a tab page dynamically by setting the ACTIVE field of table SCREEN to 0 for the corresponding tab title.
Use in the PAI event
In the PAI event, ACTIVETAB contains the function code of the last active tab title on the screen. When you page in the SAPgui, this allows you to find out the page that the user can currently see. When you page at the application server, the active tab page is controlled by the ABAP program anyway. The OK_CODE field behaves differently according to the paging method:
Paging in the SAPgui
When you page in the SAPgui, the PAI event is not triggered when the user chooses a tab title, and the OK_CODE field is not filled. The OK_CODE field is only filled by user actions in the GUI status or when the user chooses a pushbutton either outside the tabstrip control or on one of the subscreens.
Paging on the application server
If you are paging at the application server, the PAI event is triggered when the user chooses a tab title, and the OK_CODE field is filled with the corresponding function code. To page through the tabstrip control, you must assign the function code to the ACTIVETAB component of the control:
<ctrl>-ACTIVETAB = <ok_code>.
This statement overwrites the function code of the last active tab page with that of the new tab title. At the same time, you must ensure that the correct subscreen is inserted in the subscreen area. Otherwise, tabstrip controls are handled like normal subscrens in ABAP programs, that is, the ABAP program of a subscreen screen must contain the dialog modules called from the flow logic of the subscreen.
P.Naganjana Reddy
EXERCISE
Goto SE38. Enter the tabstrip program name Eg: ZKA_TABSTRIP and click on the create button.
First we need to declare the tables.
Then use the controls for the tabstrip.
Syntax: <ctrl-name> TYPE TASTRIP.
Now call the screen. Using CALL SCREEN statement.
Double click on the screen no to draw the screen for tabstrip control.
Now uncomment the FLOW LOGIC and click on the LAYOUT.
P.Naganjana Reddy
The flow logic for the tabstrip would be as follows.
PBO:
The PBO is initiated so that the subscreen for the corresponding tab can be maintained.
Syntax:
CALL SUBSCREEEN <sub-screen name> INCLUDING SY-REPID <screen-var>.
PAI:
When the tab is clicked, the corresponding subscren should open
Syntax:
CALL SUBSCREEN <subscreen>.
P.Naganjana Reddy
DRAWING THE TABSTRIP CONTROL:
Click on the TABSTRIP button and place it on the screen for the required size.
Double click on the control and give the name for the tabstrip control in the ATTRIBUTES screen.
Now double click on the tab and fill in the attributes screen for the name and the text.
Also draw the subscreen in one of the tab and refer the same subscreen in the rest of the tabs.
P.Naganjana Reddy
Now in the sub-screens, we need to get the screen for the tabs.
So call an other screen and draw with fields and pushbuttons to perform actions very similar like SCREEN WITH FIELDS (refer screen painter).
Enter the short description and click on the FLOW LOGIC tab.
P.Naganjana Reddy
Uncomment the flow logic, both PAI and PBO.
Now click on the LAYOUT button.
Naganjana Reddy.P
Click on the DICTIONARY/PROGRAM FIELDS WINDOW F6 button. Type in the table name and click on GET FROM DIC button and select the fields required for the screen and click on the COPY button.
Now drag and place the INPUT/OUTPUT fields box on the screen.
P.Naganjana Reddy
Now click on the TEXT FIELD button and place in the screen and stretch the box for the size required. Now double click on the box, U will get the attributes screen. Enter the name and Text for the field.
Now we need to place the bush buttons. So Click on the push button on the left side and place it on the screen. Double click on it, u will get the attributes screen. Enter the name, text and the icon required and mainly the FCTCODE. It is the one which links the screen painter with the code.
P.Naganjana Reddy
Once everything is set up, SAVE, CHECK and ACTIVATE the screen.
P.Naganjana Reddy
Click on the BACK button. U will be guided to the FLOW LOGIC screen.
Double click on PAI, Because for the screen painter with the fields, Process After the Input is done and so u will guided to the Editor screen.
P.Naganjana Reddy
Now we need to set the System-Uses commands which links the code to the Editor.
So the conditions would be:
IF SY-UCOMM = 'DISPLAY'.
SELECT SINGLE * FROM ZKA_CENTER WHERE CENTERNO = ZKA_CENTER-CENTERNO.
ELSEIF SY-UCOMM ='SAVE'.
INSERT ZKA_CENTER.
ELSEIF SY-UCOMM = 'REFRESH'.
CLEAR ZKA_CENTER.
ELSEIF SY-UCOMM = 'GOTO'.
LEAVE TO SCREEN '0002'.
ELSEIF SY-UCOMM = 'EXIT'.
LEAVE PROGRAM.
ENDIF.
The same procedure for the company table as well will lead the screen in the below manner.
P.Naganjana Reddy
Summary:
REPORT ZKA_TABSTRIP .
TABLES: ZKA_EMP,ZKA_COM.
CONTROLS: TS TYPE TABSTRIP..
DATA: SCREENNO(4) TYPE N.
CALL SCREEN '0003'.
*& Module STATUS_0001 OUTPUT
text
MODULE STATUS_0001 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
IF SCREENNO IS INITIAL.
TS-ACTIVETAB = 'EMP'.
SCREENNO = '0002'.
ENDIF.
ENDMODULE. " STATUS_0001 OUTPUT
*& Module USER_COMMAND_0001 INPUT
text
MODULE USER_COMMAND_0001 INPUT.
IF SY-UCOMM = 'EMP'.
TS-ACTIVETAB = 'EMP'.
SCREENNO = '0002'.
ELSEIF SY-UCOMM = 'COM'.
TS-ACTIVETAB = 'COM'.
SCREENNO = '0003'.
ENDIF.
ENDMODULE. " USER_COMMAND_0001 INPUT
*& Module USER_COMMAND_0002 INPUT
text
MODULE USER_COMMAND_0002 INPUT.
IF SY-UCOMM = 'DISPLAY'.
SELECT SINGLE * FROM ZKA_EMP WHERE EMPNO = ZKA_EMP-EMPNO.
ELSEIF SY-UCOMM = 'SAVE'.
INSERT ZKA_EMP.
ELSEIF SY-UCOMM = 'REFRESH'.
CLEAR ZKA_EMP.
ELSEIF SY-UCOMM = 'EXIT'.
LEAVE PROGRAM.
ENDIF.
P.Naganjana Reddy -
Displaying list of materials in module pool
Hello frds,
i have senario where i have to select a push button to display list of materials in the next screen based on the range .In reports v write a select query but in module pool its not working.
PLZ help me out with simple exampleHi sai,
Please refer th procedure.
For the select-options you might have defined a selection screen.
Next you can fetch the entire data that you wanted to display in a module pool into an internal table.
you can call the screen you defined for o/p upon the selection.
Then, You define a screen XXXX and a table control in the scree, and in the PAI module of the screen
you write a chain end chain processing in which you can display the contents of your internal table.
OR
if you want the selection also to be in the module pool, then for displaying the O/P you can definr a sub-screen of the initial screen and you can call that sub-screen on selcting, which can be done with a function code.
Hope this helps -
Module pool - for updating Z table
Moderator message: please using a more meaningful subject. I've edited it for you this time.
Hi i have a reuire ment like this.
i want to update Z table, by using report program.report is having selection screen ti select data from Z table and to disply in a screen like SM30, i am displying in table control using screen.and i am updating Z table.
i want to display the selection screen data which ever i have given just above the table control which ever i am displaying now.
can any body help me out pls.
Regards
naiduHi palani thanks for reply.
i tried in this way already but the problem is we dont know how many values user will enter to define, suppose if user may enter 1000 entries in one selection field or beyond that also.
in this case again the problem.
and one more thing suppose i ahve selection screen like this
company code parameter mandatory
sales org. ranges
division ranges
KUNNR ranges
if suppose user entered only mandatory value, and KUNNR we need to display only those two in output, but here in module pool by using screen table if we disable the screen two blank lines will come.
ex
cmpany code 0001
KUNNR from 1000 TO 2000.
expected result for this is
cmpany code 0001
KUNNR from 1000 TO 2000.
i used scren-input for this but ididnt get,
could you please help me in this.
thanks and regards
naidu -
hi guys,
please advise how can i download/export ABAP(report,module pool...etc) source code to client PC?
thanks.hi
this report is to export to another server...
PROGRAM ZDOWNLOAD_SAP
LINE-SIZE 132
LINE-COUNT 62
NO STANDARD PAGE HEADING.
This program up / downloads from / to a local dataset
all the components of an ABAP - i.e TEXTS, the entire CUA
including statuses and menus, DYNPROS and source code.
Program documentation and variants are not handled.
INCLUDED programs are automatically handled both on upload
or download. INCLUDE selection can be excluded or generic
e.g only handle INCLUDES starting with ZIN*
INCLUDES within INCLUDES alos handled.
The only restriction is on UPLOAD the INCLUDED programs must come
from the same directory as the main program.
On Download of course the ABAP must exist in the library.
Note for LINUX and BATCH users
This program was originally designed as a one off tool for
getting ABAPS etc from a SAP R2 (IBM MVS mainframe system) into
an R3 test system minimising the need for a large amount of
mainframe sysprogs (anybody remember what they were !!) time
and support to say nothing of access problems from TSO /JES2 /
SAP R2. At that time network connections were patchy and the
transport systems largely incompatable and not very reliable.
This program was originally designed as a one off tool for
Must run on Windows front end ---- If you are running SAP with
LINUX on your work station you will have to change the WS_UPLOAD
and WS_DOWNLOAD functions to reflect the Linux file system. The
contents of the data sets themseleves do not need to be changed
Program can easily be modified to run in batch and store
the data on a UNIX host. Change the WS_UPLOAD and WS_DOWNLOAD
to read from and write to UNIX data sets (OPEN FILE etc).
You will also need to modify the parts of the program that get
the DOS directory and display the Windows file paths.
The actual abap data sets do not need to be changed.
Rel 4.0 names can now be up to 40 bytes long
Dynpros and CUA have changed from rel 3.1
Tabstrips now loaded and unloaded in dynpros
Please note restriction on 4.6 systems for users who
have ABAP names which include '/'s in their names.
Rel 4.6b, 4.6c Abap names can include the '/' in their names
e.g /CUST1/CUST2/ORDER
This causes problems when storing to a local file.
a solution is to change the name to %CUST1%CUST2%ORDER i.e / will
be changed to %. On upload the % should be changed back to /
again. This change still needs to be implemented.
If you don't use the / in the abap name then this is not a problem.
If file to be uploaded is in rel 3 format then names are only 8
bytes long.
program uses 3 datasets per abap
1) abapname.eee source, dynpr logic, texts, CUA stuff
2) abapname.hhh dynpr header
3) abapname.fff dynpro fields.
because of varying lengths and contents 3 data sets are used. The
complexity of combining all these to 1 data set would make the
program far too complex.
NOTE: This version of the program can only be used on
release 4.0 or higher. Once an ABAP has been converted
to rel 4.0 it cannot be converted back to rel 3.0
on a release 3/3.1 system. Release 4 CUA tables
are different. Use release 3 version of this program
for releases 3.0 and 3.1. Available on SAPFANS website.
Note that data to be uploaded must have been previously downloaded
by this program (any version since rel 2.0) - except for Initial
Load -- see end of these comments.
Dynpros and CUA statuses have changed since rel 3.1
This program will handle rel 3.1 format on upload but will
download in rel 4.0 format. To upload 3.1 format specify an 'X'
in the rel3 parameter.
If you have downloaded components in rel 4.0 format and you
want to re-load to a 3.1 system you will have to load
the source via standard upload and re-create dynpros and the CUA
manually.
As names can now be longer than 8 characters you can only
use this program if the SAP front end (SAPGUI) supports
long file names (WIN 95/98 or WIN NT). Windows 3.x will not
work as the underlying DOS system cannot handle long file names.
UPLOAD function and DOS directory.
When an ABAP is selected for UPLOAD then the DOS
directory is read into a table. A file called ABAP.BAT is created,
and down loaded to the 'C' drive and executed.
This file executes a DOS DIR command and pipes the output
into a dataset which is then uploaded into an internal
table on SAP.
Note on running DOS commands from ABAP
The first time this procedure is executed you will see a DOS window
which you will have to close manually. To get round this
use windows explorer to select the file ABAP.BAT and then
right mouse click on the file name. Select the
properties window. From this click the CLOSE on EXIT box. This
will then automatically close the DOS function after it has
executed. (Windows restriction).
The DOS function has not been tested using Windows 2000 so
it might not work. OK on W95,W98,WME and Windows NT (No Thanks)
If INCLUDE programs are wanted on UPLOAD only the specified
directory is searched.
Instead of entering path name manually you can click on
the path parameter. Because of Windows restriction you will
have to select ANY file in the relevant directory.
The path will then be copied on to the selection screen.
To do still : Merge 3 files to one and compress output to .ZIP file
fix 4.5 4.6 problem of abaps containing '/' in the name
possibility to automatically up / download referenced
function modules with selection criteria like INCLUDES
To load the ist time into a system.
Create program with ABAP editor and Upload the .EEE file.
Delete ist line (????SRCE) in the ABAP EDITOR --NOT THE DISK FILE
Delete all the source from the line that starts ????TEXT (towards
the end file) till the end so the last line in your source is ENDFORM.
DO NOT ALTER THE DISK FILE. DO THESE CHANGES IN THE ABAP EDITOR.
Save file and execute
Use following parameters (Note the ist time you won't get proper
text on the selection screen).
Function U
Path full dos path containing source e.g c:\abaps\
NOTE YOU MUST ENTER THE FINAL \ as above.
REPID the program name. e.g ZZJIMHXX
note that on the DISK you will see 3 files
ZZJIMHXX.EEE, ZZJIMHXX.FFF, ZZJIMHXX.HHH
just use the name before the dos qualifier - the
program will do the rest
ignore other parameters
The program will then load itself with all the texts etc.
It should now be ready for use.
Macros
DEFINE DEFINE_TABLE.
DATA: &1 LIKE &2 OCCURS &3 WITH HEADER LINE.
END-OF-DEFINITION.
DEFINE CLS.
REFRESH &1.
CLEAR &1.
END-OF-DEFINITION.
DEFINE INIT.
IF &1 NE SPACE.
SEARCH &1 FOR '. .'.
IF SY-SUBRC = 0.
WRITE '*' TO &1+SY-FDPOS(1).
ENDIF.
TRANSLATE &1 USING '*%'.
ELSE.
MOVE '%' TO &1.
ENDIF.
END-OF-DEFINITION.
end of macros
/ SAP standard tables */
TABLES: D020S, "Dynpro header
D020T, "Dynpro title
D021T, "Screen field keyword texts
TRDIR, "Attribute table
TADIR, "Dev. class etc.
EUDB, "CUA data
TSTC, "transaction data
TITLE, "CUA titles
RSMPTEXTS. "Function texts (rel 4.0)
/ Work tables to hold ABAP source etc, and dynpro */
/ contents. */
DATA: BEGIN OF H. "Header
INCLUDE STRUCTURE D020S.
DATA: END OF H.
DATA: BEGIN OF H1 OCCURS 10, "Header
NAME(40) TYPE C, "rel 4
NUMBER(4) TYPE N.
INCLUDE STRUCTURE D020S.
DATA: END OF H1.
DATA: BEGIN OF H2 OCCURS 0, "Rel 3 dynp. header
CNAME(8) TYPE C,
CNUM(4) TYPE C,
NNAME(8) TYPE C,
NNUM(4) TYPE C,
FILL(51) TYPE C,
CDAT(6) TYPE C,
CTIM(6) TYPE C,
END OF H2.
DATA: BEGIN OF F OCCURS 250. "Dynpro Fields
INCLUDE STRUCTURE D021S.
DATA: END OF F.
DATA: BEGIN OF F1 OCCURS 500, "Dynpro Fields
NAME(40) TYPE C, "rel 4
NUMBER(4) TYPE N.
INCLUDE STRUCTURE D021S.
DATA: END OF F1.
DATA: BEGIN OF OLD_F1 OCCURS 0, "Dynpro Fields (rel 3)
NAME(8) TYPE C,
NUMBER(4) TYPE C.
INCLUDE STRUCTURE D021SE_OLD.
DATA: END OF OLD_F1.
DATA: BEGIN OF F2 OCCURS 0, "Dynpro Fields (rel 3)
TFIL(284) TYPE C,
END OF F2.
DATA: BEGIN OF M OCCURS 3. "Match codes (if any)
INCLUDE STRUCTURE D023S.
DATA: END OF M.
DATA: BEGIN OF E OCCURS 0. "Dynpro Logic
INCLUDE STRUCTURE D022S.
DATA: END OF E.
DATA: BEGIN OF E1 OCCURS 0, "Dynpro Logic
NAME(40) TYPE C, "rel 4
NUMBER(4) TYPE N.
INCLUDE STRUCTURE D022S.
DATA: END OF E1.
DATA: BEGIN OF T OCCURS 0, "prog name and dynpro nrs
NAME(40) TYPE C, "rel 4
NUMBER(4) TYPE N,
END OF T.
DATA: BEGIN OF R OCCURS 56, "prog name and language
NAME(40) TYPE C, "rel 4
LANGUAGE(1) TYPE C,
END OF R.
DATA: BEGIN OF S OCCURS 3000,
TXT(180) TYPE C, "rel 4 was 132
END OF S.
DATA: BEGIN OF R1 OCCURS 50, "for include programs
NAME(40) TYPE C, "rel 4
INSTANCE(3) TYPE P,
END OF R1.
DATA: BEGIN OF S1 OCCURS 3000,
TXT(180) TYPE C, " rel 4 was 132
END OF S1.
DATA: BEGIN OF U OCCURS 100, "Text elements
TXT(180) TYPE C, " rel 4 was 132
END OF U.
DATA: BEGIN OF DIR. "ABAP Attributes
INCLUDE STRUCTURE TRDIR.
DATA: END OF DIR.
DATA: BEGIN OF DTXT. "Dynpro field keyword texts
INCLUDE STRUCTURE D021T.
DATA: END OF DTXT.
/ This data contains all the components of the */
/ CUA such as menus, statuses, Pfkeys */
/ As from rel 4.5 Tabstrips are automatically copied as well */
/ The rel3 parameter must be set however to load the */
/ correct version of the CUA tables if uploading rel 3 */
/ data to a rel 4 system. */
/ Rel 4.0B can convert 3.1 and earlier CUA's */
/ This could change later however. */
CUA Tables.
Key of CUA tables in EUDB data set. Name is len 40 in rel 4.0
DATA BEGIN OF EU_KEY.
INCLUDE STRUCTURE RSEU1_KEY.
DATA END OF EU_KEY.
Status
DATA BEGIN OF STA OCCURS 0.
INCLUDE STRUCTURE RSMPE_STAT. " rel 4
DATA END OF STA.
Functions
DATA BEGIN OF FUN OCCURS 0.
INCLUDE STRUCTURE RSMPE_FUNT. "rel 4
DATA END OF FUN.
Menus
DATA BEGIN OF MEN OCCURS 0.
INCLUDE STRUCTURE RSMPE_MEN. "rel 4.0
DATA END OF MEN.
Menus (texts)
DATA BEGIN OF MTX OCCURS 0.
INCLUDE STRUCTURE RSMPE_MNLT. "rel 4.0
DATA END OF MTX.
Action Bar
DATA BEGIN OF ACT OCCURS 0.
INCLUDE STRUCTURE RSMPE_ACT. "rel 4.0
DATA END OF ACT.
Push Buttons
DATA BEGIN OF BUT OCCURS 0.
INCLUDE STRUCTURE RSMPE_BUT. "rel 4.0
DATA END OF BUT.
PF-Keys
DATA BEGIN OF PFK OCCURS 0.
INCLUDE STRUCTURE RSMPE_PFK. "rel 4.0
DATA END OF PFK.
Function sets
DATA BEGIN OF SET OCCURS 0.
INCLUDE STRUCTURE RSMPE_STAF. "rel 4.0
DATA END OF SET.
Documentation
DATA BEGIN OF DOC OCCURS 0.
INCLUDE STRUCTURE RSMPE_ATRT. "rel 4.0
DATA END OF DOC.
Title codes with text
DATA: BEGIN OF TIT OCCURS 0.
INCLUDE STRUCTURE RSMPE_TITT. "rel 4.0
DATA: END OF TIT.
DATA BEGIN OF FTX OCCURS 0. "rel 4.0
INCLUDE STRUCTURE RSMPTEXTS.
DATA END OF FTX.
rel 3.1 CUA components.
Status
DATA BEGIN OF OLD_STA OCCURS 0.
INCLUDE STRUCTURE RSEU1_GEN. " rel 3.1
DATA END OF OLD_STA.
Functions
DATA BEGIN OF OLD_FUN OCCURS 0.
INCLUDE STRUCTURE RSEU1_FUN. "rel 3.1
DATA END OF OLD_FUN.
Menus
DATA BEGIN OF OLD_MEN OCCURS 0.
INCLUDE STRUCTURE RSEU1_MEN. "rel 3.1
DATA END OF OLD_MEN.
Menus (texts)
DATA BEGIN OF OLD_MTX OCCURS 0.
INCLUDE STRUCTURE RSEU1_TXM. "rel 3.1
DATA END OF OLD_MTX.
Action Bar
DATA BEGIN OF OLD_ACT OCCURS 0.
INCLUDE STRUCTURE RSEU1_ACT. "rel 3.1
DATA END OF OLD_ACT.
Push Buttons
DATA BEGIN OF OLD_BUT OCCURS 0.
INCLUDE STRUCTURE RSEU1_BUT. "rel 3.1
DATA END OF OLD_BUT.
PF-Keys
DATA BEGIN OF OLD_PFK OCCURS 0.
INCLUDE STRUCTURE RSEU1_PFK. "rel 3.1
DATA END OF OLD_PFK.
Function sets
DATA BEGIN OF OLD_SET OCCURS 0.
INCLUDE STRUCTURE RSEU1_SET. "rel 3.1
DATA END OF OLD_SET.
Documentation
DATA BEGIN OF OLD_DOC OCCURS 0.
INCLUDE STRUCTURE RSEU1_ETM. "rel 3.1
DATA END OF OLD_DOC.
Title codes with text
DATA: BEGIN OF OLD_TIT OCCURS 0.
INCLUDE STRUCTURE TITLE. "rel 3.1
DATA: END OF OLD_TIT.
dynamic function text
DATA BEGIN OF FDN OCCURS 1.
INCLUDE STRUCTURE RSEU1_FDYN. "not req for rel 4.
DATA END OF FDN.
Icons
DATA BEGIN OF FIN OCCURS 1.
INCLUDE STRUCTURE RSEU1_ICON. "not req for rel 4
DATA END OF FIN.
dynamic menu texts
DATA BEGIN OF MDN OCCURS 1.
INCLUDE STRUCTURE RSEU1_MDYN. "not req for rel 4.
DATA END OF MDN.
Symbol list
DATA BEGIN OF SYM OCCURS 0.
INCLUDE STRUCTURE RSEU1_SYMB.
DATA END OF SYM.
Status Short text
DATA BEGIN OF STX OCCURS 0.
INCLUDE STRUCTURE RSEU1_CTX.
DATA END OF STX.
Attributes for function key settings (menu bars) Rel 3.0
DATA BEGIN OF ATT OCCURS 0.
INCLUDE STRUCTURE RSEU1_HAT.
DATA END OF ATT.
Include-Menus
DATA BEGIN OF INC OCCURS 3.
INCLUDE STRUCTURE RSEU1_INC.
DATA END OF INC.
Last used numbers
DATA BEGIN OF LAST.
INCLUDE STRUCTURE RSEU1_LST.
DATA END OF LAST.
data for call transaction (SE41 to re-generate the CUA)
DATA: BEGIN OF T_BDC_TAB OCCURS 0.
INCLUDE STRUCTURE BDCDATA. "BDC data
DATA: END OF T_BDC_TAB.
DATA: BEGIN OF T_MESSTAB OCCURS 0.
INCLUDE STRUCTURE BDCDATA.
DATA: END OF T_MESSTAB.
/ Program data */
DATA: NUMBER(4) TYPE N,
OLDNUM(4) TYPE N,
FILESIZE TYPE I,
NR_OF_BYTES TYPE I,
I(3) TYPE P,
IX(3) TYPE P,
J(3) TYPE P,
L(3) TYPE P,
CUA-FLAG(1) TYPE C,
CUA_RETURN(10) TYPE C,
DYNPRO_MESSAGE(160) TYPE C,
DYNPRO_LINE TYPE P,
DYNPRO_WORD(30) TYPE C,
NUM(3) TYPE N,
DYNNAME(44) TYPE C,
FN1(128) TYPE C,
FN2(128) TYPE C,
FN3(128) TYPE C,
W_ITERATE(1) TYPE C,
MAIN(1) TYPE C,
FUNC(1) TYPE C,
OLDNAME(40) TYPE C,
OLD-FUNC(8) TYPE C,
NEW-FUNC(8) TYPE C,
FOUND(1) TYPE C,
LANGUAGE LIKE SY-LANGU,
FIRST-TIME(1) TYPE C VALUE 'Y',
OK-CODE(5) TYPE C,
NAME(40) TYPE C, "rel 4
TXLINE(70) TYPE C,
LINE(132) TYPE C.
DATA:
UL_FILE(128) TYPE C,
DL_FILE(128) TYPE C,
DOSLINE(72) TYPE C.
DATA: BEGIN OF DOSDIR OCCURS 0,
TEXT(72),
END OF DOSDIR.
DATA: BEGIN OF I_PROG OCCURS 0,
NAME(40),
END OF I_PROG.
DATA: BEGIN OF I_PROGT OCCURS 0,
NAME(40),
END OF I_PROGT.
DATA: BEGIN OF I_INCLUDE OCCURS 0,
NAME(40),
HANDLED(1) TYPE C,
END OF I_INCLUDE.
DATA: BEGIN OF I_INCL OCCURS 0,
NAME(40),
END OF I_INCL.
DATA: BUFFER(1024).
DATA: WINSYS(3).
DATA: GLOBAL_FILEMASK_MASK(20), GLOBAL_FILEMASK_TEXT(20).
DATA: GLOBAL_FILEMASK_ALL(80).
DATA: T_FILENAME(128),
TMP_FILENAME(128),
T_MODE(1),
FIELDLN TYPE I.
DEFINE_TABLE I_DYNPFIELDS DYNPREAD 0. "dynpro fields to be updated
DATA: I_FLDS LIKE HELP_VALUE OCCURS 0 WITH HEADER LINE.
FIELD-SYMBOLS: <F>.
/ Parameters */
SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS REPID FOR TRDIR-NAME OBLIGATORY .
PARAMETERS:
FUNCTION(1) TYPE C OBLIGATORY, "Function
DSNAME(40) TYPE C, "Data set name
INCLUDES(1) TYPE C DEFAULT 'N', "Resolve Includes
IMASK(40) TYPE C, "Include Mask
CLASS LIKE TRDIR-CLAS,
AUTHOR LIKE TRDIR-CNAM, "Author
APPL LIKE TRDIR-APPL,
PATH(88) TYPE C DEFAULT 'A:\',
REL3(1) TYPE C.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(70) TEXT-004.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(70) TEXT-005.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(70) TEXT-002.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(70) TEXT-003.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK A1.
/ Check users workstation is running WINDOWS, */
/ WINDOWS 95, or WINDOWS NT. OS/2 no good for */
/ this application. */
CALL FUNCTION 'WS_QUERY'
EXPORTING
QUERY = 'WS'
IMPORTING
RETURN = WINSYS.
IF WINSYS(2) NE 'WN'. "Win 3.X no good either
WRITE: / 'Windows NT or Windows 95/98 is required'.
EXIT.
ENDIF.
/ Get names of programs to be handled. */
/ Name can be a single value, many values or ranges */
/ as per standard SELECT-OPTIONS on selection screen */
/ On Download read TRDIR and store program names in a table */
/ as per selection options. */
/ On upload read the specified directory for all files of */
/ type .EEE from specified directory */
/ compare file names with selection criteria */
MOVE FUNCTION TO FUNC.
MOVE 'Y' TO MAIN.
CASE FUNC.
WHEN 'U'. "Upload required
PERFORM READ_DOS_DIRECTORY.
PERFORM GET_RANGE_UL. "Get list of progs to process
WHEN 'D'. "Download required
PERFORM GET_RANGE_DL. "Get list of progs to process
WHEN OTHERS.
WRITE: / 'Function not performed due to user request'.
EXIT.
ENDCASE.
SORT I_PROG.
DELETE ADJACENT DUPLICATES FROM I_PROG.
For download INCLUDE handling can be resolved via function
module call.
All Includes within Includes are also resolved by the function
module call.
Note that this method does not work if program itself is of type
I (it's an include)
In this case we can still search the source.
IF FUNC = 'D'.
IF INCLUDES = 'Y'.
PERFORM GET_INCLUDES_DL.
PERFORM PROCESS_INCLUDES_DL.
ENDIF.
ENDIF.
Program list from selection criteria i.e excluding INCLUDES found
LOOP AT I_PROG.
MOVE I_PROG-NAME TO R1-NAME.
APPEND R1.
DESCRIBE TABLE R1 LINES I.
WHILE I NE 0.
PERFORM EXECUTE-FUNCTION.
ENDWHILE.
REFRESH R1.
ENDLOOP.
We need to check now for INCLUDES on DOWNLOAD when the INCLUDE
program itself is of type I. In this case the function call
will not return the INCLUDES. For example we could be
downloading ZTESTTOP (an Include itself) which as an include
ZTEST01.
The process fortunately is the same as the UPLOAD function
except of course we need to read the library instead of the
DOS directory
process INCLUDE modules for Upload
On upload the procedure is more complex as Includes within
Includes can only be resolved by scanning the code and
searching if the program exists in the directory.
To get all INCLUDES within INCLUDES entries in table I_INCL
that do not exist in I_INCLUDE are copied to table I_INCLUDE
after each entire pass of table i_INCLUDE and table is then
re-looped through. Programs in table I_INCLUDE that have already
been processed have a "Y" indicator set in I_INCLUDE-AVAIL.
if func = 'U'.
IF INCLUDES = 'Y'.
DESCRIBE TABLE I_INCL LINES I.
IF I > 0.
W_ITERATE = 'Y'.
ELSE.
W_ITERATE = ' '.
ENDIF.
WHILE W_ITERATE = 'Y'.
PERFORM PROCESS_INCLUDES_UL.
PERFORM LOOP_THROUGH.
DESCRIBE TABLE I_INCL LINES I.
IF I > 0.
W_ITERATE = 'Y'.
ELSE.
W_ITERATE = ' '.
ENDIF.
ENDWHILE.
endif.
ENDIF.
DESCRIBE TABLE I_INCLUDE LINES I.
IF I > 0.
SKIP 1.
WRITE: / ' Included Programs found'.
SKIP 1.
LOOP AT I_INCLUDE.
WRITE I_INCLUDE-NAME TO LINE(40).
CONDENSE LINE.
WRITE: / LINE(80).
ENDLOOP.
ENDIF.
/ Table R contains ABAP names to up / download. */
/ Loop through table R and perform up / download */
/ for each program. */
/ Table R1 contains INCLUDE names found (if any) */
/ As each */
FORM EXECUTE-FUNCTION.
LOOP AT R1.
MOVE-CORRESPONDING R1 TO R.
APPEND R.
ENDLOOP.
REFRESH R1.
LOOP AT R.
REFRESH : T, E1, H1, F1, S, U.
PERFORM PROCESS.
MOVE 'N' TO MAIN.
ENDLOOP.
REFRESH R.
DESCRIBE TABLE R1 LINES I.
ENDFORM.
/ Build file names for UP/DOWNLOAD */
/ 3 files are generated per ABAP. */
/ 1) ABAP Path\PROGNAME.EEE (ABAP, Attr,Texts) */
/ Logic Path\PROGNAME.EEE (Dynpro Source Logic) */
/ CUA Path\PROGNAME.EEE (CUA components - keys etc) */
/ 2) Header Path\PROGNAME.HHH (Dynpro Header) */
/ 3) Fields Path\PROGNAME.FFF (Dynpro Field definitions )*/
/ ( If alternate file name specified -DSNAME- this will */
/ be used instead. This is only valid for the main program. */
/ INCLUDED programs will have file names as specified */
/ above). */
/ By using this scheme it saves the user from having to */
/ be prompted for 3 file names. */
/ If you want multiple copies / versions on disk either */
/ rename the old versions or specify a different directory in */
/ the path parameter. */
FORM PROCESS.
MOVE PATH TO FN1.
CASE MAIN.
WHEN 'Y'.
IF DSNAME NE SPACE.
WRITE DSNAME TO FN1+66. "rel 4
ELSE.
WRITE R-NAME TO FN1+66. "rel 4
ENDIF.
WHEN OTHERS.
WRITE R-NAME TO FN1+66. "rel 4
ENDCASE.
MOVE FN1 TO FN2.
MOVE FN1 TO FN3.
WRITE '.HHH' TO FN1+124(4). "rel 4
WRITE '.FFF' TO FN2+124(4). "rel 4
WRITE '.EEE' TO FN3+124(4). "rel 4
CONDENSE FN1 NO-GAPS.
CONDENSE FN2 NO-GAPS.
CONDENSE FN3 NO-GAPS.
NAME = R-NAME.
CASE FUNC.
WHEN 'D'.
PERFORM DOWNLOAD_OBJECTS.
CLEAR LINE.
WRITE : 'ABAP : ' TO LINE.
WRITE R-NAME TO LINE+8.
WRITE 'has been unloaded' TO LINE+55.
CONDENSE LINE.
WRITE: / LINE.
DESCRIBE TABLE T LINES I.
IF I = 0.
WRITE: / 'No Dynpros were found for unload function'.
ELSE.
WRITE: / 'The following Dynpros have been unloaded : '.
PERFORM LOOP_THROUGH_T.
ENDIF.
WHEN 'U'.
PERFORM UPLOAD_OBJECTS.
DESCRIBE TABLE T LINES I.
CASE I.
WHEN 0.
WRITE: / 'No Dynpros were found for restore function'.
WHEN OTHERS.
WRITE: / 'The following Dynpros have been restored : '.
PERFORM LOOP_THROUGH_T.
ENDCASE.
IF MAIN EQ 'Y'.
CASE OLDNAME.
WHEN SPACE.
CLEAR LINE.
WRITE : 'ABAP : ' TO LINE.
WRITE R-NAME TO LINE+8.
WRITE 'has been restored' TO LINE+55.
CONDENSE LINE.
WRITE: / LINE.
WHEN OTHERS.
CLEAR LINE.
WRITE : 'ABAP : ' TO LINE.
WRITE R-NAME TO LINE+8.
WRITE 'has been restored - original name :'
TO LINE+55.
WRITE OLDNAME TO LINE+92.
CONDENSE LINE.
WRITE: / LINE.
ENDCASE.
ELSE.
CLEAR LINE.
WRITE : 'ABAP : ' TO LINE.
WRITE R-NAME TO LINE+8.
WRITE 'has been restored' TO LINE+55.
CONDENSE LINE.
WRITE: / LINE.
ENDIF.
ENDCASE.
ENDFORM.
/ print progname + dynpro nrs that have been processed. */
FORM LOOP_THROUGH_T.
LOOP AT T.
CLEAR LINE.
WRITE R-NAME TO LINE.
WRITE T-NUMBER TO LINE+50.
CONDENSE LINE.
WRITE: / LINE.
ENDLOOP.
ENDFORM.
/ Download Objects */
FORM DOWNLOAD_OBJECTS.
PERFORM UNLOAD_ABAP. "ABAP source, texts, attr
SELECT SINGLE * FROM TRDIR
WHERE NAME EQ R-NAME.
IF TRDIR-SUBC = 'I'.
CASE INCLUDES. "Included file wanted
WHEN 'Y'.
PERFORM SCAN4-INCLUDES.
ENDCASE.
ENDIF.
PERFORM UNLOAD_CUA. "CUA stuff
PERFORM DOWNLOAD_DATA. "Download EEE file to PC
PERFORM BUILD_T. "Build table of all dynpros in ABAP
DESCRIBE TABLE T LINES I.
CASE I.
WHEN 0. "if no dynpros exist then cannot download any
PERFORM DOWNLOAD_DATA. "Download EEE file to PC
WHEN OTHERS.
PERFORM UNLOAD_DYNPROS. "Get Raw dynpros from SAP
PERFORM UNLOAD_DYNPRO_COMPONENTS."Convert to table
PERFORM DOWNLOAD_DATA. "Download ABAP etc. to PC
PERFORM DOWNLOAD_BIN_H1. "Download dynpro header
PERFORM DOWNLOAD_BIN_F1. "Download dynpro fields
ENDCASE.
ENDFORM.
/ Split ABAP up into its component parts */
/ A) Program source (72) */
/ B) Texts (132) */
/ C) Attributes (117) */
/ D) CUA stuff (Various) */
FORM UNLOAD_ABAP.
/ Get ABAP language. Only required on download. */
SELECT SINGLE * FROM TRDIR
WHERE NAME EQ R-NAME.
MOVE TRDIR-RLOAD TO R-LANGUAGE.
READ REPORT R-NAME INTO S. "Get source into table S
MOVE '????SRCE' TO S-TXT.
INSERT S INDEX 1.
/ Text elements, Numbered texts, headings, selection texts */
/ Read text elements with logon language. If they don't */
/ exist read with the value taken from TRDIR. */
READ TEXTPOOL R-NAME INTO U LANGUAGE SY-LANGU.
IF SY-SUBRC NE 0.
READ TEXTPOOL R-NAME INTO U LANGUAGE R-LANGUAGE.
ENDIF.
DESCRIBE TABLE U LINES I.
CASE I.
WHEN 0.
WHEN OTHERS.
MOVE '????TEXT' TO S-TXT.
APPEND S.
LOOP AT U.
MOVE U-TXT TO S-TXT.
APPEND S.
DELETE U.
ENDLOOP.
ENDCASE.
/ Retrieve Attributes from TRDIR and add to table S */
/ Change language to logged on language */
MOVE '????ATTR' TO S-TXT.
APPEND S.
SELECT SINGLE * FROM TRDIR
WHERE NAME EQ R-NAME.
MOVE SY-LANGU TO TRDIR-RLOAD.
MOVE-CORRESPONDING TRDIR TO DIR.
MOVE DIR TO S-TXT.
APPEND S.
ENDFORM.
/ retrieve CUA stuff and append to table S. */
FORM UNLOAD_CUA.
MOVE R-NAME TO EU_KEY-NAME. "Program name for CUA
MOVE 'D' TO EU_KEY-SPRSL. "CUA seems to want D as lang
MOVE R-LANGUAGE TO EU_KEY-SPRSL. "Language "rel 2.2
IMPORT STA FUN MEN MTX ACT BUT PFK SET LAST INC STX DOC "rel 2.2
IMPORT STA STX FUN MEN MTX ACT BUT PFK SET LAST INC DOC "rel 3.0
ATT FDN MDN SYM FIN "rel 3.0
FROM DATABASE EUDB(CU) ID EU_KEY.
IF SY-SUBRC NE 0. "No statuses
EXIT.
ENDIF.
read titles in logged on language. If not present use
language from TRDIR.
CASE REL3.
WHEN SPACE. "(rel 4)
SELECT * FROM RSMPTEXTS WHERE PROGNAME EQ R-NAME
AND SPRSL = SY-LANGU.
MOVE-CORRESPONDING RSMPTEXTS TO FTX.
APPEND FTX.
ENDSELECT.
IF SY-SUBRC NE 0.
SELECT * FROM RSMPTEXTS WHERE PROGNAME EQ R-NAME
AND SPRSL = R-LANGUAGE.
MOVE-CORRESPONDING RSMPTEXTS TO FTX.
APPEND FTX.
ENDSELECT.
ENDIF.
DESCRIBE TABLE FTX LINES I.
IF I > 0.
MOVE '????FTXT' TO S-TXT.
APPEND S.
LOOP AT FTX.
MOVE FTX TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
WHEN OTHERS.
SELECT * FROM TITLE WHERE PROGNAME EQ R-NAME
AND DDLANGUAGE EQ SY-LANGU.
MOVE-CORRESPONDING TITLE TO TIT.
APPEND TIT.
ENDSELECT.
IF SY-SUBRC NE 0.
SELECT * FROM TITLE WHERE PROGNAME EQ R-NAME
AND DDLANGUAGE EQ R-LANGUAGE.
MOVE-CORRESPONDING TITLE TO TIT.
APPEND TIT.
ENDSELECT.
ENDIF.
ENDCASE.
DESCRIBE TABLE STA LINES I.
IF I > 0.
MOVE '????STAT' TO S-TXT.
APPEND S.
LOOP AT STA.
MOVE STA TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE FUN LINES I.
IF I > 0.
MOVE '????FUNC' TO S-TXT.
APPEND S.
LOOP AT FUN.
MOVE FUN TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE MEN LINES I.
IF I > 0.
MOVE '????MEN1' TO S-TXT.
APPEND S.
LOOP AT MEN.
MOVE MEN TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE MTX LINES I.
IF I > 0.
MOVE '????MTX1' TO S-TXT.
APPEND S.
LOOP AT MTX.
MOVE MTX TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE ACT LINES I.
IF I > 0.
MOVE '????ACTN' TO S-TXT.
APPEND S.
LOOP AT ACT.
MOVE ACT TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE BUT LINES I.
IF I > 0.
MOVE '????BUTN' TO S-TXT.
APPEND S.
LOOP AT BUT.
MOVE BUT TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE PFK LINES I.
IF I > 0.
MOVE '????PFKY' TO S-TXT.
APPEND S.
LOOP AT PFK.
MOVE PFK TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE SET LINES I.
IF I > 0.
MOVE '????SETS' TO S-TXT.
APPEND S.
LOOP AT SET.
MOVE SET TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
IF LAST NE SPACE.
MOVE '????LIST' TO S-TXT.
APPEND S.
MOVE LAST TO S-TXT.
APPEND S.
ENDIF.
DESCRIBE TABLE INC LINES I.
IF I > 0.
MOVE '????INCL' TO S-TXT.
APPEND S.
LOOP AT INC.
MOVE INC TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE STX LINES I.
IF I > 0.
MOVE '????STXT' TO S-TXT.
APPEND S.
LOOP AT STX.
MOVE STX TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE DOC LINES I.
IF I > 0.
MOVE '????DOCN' TO S-TXT.
APPEND S.
LOOP AT DOC.
MOVE DOC TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE TIT LINES I.
IF I > 0.
MOVE '????TITL' TO S-TXT.
APPEND S.
LOOP AT TIT.
MOVE TIT TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
Next 5 tables are rel 3.0 specific (ATT, FDN, MDN, SYM, FIN)
DESCRIBE TABLE ATT LINES I.
IF I > 0.
MOVE '????VATT' TO S-TXT.
APPEND S.
LOOP AT ATT.
MOVE ATT TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE FDN LINES I.
IF I > 0.
MOVE '????VFDN' TO S-TXT.
APPEND S.
LOOP AT FDN.
MOVE FDN TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE MDN LINES I.
IF I > 0.
MOVE '????VMDN' TO S-TXT.
APPEND S.
LOOP AT MDN.
MOVE MDN TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE SYM LINES I.
IF I > 0.
MOVE '????VSYM' TO S-TXT.
APPEND S.
LOOP AT SYM.
MOVE SYM TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
DESCRIBE TABLE FIN LINES I.
IF I > 0.
MOVE '????VFIN' TO S-TXT.
APPEND S.
LOOP AT FIN.
MOVE FIN TO S-TXT.
APPEND S.
ENDLOOP.
ENDIF.
ENDFORM.
/ Upload Objects. */
FORM UPLOAD_OBJECTS.
PERFORM UPLOAD_EEE. "ABAP,texts,attr dynpro logic
DESCRIBE TABLE E1 LINES I.
IF I > 0. "Do dynpro components exist
PERFORM UPLOAD_HHH. "dynpro header
PERFORM UPLOAD_FFF. "dynpro fields.
PERFORM RECONSTRUCT_DYNPROS. "load + gen dynpros
ENDIF.
ENDFORM.
/ Build table containing dynpro names and numbers */
FORM BUILD_T.
SELECT * FROM D020S WHERE PROG EQ R-NAME.
T-NUMBER = D020S-DNUM.
T-NAME = D020S-PROG.
APPEND T.
ENDSELECT.
ENDFORM.
/ Split dynpros into constituent parts. */
FORM UNLOAD_DYNPROS.
MOVE 'Y' TO FIRST-TIME.
LOOP AT T.
REFRESH: F, E.
CLEAR: H, F, E.
PERFORM BUILD_HHH. "Dynpro Header
PERFORM BUILD_FFF. "Dynpro Fields
PERFORM BUILD_EEE_DYNP. "Dynpro Logic
ENDLOOP.
ENDFORM.
/ Header H length 284. */
FORM BUILD_HHH.
MOVE T-NAME TO DYNNAME(40). "rel 4.
MOVE T-NUMBER TO DYNNAME+40(4). "rel 4.
IMPORT DYNPRO H F E M ID DYNNAME.
MOVE T-NAME TO H1-NAME.
MOVE T-NUMBER TO H1-NUMBER.
MOVE-CORRESPONDING H TO H1.
APPEND H1.
ENDFORM.
/ Fields D021S Len 87. */
FORM BUILD_FFF.
MOVE T-NAME TO F1-NAME.
MOVE T-NUMBER TO F1-NUMBER.
LOOP AT F.
MOVE-CORRESPONDING F TO F1.
APPEND F1.
DELETE F.
ENDLOOP.
ENDFORM.
/ Dynpro Logic D022S E */
FORM BUILD_EEE_DYNP.
MOVE T-NAME TO E1-NAME.
MOVE T-NUMBER TO E1-NUMBER.
LOOP AT E.
MOVE-CORRESPONDING E TO E1.
APPEND E1.
DELETE E.
ENDLOOP.
ENDFORM.
/ Unload Constituent parts of dynpro. */
FORM UNLOAD_DYNPRO_COMPONENTS.
MOVE '????LOGC' TO S-TXT.
APPEND S.
LOOP AT E1.
MOVE E1 TO S-TXT.
APPEND S.
DELETE E1.
ENDLOOP.
FREE E1.
LOOP AT T.
MOVE 'N' TO FOUND.
SELECT SINGLE * FROM D020T "use logged on language
WHERE PROG EQ T-NAME
AND DYNR EQ T-NUMBER
AND LANG EQ SY-LANGU.
IF SY-SUBRC NE 0. "try original language.
SELECT SINGLE * FROM D020T
WHERE PROG EQ T-NAME
AND DYNR EQ T-NUMBER
AND LANG EQ R-LANGUAGE.
ENDIF.
IF SY-SUBRC EQ 0.
IF FOUND = 'N'.
MOVE '????DTIT' TO S-TXT.
APPEND S.
MOVE 'Y' TO FOUND.
ENDIF.
MOVE T-NAME TO S-TXT.
WRITE T-NUMBER TO S-TXT+8(4).
WRITE D020T-DTXT TO S-TXT+12(60).
APPEND S.
ENDIF.
MOVE 'N' TO FOUND.
SELECT * FROM D021T
WHERE PROG EQ T-NAME
AND DYNR EQ T-NUMBER
AND LANG EQ SY-LANGU. "logged on language
IF FOUND = 'N'.
MOVE '????DTXT' TO S-TXT.
APPEND S.
MOVE 'Y' TO FOUND.
ENDIF.
MOVE-CORRESPONDING D021T TO DTXT.
MOVE DTXT TO S-TXT.
APPEND S.
ENDSELECT.
CASE SY-SUBRC.
WHEN 0.
WHEN OTHERS. "try original language
SELECT * FROM D021T
WHERE PROG EQ T-NAME
AND DYNR EQ T-NUMBER
AND LANG EQ R-LANGUAGE.
IF FOUND = 'N'.
MOVE '????DTXT' TO S-TXT.
APPEND S.
MOVE 'Y' TO FOUND.
ENDIF.
MOVE-CORRESPONDING D021T TO DTXT.
MOVE DTXT TO S-TXT.
APPEND S.
ENDSELECT.
ENDCASE.
ENDLOOP.
ENDFORM.
/ Build the original dynpro component tables. */
/ Table H1 contains 1 entry for each dynpro. H1 contains */
/ the header for the dynpro prefixed by the program name */
/ and dynpro number. */
/ By looping round this table we can re-build the F */
/ (Fields) and E (Logic) components. By stripping off the */
/ program name and dynpro number the original tables are */
/ re-created. (Tables F1 and E1 also have a prefix of */
/ Program name and dynpro nr). */
/ After the original set of tables has been re-created we */
/ use R3 - SYSTEM-CALL (rel 2.2) to generate the screen */
/ and then get the next entry in table H1 to build the */
/ next screen. For releases 3.0 and higher use generate */
/ dynpro. */
FORM RECONSTRUCT_DYNPROS.
LOOP AT H1.
CASE MAIN.
WHEN 'Y'.
if h1-name ne repid.
IF H1-NAME NE R1-NAME.
MOVE H1-NAME TO OLDNAME.
ENDIF.
ENDCASE.
PERFORM RECONSTRUCT_F.
PERFORM RECONSTRUCT_E.
MOVE-CORRESPONDING H1 TO H.
IF MAIN = 'Y'.
move repid to h-prog.
MOVE R1-NAME TO H-PROG.
move repid to dynname.
MOVE R1-NAME TO DYNNAME.
ELSE.
MOVE H1-NAME TO H-PROG.
MOVE H1-NAME TO DYNNAME.
ENDIF.
MOVE H1-NUMBER TO H-DNUM.
WRITE H1-NUMBER TO DYNNAME+40(4).
EXPORT DYNPRO H F E M ID DYNNAME.
SYSTEM-CALL GENERATE-SCREEN DYNNAME. "Up to rel 2.2
GENERATE DYNPRO H F E M ID DYNNAME "R 3.0, 4.0, 4.5
MESSAGE DYNPRO_MESSAGE
LINE DYNPRO_LINE
WORD DYNPRO_WORD.
REFRESH: M, F, E.
CLEAR: M, H, F, E.
ENDLOOP.
ENDFORM.
/ Re-build Fields table */
FORM RECONSTRUCT_F.
LOOP AT F1 WHERE NAME EQ H1-NAME AND
NUMBER EQ H1-NUMBER.
MOVE-CORRESPONDING F1 TO F.
APPEND F.
ENDLOOP.
ENDFORM.
/ Re-build Logic table */
FORM RECONSTRUCT_E.
LOOP AT E1 WHERE NAME EQ H1-NAME AND
NUMBER EQ H1-NUMBER.
MOVE-CORRESPONDING E1 TO E.
APPEND E.
ENDLOOP.
ENDFORM.
/ scan for included files (Upload) */
FORM SCAN4-INCLUDES.
IF FUNC = 'D'. "Downloads - whole table needs to be scanned
LOOP AT S.
PERFORM SEARCH-FUNC.
ENDLOOP.
ENDIF.
IF FUNC = 'U'. "On upload scan line by line as we are re-building abap
PERFORM SEARCH-FUNC.
ENDIF.
ENDFORM.
/ scan for text INCLUDE xxxxxxxx */
/ reject INCLUDE STRUCTURE as structure not a valid */
/ program name */
FORM SEARCH-FUNC.
CONDENSE S-TXT.
SEARCH S-TXT FOR '.INCLUDE .'.
CASE SY-SUBRC.
WHEN 0.
IF S-TXT+8(9) EQ 'STRUCTURE'
OR S-TXT+8(9) EQ 'structure'
OR S-TXT+8(6) EQ '<ICON>' "rel 3.0c 3.0d
OR S-TXT+8(6) EQ '<icon>'
OR S-TXT+8(6) EQ '<type>'
OR S-TXT+8(6) EQ '<TYPE>'
OR S-TXT+8(9) EQ '<methods>'
OR S-TXT+8(9) EQ '<METHODS>'.
EXIT.
ENDIF.
IF SY-FDPOS EQ 0. "INCLUDE must be in pos 1 (by reason of condense)
PERFORM VALIDATE_INCLUDE.
ELSE.
EXIT.
ENDIF.
ENDCASE.
ENDFORM.
/ Validate INCLUDES . */
FORM VALIDATE_INCLUDE.
SEARCH S-TXT FOR '...' STARTING AT 9 ENDING AT 39.
CASE SY-SUBRC.
WHEN 0.
WHEN OTHERS.
SEARCH S-TXT FOR '. .' STARTING AT 9 ENDING AT 38.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
ENDCASE.
IX = SY-FDPOS.
ASSIGN S-TXT+8(IX) TO <F>.
Now check for Include Mask for example if include mask was set to
Z* then only include programs whose first letter starts with a Z.
1) get length of the INCLUDE program name. Must be less than or
equal 40.
2) Compare it with the Include mask.
3) If Ok add include program name to include table
clear i_include.
move <f> to i_include-name.
CLEAR I_INCL.
SEARCH IMASK FOR '.*.'.
IF SY-SUBRC = 0.
CONDENSE IMASK.
ENDIF.
IF ( <F> CP IMASK OR IMASK = ' ' ).
READ TABLE I_INCL WITH KEY = <F>.
IF SY-SUBRC NE 0.
MOVE <F> TO I_INCL-NAME.
move 1 to i_include-count.
collect i_include.
APPEND I_INCL.
ENDIF.
ENDIF.
ENDFORM.
/ Download table S. */
FORM DOWNLOAD_DATA.
CLEAR TXLINE.
WRITE 'Downloading ' TO TXLINE.
WRITE R1-NAME TO TXLINE+12.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TXLINE
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = FN3
FILETYPE = 'ASC'
TABLES
DATA_TAB = S.
ENDFORM.
/ Download Binary files H1 */
FORM DOWNLOAD_BIN_H1.
DESCRIBE FIELD H1 LENGTH J.
DESCRIBE TABLE H1 LINES I.
NR_OF_BYTES = I * J.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = FN1
FILETYPE = 'BIN'
BIN_FILESIZE = NR_OF_BYTES
IMPORTING
FILELENGTH = FILESIZE
TABLES
DATA_TAB = H1.
ENDFORM.
/ Download Binary files F1 */
FORM DOWNLOAD_BIN_F1.
DESCRIBE FIELD F1 LENGTH J.
DESCRIBE TABLE F1 LINES I.
NR_OF_BYTES = I * J.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = FN2
FILETYPE = 'BIN'
BIN_FILESIZE = NR_OF_BYTES
IMPORTING
FILELENGTH = FILESIZE
TABLES
DATA_TAB = F1.
ENDFORM.
/ Upload data from file .EEE */
FORM UPLOAD_EEE.
CLEAR TXLINE.
WRITE 'Uploading ' TO TXLINE.
WRITE R1-NAME TO TXLINE+10.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TXLINE
EXCEPTIONS
OTHERS = 1.
MOVE 'Y' TO FIRST-TIME.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FN3
FILETYPE = 'ASC'
IMPORTING
FILELENGTH = NR_OF_BYTES
TABLES
DATA_TAB = S1.
LOOP AT S1.
IF S1-TXT(4) = '????'.
MOVE S1-TXT(8) TO NEW-FUNC.
IF FIRST-TIME = 'Y'.
MOVE S1-TXT(8) TO OLD-FUNC.
MOVE 'N' TO FIRST-TIME.
ELSE.
PERFORM STORE_COMPONENT.
MOVE NEW-FUNC TO OLD-FUNC.
ENDIF.
ENDIF.
IF S1-TXT(4) NE '????'.
PERFORM REBUILD-COMPONENT.
ENDIF.
ENDLOOP.
PERFORM STORE_COMPONENT. "last component still to be processed
PERFORM REBUILD-CUA. "re-build CUA, statuses, pfk etc
ENDFORM.
/ Upload Dynpro headers (HHH) and fields (FFF) */
/ titles and dynpro logic is contained in file .EEE */
/ and has already been processed. */
FORM UPLOAD_HHH.
CASE REL3.
WHEN 'X'.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FN1
FILETYPE = 'BIN'
IMPORTING
FILELENGTH = NR_OF_BYTES
TABLES
DATA_TAB = H2.
LOOP AT H2.
MOVE H2-CNAME TO H1-NAME.
MOVE H2-CNUM TO H1-NUMBER.
MOVE H2-NNAME TO H1-PROG.
MOVE H2-NNUM TO H1-DNUM.
MOVE H2-CTIM TO H1-TGEN.
WRITE '19' TO H1-DGEN(2).
WRITE H2-CDAT TO H1-DGEN+2(6).
WRITE H2-FILL TO H1+88(39).
APPEND H1.
ENDLOOP.
WHEN OTHERS.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FN1
FILETYPE = 'BIN'
IMPORTING
FILELENGTH = NR_OF_BYTES
TABLES
DATA_TAB = H1.
ENDCASE.
LOOP AT H1.
MOVE H1-NAME TO T-NAME.
MOVE H1-NUMBER TO T-NUMBER.
APPEND T.
ENDLOOP.
ENDFORM.
/ Upload Binary file F1 - Dynpro fields */
FORM UPLOAD_FFF.
CASE REL3.
WHEN 'X'.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FN2
FILETYPE = 'BIN'
IMPORTING
FILELENGTH = NR_OF_BYTES
TABLES
DATA_TAB = F2.
LOOP AT F2.
OLD_F1 = F2.
APPEND OLD_F1.
ENDLOOP.
LOOP AT OLD_F1.
MOVE-CORRESPONDING OLD_F1 TO F1.
APPEND F1.
ENDLOOP.
WHEN OTHERS.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FN2
FILETYPE = 'BIN'
IMPORTING
FILELENGTH = NR_OF_BYTES
TABLES
DATA_TAB = F1.
ENDCASE.
ENDFORM.
/ Re-construct data from file .EEE */
FORM REBUILD-COMPONENT.
CASE OLD-FUNC.
WHEN '????LOGC'. "Dynpro LOGIC.
CASE REL3.
WHEN 'X'.
SHIFT S1-TXT+8 RIGHT BY 32 PLACES.
ENDCASE.
MOVE S1-TXT TO E1.
APPEND E1.
/ Load ABAP Source code, CUA, pfkeys etc to int tables */
WHEN '????SRCE'.
MOVE S1-TXT TO S-TXT.
APPEND S.
CASE INCLUDES. "Included file wanted
WHEN 'Y'.
PERFORM SCAN4-INCLUDES.
ENDCASE.
if restoring / uploading rel 3.1 or lower different cua tables
are used. At generate CUA time these will be converted by the
system to rel 4.0
WHEN '????STAT'.
CASE REL3.
WHEN 'X'.
MOVE S1-TXT TO OLD_STA.
APPEND OLD_STA.
WHEN SPACE.
MOVE S1-TXT TO STA.
APPEND STA.
ENDCASE.
MOVE 'Y' TO CUA-FLAG.
WHEN '????FUNC'.
CASE REL3.
WHEN 'X'.
MOVE S1-TXT TO OLD_FUN.
APPEND OLD_FUN.
WHEN SPACE.
MOVE S1-TXT TO FUN.
APPEND FUN.
ENDCASE.
MOVE 'Y' TO CUA-FLAG.
WHEN '????MEN1'.
CASE REL3.
WHEN 'X'.
MOVE S1-TXT TO OLD_MEN.
APPEND OLD_MEN.
WHEN SPACE.
MOVE S1-TXT TO MEN.
APPEND -
Can we use Initilization event in module pool program?
Hi All,
Can we use Initialization event in module pool program? If not why?
Thanks In Advance!!!!!!!!!The runtime environment creates the INITIALIZATION event and calls the corresponding event block (if it has been defined in the ABAP program).
http://help.sap.com/saphelp_nw70/helpdata/EN/fc/eb2d67358411d1829f0000e829fbfe/content.htm
SEE THE ABOVE LINK...THINK IT WILL SOLVE ALL YOUR DOUBTS
REGARDS
RACHEL -
How to call a "Z"module pool program in a "z"report
Hi Guys,
I have two reports .
1. Report : uploads a tab delimited " .Txt1" file and update the "z1" table
".TXT1" : File contains 4 fields
2. Module pool. :Uploads a a tab delimited " .Txt2" file and update another "z2" table
".TXT2" file contains the 4 fileds of ".TXT1" and also 2 extra fields.
I want to merge (call) the module pool program in the Report and perform the upload function using only one ".TXT" file.Please do guide me precisely .
*Report:*
REPORT zrswbgcs009 NO STANDARD PAGE HEADING MESSAGE-ID zwb
LINE-SIZE 185.
TABLES: zgcs_foc. "FOC Parts Table
*data count buffer
DATA: read_cnt(6) TYPE p, "Find read record
update_cnt(6) TYPE p, "OK record
error_cnt(6) TYPE p. "Error record
*file buffer(FOC)
DATA: BEGIN OF FOC_inrec OCCURS 0,
CUSTOMER(10), "Customer
PART_CODE(18), "Parts Code
REF_NO(35), "Ref No.
REF_DATE(10), "Ref Date
QTY(12), "Parts Qty
TEXT(100), "Remark
END OF FOC_inrec.
*file buffer
DATA: BEGIN OF inrec OCCURS 0,
CUSTOMER(10), "Customer
PART_CODE(18), "Parts Code
REF_NO(35), "Ref No.
REF_DATE(10), "Ref Date
QTY(12), "Parts Qty
PRICE(15), "Parts Price
WAERK(5), "Parts Currency
TEXT(100), "Remark
END OF inrec.
DATA : v_file LIKE rlgrap-filename.
DATA gt_zgcs_foc LIKE zgcs_foc OCCURS 0 WITH HEADER LINE.
DATA gs_zgcs_foc LIKE zgcs_foc.
*File name ACCEPT--------------------------------------------------
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
*Company code
PARAMETERS: p_comp LIKE zgcs_imei-company OBLIGATORY.
PARAMETERS: pcfile LIKE rlgrap-filename OBLIGATORY LOWER CASE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
PARAMETERS: HQfile RADIOBUTTON GROUP b2.
SELECTION-SCREEN COMMENT 7(20) text-101 FOR FIELD HQfile.
SELECTION-SCREEN POSITION 31.
PARAMETERS: SUBfile RADIOBUTTON GROUP b2.
SELECTION-SCREEN COMMENT 37(20) text-102 FOR FIELD SUBfile.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK box WITH FRAME.
SELECTION-SCREEN: COMMENT /2(40) text-011, COMMENT 42(40) text-001,
ULINE,
COMMENT /2(40) text-012, COMMENT 42(40) text-002,
COMMENT /2(40) text-013, COMMENT 42(40) text-003,
COMMENT /2(40) text-014, COMMENT 42(40) text-004,
COMMENT /2(40) text-015, COMMENT 42(40) text-005,
COMMENT /2(40) text-016, COMMENT 42(40) text-006,
COMMENT /2(40) text-017, COMMENT 42(40) text-007,
COMMENT /2(40) text-018, COMMENT 42(40) text-008,
COMMENT /42(40) text-009.
SELECTION-SCREEN END OF BLOCK box.
* -- AT SELECTION SCREEN ON
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pcfile.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = space
def_path = 'C:\'
mask = ',*.txt,*.TXT.'
mode = 'O'
title = ' '
IMPORTING
filename = pcfile
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
*-----------------------------start--------------------------------
START-OF-SELECTION.
CLEAR: read_cnt, update_cnt, error_cnt.
REFRESH gt_zgcs_foc. CLEAR gs_zgcs_foc.
PERFORM file_upload_from_pc.
SORT gt_zgcs_foc.
DELETE ADJACENT DUPLICATES FROM gt_zgcs_foc
COMPARING COMPANY CUSTOMER PART_CODE REF_NO REF_DATE.
*// customer code check
DATA: LT_ZESTD LIKE ZESTD OCCURS 0 WITH HEADER LINE.
IF NOT gt_zgcs_foc[] IS INITIAL.
SELECT COMPANY CUSTOMER CURRENCY
INTO CORRESPONDING FIELDS OF TABLE LT_ZESTD
FROM ZESTD
FOR ALL ENTRIES IN gt_zgcs_foc
WHERE COMPANY = gt_zgcs_foc-COMPANY
AND CUSTOMER = gt_zgcs_foc-CUSTOMER.
ENDIF.
SORT LT_ZESTD BY COMPANY CUSTOMER.
*// part code check
DATA: LT_MARA LIKE MARA OCCURS 0 WITH HEADER LINE.
IF NOT gt_zgcs_foc[] IS INITIAL.
SELECT *
INTO TABLE LT_MARA
FROM MARA
FOR ALL ENTRIES IN gt_zgcs_foc
WHERE MATNR = gt_zgcs_foc-PART_CODE.
ENDIF.
SORT LT_MARA BY MATNR.
LOOP AT gt_zgcs_foc.
*// customer code check
READ TABLE LT_ZESTD WITH KEY
COMPANY = gt_zgcs_foc-COMPANY
CUSTOMER = gt_zgcs_foc-CUSTOMER.
IF SY-SUBRC <> 0.
WRITE:/'Invalid Customer code ',
gt_zgcs_foc-COMPANY, ' ',
gt_zgcs_foc-CUSTOMER.
STOP.
ENDIF.
*// part code check
READ TABLE LT_MARA WITH KEY MATNR = gt_zgcs_foc-PART_CODE
BINARY SEARCH.
IF SY-SUBRC <> 0.
WRITE:/ 'Invalid part code ', gt_zgcs_foc-PART_CODE.
STOP.
ENDIF.
*// REF_NO
TRANSLATE gt_zgcs_foc-REF_NO TO UPPER CASE.
SHIFT gt_zgcs_foc-REF_NO LEFT DELETING LEADING SPACE.
IF gt_zgcs_foc-REF_NO = SPACE.
WRITE:/'Ref No. is blank'.
STOP.
ENDIF.
*// REF_DATE
IF gt_zgcs_foc-REF_DATE = 0.
WRITE:/'Invalid Ref Date'.
STOP.
ENDIF.
*// QTY
* IF gt_zgcs_foc-QTY CO ' 0123456789'.
* ELSE.
* WRITE:/ gt_zgcs_foc-QTY, ' Invalid Qty value'.
* STOP.
* ENDIF.
ENDLOOP.
* Insert/Update table
* MODIFY zgcs_foc FROM TABLE gt_zgcs_foc.
INSERT zgcs_foc FROM TABLE gt_zgcs_foc.
IF sy-subrc EQ 0.
COMMIT WORK.
DESCRIBE TABLE gt_zgcs_foc LINES update_cnt.
error_cnt = read_cnt - update_cnt.
ELSE.
ROLLBACK WORK.
error_cnt = read_cnt - update_cnt.
ENDIF.
ULINE.
FORMAT COLOR 3.
WRITE: / 'Read count :', read_cnt.
WRITE: / 'Insert/Update count :', update_cnt.
WRITE: / 'Error count :', error_cnt.
FORMAT COLOR OFF.
*end-of-selection--------------------------------------------------
END-OF-SELECTION.
*& Form FILE_UPLOAD_FROM_PC
FORM file_upload_from_pc.
IF pcfile IS INITIAL.
WRITE: / 'SELECT UPLOAD FILE !'.
ELSE.
MOVE pcfile TO v_file.
* HQ file upload
IF HQfile EQ 'X'.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = v_file
filetype = 'DAT'
TABLES
data_tab = FOC_inrec
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
WRITE: / 'FILE UPLOAD :', sy-subrc.
ENDIF.
LOOP AT FOC_inrec.
ADD 1 TO read_cnt.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = FOC_inrec-customer
importing
output = FOC_inrec-customer.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = FOC_inrec-part_code
importing
output = FOC_inrec-part_code.
MOVE-CORRESPONDING FOC_inrec TO gs_zgcs_foc.
MOVE p_comp TO gs_zgcs_foc-company.
MOVE gs_zgcs_foc-qty TO gs_zgcs_foc-balan.
MOVE sy-uname TO gs_zgcs_foc-ERNAM.
MOVE sy-datum TO gs_zgcs_foc-ERDAT.
MOVE sy-UZEIT TO gs_zgcs_foc-ERZET.
* Source(1:HQ,2:SUB,0:Etc)
MOVE '1' TO gs_zgcs_foc-source.
APPEND gs_zgcs_foc TO gt_zgcs_foc.
ENDLOOP.
* SGE file upload
ELSE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = v_file
filetype = 'DAT'
TABLES
data_tab = inrec
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
WRITE: / 'FILE UPLOAD :', sy-subrc.
ENDIF.
LOOP AT inrec.
ADD 1 TO read_cnt.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = inrec-customer
importing
output = inrec-customer.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = FOC_inrec-part_code
importing
output = FOC_inrec-part_code.
MOVE-CORRESPONDING inrec TO gs_zgcs_foc.
MOVE p_comp TO gs_zgcs_foc-company.
MOVE gs_zgcs_foc-qty TO gs_zgcs_foc-balan.
MOVE sy-uname TO gs_zgcs_foc-ERNAM.
MOVE sy-datum TO gs_zgcs_foc-ERDAT.
MOVE sy-UZEIT TO gs_zgcs_foc-ERZET.
* Source(1:HQ,2:SUB,0:Etc)
MOVE '2' TO gs_zgcs_foc-source.
APPEND gs_zgcs_foc TO gt_zgcs_foc.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM.
*MODULE POOL::*
*& Module Name : Warranty Bill
*& Sub-Module : W/B
*& Description : Parts Q'ty Adjust(Sales & Warranty)
*& Program Name : ZRSWBP004
*& History
*& Date Author Reason
*& 2007.05.08 Song, Ji-Hyun Initial Coding Req.by WH.Song
*& Logic Process
* - CONDITIONS
* Company, Customer, Material
* - PROCESS
* Display,Insert,Update data in the T/B ZESP04
REPORT zrswbp004 NO STANDARD PAGE HEADING
MESSAGE-ID 00
LINE-SIZE 250
LINE-COUNT 50.
* G L O B A L V A R I A B L E S *
TABLES : zesp04.
DATA : BEGIN OF itab_list OCCURS 0,
company LIKE zesp04-company,
customer LIKE zesp04-customer,
material LIKE zesp04-material,
adj_date LIKE zesp04-adj_date,
adjust LIKE zesp04-adjust,
reason LIKE zesp04-reason,
reason_code LIKE zesp04-reason_code,
doc_no LIKE zesp04-doc_no,
in_date LIKE zesp04-in_date,
create_id LIKE zesp04-create_id,
END OF itab_list.
DATA : itab_upload LIKE TABLE OF zesp04 WITH HEADER LINE.
DATA : s_mode(10).
DATA : table_name(10) VALUE 'ZESP04'.
DATA : tot_cnt TYPE i.
DATA : ref_flag(1).
* M A C R O D E F I N E *
DEFINE conversion_kunnr.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = &1
importing
output = &1.
END-OF-DEFINITION.
DEFINE conversion_material.
call function 'CONVERSION_EXIT_MATN1_INPUT'
exporting
input = &1
importing
output = &1.
END-OF-DEFINITION.
* S E L E C T I O N S C R E E N *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE title1.
PARAMETERS : company LIKE zesp04-company MEMORY ID buk MODIF ID v1
OBLIGATORY.
SELECT-OPTIONS : customer FOR zesp04-customer MEMORY ID kun
MODIF ID v1.
SELECT-OPTIONS : material FOR zesp04-material MEMORY ID mat
MODIF ID v1.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 3.
SELECTION-SCREEN COMMENT 3(12) text-002 MODIF ID v2.
PARAMETERS : up_flag AS CHECKBOX MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(12) text-001 MODIF ID v2.
PARAMETERS : p_fname(300) LOWER CASE MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE title2.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(53) text-003 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(10) text-004 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(12) text-005 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(12) text-006 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(15) text-007 MODIF ID v2.
PARAMETERS : df1 TYPE c RADIOBUTTON GROUP grp1.
SELECTION-SCREEN COMMENT 24(13) text-012 MODIF ID v2.
PARAMETERS : df2 TYPE c RADIOBUTTON GROUP grp1.
SELECTION-SCREEN COMMENT 41(11) text-013 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(14) text-008 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(11) text-009 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(14) text-010 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(10) text-011 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b2.
INCLUDE zrswbp004_pbo.
INCLUDE zrswbp004_pai.
INITIALIZATION.
title1 = ' Parts Quantity Adjustment '.
title2 = ' Text File Layout '.
* S T A R T O F S E L E C T I O N *
TOP-OF-PAGE.
PERFORM write_header.
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM write_header.
START-OF-SELECTION.
IF up_flag = 'X'.
PERFORM upload_data.
ELSE.
PERFORM select_data.
SET PF-STATUS 'PF01' EXCLUDING 'SAVE'.
PERFORM display_data.
ENDIF.
AT USER-COMMAND.
PERFORM user_command.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
PERFORM get_filename.
*& Form SELECT_DATA
* Select Data for Display
FORM select_data.
SELECT * FROM (table_name)
INTO CORRESPONDING FIELDS OF TABLE itab_list
WHERE company = company
AND customer IN customer
AND material IN material.
CHECK sy-subrc <> 0.
WRITE: 'No data found with your option.'.
ENDFORM. " SELECT_DATA
*& Form DISPLAY_DATA
* Display Data following Condition
FORM display_data.
LOOP AT itab_list.
FORMAT COLOR 2 INTENSIFIED.
WRITE : / '|' NO-GAP.
WRITE : (07) itab_list-company CENTERED NO-GAP, '|' NO-GAP,
(10) itab_list-customer CENTERED NO-GAP, '|' NO-GAP,
(20) itab_list-material CENTERED NO-GAP, '|' NO-GAP,
(10) itab_list-adj_date CENTERED NO-GAP, '|' NO-GAP,
(15) itab_list-adjust RIGHT-JUSTIFIED NO-GAP, '|'
NO-GAP,
(55) itab_list-reason LEFT-JUSTIFIED NO-GAP, '|' NO-GAP,
(11) itab_list-reason_code CENTERED NO-GAP, '|' NO-GAP,
(10) itab_list-doc_no CENTERED NO-GAP, '|' NO-GAP,
(10) itab_list-in_date CENTERED NO-GAP, '|' NO-GAP,
(12) itab_list-create_id CENTERED NO-GAP, '|' NO-GAP.
FORMAT INTENSIFIED OFF.
HIDE itab_list.
ENDLOOP.
WRITE : / sy-uline(171).
ENDFORM. " DISPLAY_DATA
*& Form WRITE_HEADER
* Write Report Header
FORM write_header.
DATA : line(1024).
CLEAR line WITH '-'.
DESCRIBE TABLE itab_list LINES tot_cnt.
FORMAT INTENSIFIED ON.
WRITE : 15 'Parts Quantity Adjustment'.
SKIP.
WRITE : / 'Total Count : ', tot_cnt.
WRITE : /.
WRITE : (171) sy-uline.
WRITE : / '|' NO-GAP.
WRITE : (07) 'Company' CENTERED NO-GAP, '|' NO-GAP,
(10) 'Customer' CENTERED NO-GAP, '|' NO-GAP,
(20) 'Material' CENTERED NO-GAP, '|' NO-GAP,
(10) 'Adj. Date' CENTERED NO-GAP, '|' NO-GAP,
(15) 'Adjust' CENTERED NO-GAP, '|' NO-GAP,
(55) 'Reason' CENTERED NO-GAP, '|' NO-GAP,
(11) 'Reason Code' CENTERED NO-GAP, '|' NO-GAP,
(10) 'Doc No' CENTERED NO-GAP, '|' NO-GAP,
(10) 'IN DATE' CENTERED NO-GAP, '|' NO-GAP,
(12) 'CREATE ID' CENTERED NO-GAP, '|' NO-GAP.
WRITE : /(171) sy-uline.
FORMAT INTENSIFIED OFF.
ENDFORM. " WRITE_HEADER
*& Form UPLOAD_DATA
* Data Upload from File
FORM upload_data.
DATA : l_filename LIKE rlgrap-filename,
temp_dateformat TYPE dateformat.
IF df1 = 'X'.
temp_dateformat = 'YYYY.MM.DD'.
ELSE.
temp_dateformat = 'DD.MM.YYYY'.
ENDIF.
MOVE p_fname TO l_filename.
CHECK l_filename NE space.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = l_filename
filetype = 'DAT'
dat_d_format = temp_dateformat
TABLES
data_tab = itab_list
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9.
IF sy-subrc NE 0.
MESSAGE s000 WITH 'File upload is failed!'.
STOP.
ELSE.
CLEAR : itab_upload, itab_upload[].
LOOP AT itab_list.
MOVE-CORRESPONDING itab_list TO itab_upload.
conversion_kunnr itab_upload-customer.
conversion_material itab_upload-material.
itab_upload-mandt = sy-mandt.
itab_upload-in_date = sy-datum.
itab_upload-create_id = sy-uname.
*>>>>Insert by GSCHOI 2007.11.08
IF itab_list-adj_date+0(6) NE sy-datum+0(6).
MESSAGE i368 WITH 'Adjust month must same as current month!'.
ROLLBACK WORK.
STOP.
ENDIF.
*<<<<End
APPEND itab_upload.
INSERT INTO (table_name) VALUES itab_upload.
IF sy-subrc EQ 0.
CONTINUE.
ELSEIF sy-subrc EQ 4.
MESSAGE s368 WITH 'Duplicated Data Error!'.
ROLLBACK WORK.
STOP.
ELSE.
MESSAGE s368 WITH 'File Error!'.
ROLLBACK WORK.
STOP.
ENDIF.
ENDLOOP.
ENDIF.
IF sy-subrc EQ 0.
MESSAGE s368 WITH 'Uploaded Successfully!'.
ENDIF.
ENDFORM. " UPLOAD_DATA
*& Form USER_COMMAND
* User Command Execution in Screen 1000
FORM user_command.
MOVE-CORRESPONDING itab_list TO zesp04.
CASE sy-ucomm.
WHEN 'INSERT'.
PERFORM insert_item.
WHEN 'UPDATE'.
PERFORM update_item.
WHEN 'DISPLAY'.
PERFORM display_item.
WHEN 'REFRESH'.
PERFORM refresh_list.
ENDCASE.
IF ref_flag = 'Y'.
PERFORM refresh_list.
CLEAR ref_flag.
ENDIF.
ENDFORM. " USER_COMMAND
*& Form INSERT_ITEM
* When Clicking Insert Button
FORM insert_item.
CLEAR : s_mode.
CLEAR : zesp04.
s_mode = 'INSERT'.
CALL SCREEN '100'.
ENDFORM. " INSERT_ITEM
*& Form UPDATE_ITEM
* When Clicking Update Button
FORM update_item.
CLEAR : s_mode.
s_mode = 'UPDATE'.
CALL SCREEN '100'.
ENDFORM. " UPDATE_ITEM
*& Form DISPLAY_ITEM
* When Clicking Display Button
FORM display_item.
CLEAR : s_mode.
s_mode = 'DISPLAY'.
CALL SCREEN '100'.
ENDFORM. " DISPLAY_ITEM
*& Form REFRESH_LIST
* When Clicking Refresh Button or Returning Display Screen
FORM refresh_list.
CLEAR : itab_list, itab_list[].
PERFORM select_data.
sy-lsind = sy-lsind - 1.
PERFORM display_data.
ENDFORM. " REFRESH_LIST
*& Form GET_FILENAME
* Get Filename
FORM get_filename.
DATA: l_fname LIKE ibipparms-path .
DATA : p_name LIKE sy-repid.
p_name = sy-repid.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = p_name
dynpro_number = sy-dynnr
field_name = ''
IMPORTING
file_name = l_fname.
p_fname = l_fname.
ENDFORM. " GET_FILENAME
Edited by: Matt on Nov 24, 2008 11:24 AM - surrounded the ABAP with tagsHi,
Use SUBMIT statement in your first Report zrswbgcs009 at the end, to call the Modulepool program zrswbp004.
do a search in SDN you will get lot of threads on SUBMIT statement with selection screen.
SUBMIT... [VIA SELECTION-SCREEN]
[USING SELECTION-SET <var>]
[WITH <sel> <criterion>]
[WITH FREE SELECTIONS <freesel>]
[WITH SELECTION-TABLE <rspar>].
http://help.sap.com/saphelp_nw04/Helpdata/EN/9f/dba51a35c111d1829f0000e829fbfe/content.htm
Regards
Bala Krishna -
How to use SET & GET Parameters in Module Pool
Hi Friends,
Can anyone please tell how to use SET / GET parameters and PARAMETER ID for a text box (Input / Output field ) in module pool? What is the purpose and where do we need to do coding for it?
Note : I will definitely give the marks for good responses.
Thanks in advance,
PradeepHi Pradeep,
You can save values in the SAP memory using a parameter ID. These
are user and terminal-session specific, but available to all internal and
external sessions.
SET Parameter copies the corresponding field contents into the SAP
System memory in the PAI processing block.
GET Parameter copies the corresponding field contents from the SAP
memory at the end of the PBO processing block, after data has been
transferred from the program, if the screen field still has its initial value
You can link an input/output field to an area of the SAP memory in the
ABAP Dictionary.
When you use an input/output field that is defined in the ABAP
Dictionary, its parameter ID is displayed in the Dictionary attribute
Parameter ID in the Screen Painter.
Usage
SET PARAMETER ID: CAR FIELD space,
CON FIELD space,
DAY FIELD space.
Here is the link that explains the usage of GET/SET in detail
<a href="http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db9e0435c111d1829f0000e829fbfe/content.htm">http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db9e0435c111d1829f0000e829fbfe/content.htm</a>
Regards,
Sharadha -
Assigning 2 fields of same table in Module pool screen
Hi,
I want to assign similar fields of table in module pool screen.
In one case i directly use the tablename-fieldname and in other case when i try doing the same i get error. I know that this is not possible.
Is there any way to get around this. The field i am referring to is attached to a custom domain which is having defined fields. In the second assignment i need to retreive the values of the domain and display it in dropdown mode so that the users are able to select it.
Regards,
ImranThe domain only attached with this field?check the same domain attached to any other field and insert that field in the screen.
shibu
reward if helpful -
How to change the logon language in module pool program?
Hello All,
I had created a module pool program and had desiged a screen.
When i am logged in English language i am able to see them in english as per the requirement it is working fine.
But the requirement is wen i am logged in DE then the selection-screen texts should show in English and not in German.
Kindly give me a solution for this.
Thanks & Regards,
Rajesh KumarHi Rajesh,
This problem is because you have maintained a standard dictionary fields on selection screen and all the standard dictionary fields are maintained in DE language, on the screen layout, go to the attributes of that particular text field, there is a option MODIFIZ for dictionary fields (it is a drop down), selection F TEXT, now whatever the text u will define, it will remain same for all the languages, once u do this then u again login in DE,l u will see the text maintained by u and not the DE text.
Do reply if problem still persist.
point if useful.
Rohit G
Edited by: Rohit Gaharwar on Aug 11, 2009 1:24 PM
Edited by: Rohit Gaharwar on Aug 11, 2009 1:30 PM
Edited by: Rohit Gaharwar on Aug 11, 2009 1:36 PM
Edited by: Rohit Gaharwar on Aug 11, 2009 1:36 PM
Edited by: Rohit Gaharwar on Aug 11, 2009 1:37 PM
Edited by: Rohit Gaharwar on Aug 11, 2009 1:38 PM -
How to have a search help in module pool without using Process on value req
Can someone please tell me what r the ways if any to have F4 help in the module pool screen
with out using POV ?Hi,
They are two ways to define search help for an object...
BY using POV
or
go to screen Layout and double click on the field you want F4 help and Pass the Search help math code for feild at the
place of Search_help field aand also you can add parameter-id at this place to provide search help.
go to screen Layout -->double click on the field you want F4 help
-->Pass the Search help math code for feild at the place of Search_help
save and activate..
reagrds,
Prabhudas
Maybe you are looking for
-
Vendor Name not appearing in NWDS
Hi, We have successfully installed and made necessary post-installation steps, configurations in our NWDI system. Product, software unit, Software component were created in the SLD and Name Prefixes were also defined. I have also created users for de
-
How to delete server side cookie
Hy ppl. i would like to know how i can get rid of server side cookies which date is in the past? I've trie it with call method cl_bsp_server_side_cookie=>DELETE_SERVER_COOKIE but the there was no result
-
Hi, I want to archive around 10 tables for the past 30 days. i have used the following code to archive for one table. * Internal table to store the records that was retrieved DATA : BEGIN OF GET_TAB OCCURS 1000. INCLUDE STRUCTURE ZFIT0056.
-
Hi !!! i have a problem with the standard transacction VA01. i need to get the data from the structure RV45A to obtain the field MATNR in the userexit FV45K001(CALL FUNCTION 'EXIT_SAPFV45K_001', include program ZXVVAU03), all this in run time. To get
-
Photosmart 7525 All-in-One Printer
I recently bought one Photosmart 7525 All-in-One Printer and everything seems to be well connected and I have the test pass report a couple of times but the printer does not get connected to the incoming fax calls and the the fax is on call and is su