Академический Документы
Профессиональный Документы
Культура Документы
SAP stands for Systeme, Anwendungen, Produkte in der Datenverarbeitung or in english '
Systems, Applications, and Products in Data Processing'.
SAP is the leading Enterprise Information and Management Package worldwide. Use of this
package makes it possible to track and manage, in real-time, sales, production, finance
accounting and human resources in an enterprise.
SAP is the third-largest software company in the world. Founded in 1972, The company now
employs more than 22,000 people in more than 50 countries. SAP global headquarters are
located in Walldorf, Germany, and the company is listed on several stock exchanges, including
the Frankfurt DAX and the New York Stock Exchange, under the symbol "SAP."
SAP America is a subsidiary of SAP AG, the recognized leader in providing collaborative, interenterprise software and e-business solutions. A truly global software provider, SAP AG has more
than 1000 partners, 22 industry solutions and 10 million users at 30,000 installations around the
world. SAP America has contributed significantly to this leadership position, and it is the foremost
provider of e-business and enterprise software in the United States.
Flexibility
Enterprise-Wide Integration
Enterprise-wide integration is the main functionality of SAP R/3 System. No other application
software offers the breadth of open systems, client/server functionality, functional links between
processes that multiply the power of each person's work. The R/3 System's components are fully
integrated. Once you enter data, it resides in the central database shared by all R/3 components.
Transaction-related process chains trigger the next activity as needed from engineering to
production planning to sales and distribution. The R/3 System's full integration pulls your
enterprise together, promoting data access, flexibility, and productivity.
Real-Time Information
SAP provides up-to-the-minute, real-time information.
Architecture
SAP R/3 system is based on Client/Server architecture that is comprised of three tiers:
Presentation server: Your local PC that has SAPGUI.
Application server: The application server is used to run the business application programs in
the R/3 client/server concept. The application modules are loaded from the data base server to
the application server as required. Thus the application server requires only storage capacity to
accommodate UNIX, Swapping and the SAP runtime environment.
Database server: The data base server stores the SAP application programs and data in the R/3
client/server concept. It also handles the SAP update program and batch jobs.
SAP Application Modules
SAP has several layers. The Basis System is the heart of the data operations and should be not
evident to higher level or managerial users. Other customizing and implementation tools exist
also. The heart of the system from a managers viewpoint is the application modules. These
modules may not all be implemented in a typical company but they are all related and are listed
below:
FI
CO
AM
PS
Financial Accounting
Controlling
Asset Management
Project System
WF
Workflow
IS
Industry Solutions
HR
Human Resources
PM
PlantMaintenance
MM
Materials Management
QM
Quality Management
PP
Production Planning
SD
Sales and Distribution
Financial Accounting -- is designed for automated management and external reporting of
general ledger, accounts receivable, accounts payable and other sub-ledger accounts with a
user defined chart of accounts. As entries are made relating to sales production and payments
journal entries are automatically posted. This connection means that the "books" are designed
to reflect the real situation.
Controlling -- represents the company's flow of cost and revenue. It is a management
instrument for organizational decisions. It too is automatically updated as events occur.
Asset Management--is designed to manage and supervise individual aspects of fixed assets
including purchase and sale of assets, depreciation and investment management.
Project System -- is designed to support the planning, control and monitoring of long-term,
highly complex projects with defined goals.
Workflow -- links the integrated SAP application modules with cross-application technologies,
tools and services
Industry Solutions -- combines the SAP application modules and additional industry-specific
functionality. Special techniques have been developed for industries such as banking, oil and
gas, pharmaceuticals, etc.
Human Resources -- is a complete integrated system for supporting the planning and control
of personnel activities.
Plant Maintenance--In a complex manufacturing process maintenance means more than
sweeping the floors. Equipment must be services and rebuilt. These tasks affect the production
plans.
Materials Management--supports the procurement and inventory functions occurring in dayto-day business operations such as purchasing, inventory management, reorder point
processing, etc.
Quality Management--is a quality control and information system supporting quality planning,
inspection, and control for manufacturing and procurement.
Production Planning--is used to plan and control the manufacturing activities of a company.
This module includes; bills of material, routings, work centers, sales and operations planning,
master production scheduling, material requirements planning, shop floor control, production
orders, product costing, etc
Sales and Distribution--helps to optimize all the tasks and activities carried out in sales,
delivery and billing. Key elements are; pre-sales support, inquiry processing, quotation
processing, sales order processing, delivery processing, billing and sales information system.
Hardware Partners
Since there are so many different platforms available in today's market, compatibility between
SAP and the customer's platform, Hardware partners play a very important role. Hardware
partners are leading hardware vendors who provide the computing hardware necessary to meet a
customer's system requirements. Working with both SAP and customers, hardware partners
continually develop and optimize products to meet the running business applications with SAP
software. Hardware partners have developed organizations to provide strong SAP support, from
product selection to system set-up, installation and ongoing performance tuning.
Some of the hardware partners are Amdahl, IBM, Bull, NCR, Compaq, NEC, Data General,
Sequent, Dell, Tandem, Digital, Siemens Nixdorf, Fujitsu, Sun, Hewlett-Packard, Sun, Unisys,
Hitachi and Intergraph.
SAP Glossary
GUI (Graphic User Interface)
A graphical interface used by SAP environment as part of the three tiers. Also known as frontend.
IMG (Implementation Management Guide)
It is a hierarchical structure that reflects the R/3 component hierarchy and contains every
configuration activity. Released from version 3.0 onwards.
Instance
It means application server and each one has its own set of work processes.
SysID
A set of three letters or number that identify a system. Some sets are not allowed because they
are used by SAP. They are informed when the system is installed.
Legal Data As used in this document, this refers to the requirements imposed by the IRS,
State tax authorities and other tax authorities for the long-term retention of business data to
support taxes paid and other legal requirements.
Operational Data As used in this document, this refers to the requests from customers,
vendors or employees for business data.
Management Data As used in this document, this refers to data that is used by
management for business decisions.
ABAP / 4
What is ABAP/4?
Advanced Business Application Programming.ABAP is SAP's fourth generation language. All of R/3's
applications and even parts of its basic system are developed in ABAP. ABAP is used for customization and
modification of SAP applications.
Tools for Abapers.
Transactions (Development and Workbench)
ABAP Keywords
ABAP System fields (Structure SYST)
ABAP Sample Report
ABAP Transactions
SAP 3.0d
Useful Dev. and Workbench Transactions
SQ00
SQ01
SQ02
SQ03
SQ07
ABAP/4
ABAP/4
ABAP/4
ABAP/4
ABAP/4
Query:
Query:
Query:
Query:
Query:
Start Queries
Maintain Queries
Maintain Funct. Areas
Maintain User Groups
Language Comparison
ABAP/4 Keywords
Keywords
, [, ], {, }
*, "
**
+, -, *, /
->, =>, ->>, ~, ?=
ABS
ACOS
ADD
ADD-CORRESPONDING
ADJACENT DUPLICATES
AND
ANY TABLE
APPEND
ASIN
ASSIGN
AT
ATAN
AUTHORITY-CHECK
AVG
BACK
BETWEEN
BINARY SEARCH
BIT-NOT
BIT-AND
BIT-OR
BIT-XOR
SET BIT
GET BIT
BLANK LINES
BREAK-POINT
C
CA
CALL
CASE
CATCH
CEIL
CENTERED
CHECK
CHECKBOX
PARAMETERS ... AS CHECKBOX
WRITE ... AS CHECKBOX
CLASS
CLASS-DATA
CLASS-METHODS
CLASS-EVENTS
CLASS-POOL
CLEAR
Description
Syntax conventions, Syntax notation
Comments
Arithm. Operator: Exponentiation
(COMPUTE)
Arithmetical operators (COMPUTE)
Operators in ABAP Objects
Mathematical function: Absolute amount
COMPUTE)
Mathematical function: Cosine arc
(COMPUTE)
Add
Field string addition
Delete duplicates from internal table
(DELETE)
Comparison operator: and
Generic table type for internal tables
Append line to internaltable
Mathematical function: Sine arc (COMPUTE)
Assign field symbol
Event, control break, field group
determination
Mathematical function: Tangent arc
Check authorization
Aggregate expression: Average (SELECT)
Positioning in list
Relational operator: Between
Binary read of internaltable (READ TABLE)
Bit calculation operator: NOT (COMPUTE)
Bit calculation operator: AND (COMPUTE)
Bit calculation operator: OR (COMPUTE)
Bit calculation operator: AND/OR
(COMPUTE)
Set bit of an X field
Read bit of an X field
Switch on blank lines in list
Stop processing in debug mode
Data type for fixed-length character string
Contains any characters -Relational operator
forstring comparison
Call external component
Begin case distinction
Exception handling (catch runtime errors)
Mathematical function: Smallest whole value
Output format: Centered(WRITE)
Check condition
Display as checkbox
on the selection screen
in a list
Definition of a class
Static attributes in classes
Static methods in classes
Static events in classes
Introduction for type Kprograms
Initialize data object
APPLI
SAP applications
BATCH
BATZD
BATZM
BATZO
BATZS
BATZW
BINPT
BREP4
BSPLD
CALLD
CALLR
CCURS
CCURT
CDATE
COLNO
CPAGE
CPROG
CTABL
CTYPE
CUCOL
CUROW
DATAR
DATLO
DATUM
System: Date
DATUT
DAYST
DBCNT
DBNAM
DBSYS
DCSYS
DSNAM
DYNGR
DYNNR
FDAYW
FDPOS
Location of a string
FMKEY
HOST
Host
INDEX
LANGU
LDBPG
LILLI
LINCT
LINNO
LINSZ
LISEL
LISTI
LOCDB
LOCOP
LOOPC
LSIND
LSTAT
MACDB
MACOL
MANDT
MARKY
MAROW
MODNO
MSGID
Message ID
MSGLI
MSGNO
Message number
MSGTY
MSGV1
Message variable
MSGV2
Message variable
MSGV3
Message variable
MSGV4
Message variable
OPSYS
PAART
Print: Format
PAGCT
PAGNO
PDEST
PEXPI
PFKEY
PLIST
PRABT
PRBIG
PRCOP
PRDSN
PREFX
PRIMM
PRNEW
PRREC
Print: Recipient
PRREL
PRTXT
REPID
RTITL
SAPRL
SCOLS
Columns on screen
SLSET
SPONO
SPONR
SROWS
STACO
STARO
STEPL
SUBRC
SUBTY
SYSID
TABIX
TCODE
TFDSN
TFILL
TIMLO
TIMUT
TITLE
TLENG
TMAXL
TNAME
TOCCU
TPAGI
TSTLO
TSTUT
TTABC
TTABI
TVAR0
TVAR1
OSS1
OY19
Compare Tables
S001
S002
System Administration.
SA38
Execute a program.
SCAT
SCU0
Compare Tables
SE01
SE09
Workbench Organizer
SE10
Customizing Organizer
SE10
SE11
SE11
ABAP/4 Dictionary.
SE12
SE13
SE14
SE14
SE15
SE15
SE16
Data Browser
SE16
SE16
SE17
SE30
SE30
Reporting
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
1.
2.
3.
4.
ABAP/4 General
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
How do I send mail to a user(s) from an ABAP/4 program without using SAP Office?
How do I capture the screen sequence and values of a transaction for data transfer?
How do I copy and paste from one session to another?
How do I register a function module as RFC enabled?
One of my custom table has more than million records and I need to access only few
thousand. When I do SELECT * from Ztable WHERE code like P%, I get short dump
because the system reads the entire Ztable to specifically select the once I require.
Meanwhile the system gets time out eventually giving a short dump. How do I handle this
scenerio.
I am editing a program and get logged out by the system. The next time I login and try to
edit the same program, I get a message you are already editing this program. How can I
cancel the session which is still active before I got logged out.
What are the various ways UPDATE table will update all the records instead of one
record.
How do I download text elements of a report program?
How do you write an ABAP program to find out menu path for a particualar transaction
screen.
How can you view the entire program which will also expand all includes, function
modules, subroutines & subprograms.
How do I change value of a field in debug mode?
SAP General
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
How do I get back to SAP screens I was working on if SAP was terminated?
How do I assign a CTS number to a local private object ($TMP)?
How do I view an ABAP dump happened in the SAP system?
How do I set my user information in SAP?
How do I reset my password?
How do I kill a long running job in SAP?
How do I compare two tables between two systems?
How do I compare two versions of program?
How do I find the program name if I know the transaction code?
How do I find user exit in a standard SAP program for me to include enhancement.
I added new entries to an existing table and assigned the changes to a transport number.
If I want to transport the entire table (definition and data), what are the steps involved.
12. How do I list files residing on a Unix directory?
13. How do I view SAP settings?
Reporting
How do I add a pushbutton on the application toolbar of report selection screen?
Add the following code in appropriate events mentioned to display one button with label
'my_button' (You could have up to 5 buttons on the selection screen). Upon pressing the button,
form 'f_my_button' get executed.
tables sscrfields.
step 2:
Add the following code in approprate sections/events:
tables sscrfields.
1. Click on the area and press CTRL+Y. Using your mouse highlite the are and press
CTRL+C. Go do desired targer location; insert necessary number of blank lines and
press CTRL+V to paste.
2. Use xx to mark and copy. Use x to paste......
How do I register a function module as RFC enabled?
In the function module Administration screen (transaction code SE37), set the field REMOTE
CALL.
Reporting
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
1.
2.
3.
4.
ABAP/4 General
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
How do I send mail to a user(s) from an ABAP/4 program without using SAP Office?
How do I capture the screen sequence and values of a transaction for data transfer?
How do I copy and paste from one session to another?
How do I register a function module as RFC enabled?
One of my custom table has more than million records and I need to access only few
thousand. When I do SELECT * from Ztable WHERE code like P%, I get short dump
because the system reads the entire Ztable to specifically select the once I require.
Meanwhile the system gets time out eventually giving a short dump. How do I handle this
scenerio.
I am editing a program and get logged out by the system. The next time I login and try to
edit the same program, I get a message you are already editing this program. How can I
cancel the session which is still active before I got logged out.
What are the various ways UPDATE table will update all the records instead of one
record.
How do I download text elements of a report program?
How do you write an ABAP program to find out menu path for a particualar transaction
screen.
How can you view the entire program which will also expand all includes, function
modules, subroutines & subprograms.
How do I change value of a field in debug mode?
SAP General
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
How do I get back to SAP screens I was working on if SAP was terminated?
How do I assign a CTS number to a local private object ($TMP)?
How do I view an ABAP dump happened in the SAP system?
How do I set my user information in SAP?
How do I reset my password?
How do I kill a long running job in SAP?
How do I compare two tables between two systems?
How do I compare two versions of program?
How do I find the program name if I know the transaction code?
How do I find user exit in a standard SAP program for me to include enhancement.
I added new entries to an existing table and assigned the changes to a transport number.
If I want to transport the entire table (definition and data), what are the steps involved.
12. How do I list files residing on a Unix directory?
13. How do I view SAP settings?
Reporting
How do I add a pushbutton on the application toolbar of report selection screen?
Add the following code in appropriate events mentioned to display one button with label
'my_button' (You could have up to 5 buttons on the selection screen). Upon pressing the button,
form 'f_my_button' get executed.
tables sscrfields.
initialization.
* Populating button text
move 'my_button' to sscrfields-functxt_01.
at selection-screen.
if sscrfields-ucomm = 'FC01'.
perform f_my_button.
How do I indicate progress while executing a program?
use function 'PROGRESS_INDICATOR'
How do I pop-up my own selection values for a select-option/parameters?
- Help View
- code example
How do I let user display program documentation while on a selection screen?
step 1:
Create program documentation using the Documentation option on the SE38 screen.
Documentation suggestions:
Description : Lists and describes processing steps done in the
program.
Precondition: Lists any input and processing that is necessary
before executing the program.
Select Options: List all the selection options and values expected
Output:
Lists any output from the program.
SAP function: List of sap functions used by the program.
Transactions called: List of sap transactions called in the program.
Programs called: Lists all programs called by the abap program.
step 2:
Add the following code in approprate sections/events:
tables sscrfields.
help_infos-title = sy-title.
call function 'HELP_START'
exporting
help_infos = help_infos
tables
dynpselect = dynpselect
dynpvaluetab = dynpvaluetab.
endform.
" F_PGM_HELP
1. Click on the area and press CTRL+Y. Using your mouse highlite the are and press
CTRL+C. Go do desired targer location; insert necessary number of blank lines and
press CTRL+V to paste.
2. Use xx to mark and copy. Use x to paste......
1.
2.
3.
4.
ABAP/4 General
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
How do I send mail to a user(s) from an ABAP/4 program without using SAP Office?
How do I capture the screen sequence and values of a transaction for data transfer?
How do I copy and paste from one session to another?
How do I register a function module as RFC enabled?
One of my custom table has more than million records and I need to access only few
thousand. When I do SELECT * from Ztable WHERE code like P%, I get short dump
because the system reads the entire Ztable to specifically select the once I require.
Meanwhile the system gets time out eventually giving a short dump. How do I handle this
scenerio.
I am editing a program and get logged out by the system. The next time I login and try to
edit the same program, I get a message you are already editing this program. How can I
cancel the session which is still active before I got logged out.
What are the various ways UPDATE table will update all the records instead of one
record.
How do I download text elements of a report program?
How do you write an ABAP program to find out menu path for a particualar transaction
screen.
How can you view the entire program which will also expand all includes, function
modules, subroutines & subprograms.
How do I change value of a field in debug mode?
SAP General
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
How do I get back to SAP screens I was working on if SAP was terminated?
How do I assign a CTS number to a local private object ($TMP)?
How do I view an ABAP dump happened in the SAP system?
How do I set my user information in SAP?
How do I reset my password?
How do I kill a long running job in SAP?
How do I compare two tables between two systems?
How do I compare two versions of program?
How do I find the program name if I know the transaction code?
How do I find user exit in a standard SAP program for me to include enhancement.
I added new entries to an existing table and assigned the changes to a transport number.
If I want to transport the entire table (definition and data), what are the steps involved.
12. How do I list files residing on a Unix directory?
13. How do I view SAP settings?
Reporting
How do I add a pushbutton on the application toolbar of report selection screen?
Add the following code in appropriate events mentioned to display one button with label
'my_button' (You could have up to 5 buttons on the selection screen). Upon pressing the button,
form 'f_my_button' get executed.
tables sscrfields.
clear help_infos.
help_infos-call
= 'D'.
help_infos-spras = sy-langu.
help_infos-docuid = 'RE'.
help_infos-report = sy-repid.
help_infos-title = sy-title.
call function 'HELP_START'
exporting
help_infos = help_infos
tables
dynpselect = dynpselect
dynpvaluetab = dynpvaluetab.
endform.
" F_PGM_HELP
1. Click on the area and press CTRL+Y. Using your mouse highlite the are and press
CTRL+C. Go do desired targer location; insert necessary number of blank lines and
press CTRL+V to paste.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
How do I get back to SAP screens I was working on if SAP was terminated?
How do I assign a CTS number to a local private object ($TMP)?
How do I view an ABAP dump happened in the SAP system?
How do I set my user information in SAP?
How do I reset my password?
How do I kill a long running job in SAP?
How do I compare two tables between two systems?
How do I compare two versions of program?
How do I find the program name if I know the transaction code?
How do I find user exit in a standard SAP program for me to include enhancement.
I added new entries to an existing table and assigned the changes to a transport number.
If I want to transport the entire table (definition and data), what are the steps involved.
12. How do I list files residing on a Unix directory?
13. How do I view SAP settings?
Reporting
How do I add a pushbutton on the application toolbar of report selection screen?
Add the following code in appropriate events mentioned to display one button with label
'my_button' (You could have up to 5 buttons on the selection screen). Upon pressing the button,
form 'f_my_button' get executed.
tables sscrfields.
endif.
endloop.
How do I get the address of a company given company code.
How do I read an EXCEL file for upload. How do I download to an EXCEL file.
How do I add a selection screen parameter to get a local file name with pull down?
parameters: p_infile like ibipparms-path default 'C:\'.
* Executes the pull-down to search C:\ drive for input file
at selection-screen on value-request for p_infile.
call function 'F4_FILENAME'
"allows user to select path/file
exporting
program_name = syst-repid
dynpro_number = syst-dynnr
field_name = 'p_infile'
importing
file_name = p_infile.
if sy-subrc ne 0.
write: / 'Error'.
endif.
How do I read a file on my C:\ drive and/or a file residing on UNIX sub-directory.
How do I print standard header and footer on all pages of a report? Do you have code for
standard header & footer function module?
How do I print selection screen values on a report?
How do I show valid month and their description as the pull-down option on a month seletion
field?
What are the various ways you can make the user execute a report program
There are flat files residing on UNIX sub-directory. How can a report program list all these files for
the user to select one of them.
How do I let user to decide the format of the report?
Dialog Programming/Table Control
How do I hide a column in a table control at runtime? (by Manoj Nair)
1. define group name(s) for the columns to be hidden
2. Add the following code...
(define)
controls tbl_ctrl type tableview ...
wa like tbl_ctrl-cols.
loop at tbl_ctrl-cols into wa.
if wa-screen-group1 = <group defined for the column>
wa-invisible = 1.
modify tbl_ctrl-cols from wa
endif
endloop
How do I change attributes of an item in a screen and in a table control at runtime?
add the following code in PBO
loop at screen.
if screen-name = 'NAME_OF_FIELD_HERE_IN_CAPS'.
set attributes of screen such as REQUIRED, INPUT, OUTPUT, INTENSIFIED, INVISIBLE,
ACTIVE, DISPLAY_3D, VALUE_HELP to 1(ON) or 0(OFF)
e.g. screen-output = 1.
modify screen.
endif.
endloop
if the field is part of a table control, put the above code within the the loop...endloop of the table
control in PBO
How do I go to a transaction by double clicking on a field in the screen?
Define ok_code for function key <F2>
In Screen PAI when ok_code has the value defined (user has double clicked on the screen)
method 1: if parameter id is available for the field(s) to be populated
set parameter id 'XXX' field field_name_on_screen
call transaction 'TCODE' and skip first screen.
method 2:
1. fill bdc_table (data bdc_table like bdcdata occurs 0 with header line.) with screen info
2. use command
call transaction 'XK03' using bdc_table ...
How do I know that user has changed something on a dialog screen?
Check sy-datar, It is 'X' when there was a change
SAP General
How do I get back to SAP screens I was working on if SAP was terminated?
When you log back in, after entering appropriate values, select User->Copy session (instead on
pressing 'Enter')
How do I assign a CTS number of a local private object ($TMP)?
Run tcode SE80
Select 'Local priv objects' and click on 'Display'.
Select the item you want to reassign and click on it
Now select Development Object->Reassign or (Ctrl + F7)
How do I view an ABAP dump happened in the SAP system?
Use path
Tools->Administration->Monitoring->Dump Analysis
How do I set my user information in SAP?
Run transaction code SU51 or (System->User profile->User address)
How do I reset my password?
You can reset your own password at anytime (but not more than once a day) if you know the
current password. Passwords must be at least 6 characters and can not contain the first letters
of your user id.
1. At the SAP R/3 logon screen enter your user-id and current password.
2. Click the New password button.
3. The SAP R/3 new password dialog box will be displayed.
4. Type the password you wish to have in the New password field.
5. Repeat typing the same password in the Repeat password field.
6. Click the Confirm button
How do I kill a long running job in SAP?
.a.Open a new SAP session.
b.In the new session, from the SAP R/3 screen, follow
the menu path:
Tools>>Administration
(new screen) Monitoring >>System monitoring>>User overview
Fastpath:
/nsm04
Result: the "Overview of Users" screen appears. This is a list of the jobs currently
running.
c.Find your username in the list and click on it
d.Click on the Sessions button .
Result: the Overview of Sessions screen appears.
e.Click on the End session button .
How do I compare two tables between two systems?
The contents of a table between two systems can be checked through the transaction OY19
How do I view SAP settings?
Use transaction code SE38
Enter Program name RSPARAM and execute
ABAP/4 General
How do I send mail to a user(s) from an ABAP/4 program without using SAP Office?
Use, So_object_send function module.
How do I capture the screen sequence and values of a transaction for data transfer?
Use transaction 'SHDB' to record any SAP transaction.
How do I copy and paste from one session to another?
1. Click on the area and press CTRL+Y. Using your mouse highlite the are and press
CTRL+C. Go do desired targer location; insert necessary number of blank lines and
press CTRL+V to paste.
2. Use xx to mark and copy. Use x to paste......
How do I register a function module as RFC enabled?
In the function module Administration screen (transaction code SE37), set the field REMOTE
CALL.
f) Copy the KEY (by highlighting and using ctrl/c for copy and ctrl/v for paste)
and email the user of his key. The ctrl/c, ctrl/v ensures that the complete key
is copied since it is a very long number.
g) Click the Cancel button when done or click the Register button to register
another developer.
h) Click the green ' ' to exit.
1.
Many steps within a job : A job can consist of many steps, each running a different
program. Each step waits for the previous step to run before it starts.
Periodic jobs: A job can be scheduled to run every minute, hour, day, month, or any
other specified time frame.
Dependent jobs: A jobs can be scheduled to wait for another job to finish before it
executes.
3.
Periodic dependent jobs: If you have a job that runs every night and another that
depends on it, the dependent job will run the first time, but not again after that.
Continuing a job that has crashed: If a job crashes on step 1, the whole job stops,
and there is no way to continue processing.
Re-running from certain job steps: If your job crashes at step 2, there is no facility to
re-run, without changing the job and removing step 1 so it does not run again.
Waiting for a Batch Input Session: If you run a job which runs RSBDCSUB, the
second step will not wait for the batch input session to process, as it is executing in a
separate job.
Suggested methods for processing
4.
5.
Information and Success messages: Write the message text to the job log. Program
and job continues as normal.
Error and Abend messages: Write the message text to the job log. Stop the current
program from running. Cancel the entire job. -> any dependent programs must be
scheduled in a different job
Suggested methods for error handling & reprocessing
If subsequent steps in a job are not dependent on the first one finishing successfully,
the first program should be set up to crash using a success message followed by the
STOP statement.
Before every error message, call a routine which notifies the Operations Center of
error type, severity, action, etc.
Batch Input is a SAP functionality that allows automating input of data via SAP transactions,
commonly known as BDC (Batch Data Commands). BDC works in the following ways:
In most companies, programs that handle Batch Input are duplicating the functions that builds
this scenario, creates the session or calls the transactions.
Therefore, create a custome Abap Object, eg. Z_BATCHINPUT. This object should have all
the needed functions and makes some basic checks (e.g. that the program is not creating two
sessions at the same time). The main advantages of using an object are :
The object class Z_BATCHINPUT should be created (and/or transported) into all target systems.
It uses basically all the datatypes available for the BDC functions. It calls the following functions :
The ABAP statement "CALL TRANSACTION" is also called to run directly a transaction
from its BDC table.
It runs the program RSBDCSUB in order to launch automatically the session. The session
management is done through the transaction code SM35.
The object itself is maintanable through the transaction SE24.
Method
Description
Opens a session
OPEN_SESSION
Closes a session
Parameters
SUBRC (Return Code 0 OK)
SESSIONNAME (Session to be created)
None
CLOSE_SESSION
RESET_BDCDATA
BDC_DYNPRO
BDC_FIELD
CONSTRUCTOR
RUN_SESSION
CALL_TRANSACTION
BDC_INSERT
To complete the different scenarii explained above, some sequences should be followed :
1)
2) Building a session and a set of BDC scenarios and keeping the session available in
SM35 :
3) Building a session and lauching the transaction right after closing the session.
The previous steps should be followed (the ones explained for the
session),
At the end, the method RUN_SESSION should be called (after the
CLOSE_SESSION).
Path
The Batch Input is described in the Help-On-Line (4.5B) under the following items :
R/3 Library -> BC Basis Components -> ABAP Workbench (BC-DWB) -> BC Basis
Programming Interfaces -> Data Transfer
R/3 Library -> BC Basis Components -> Kernel Components (BC-KRN) -> BC System Service ->
Managing Batch Input Sessions
Program name
Program function
Author
Date Added
Z_SEND_EMAIL_to_Users
Send email to users
Version: 4.0 & above
REPORT Z_SEND_EMAIL_to_Users.
TABLES: USR02.
DATA: C(15).
DATA: SENT LIKE SONV-FLAG.
DATA: EMAIL_ID LIKE SOFOLENTI1-OBJECT_ID.
DATA: BEGIN OF EMAIL_DATA.
INCLUDE STRUCTURE SODOCCHGI1.
DATA: END OF EMAIL_DATA.
DATA: BEGIN OF EMAIL_SEND OCCURS 10.
INCLUDE STRUCTURE SOMLRECI1.
DATA: END OF EMAIL_SEND.
DATA: BEGIN OF EMAIL_TEXT OCCURS 10.
INCLUDE STRUCTURE SOLISTI1.
DATA: END OF EMAIL_TEXT.
****************************************************
PARAMETERS: ALL__CLI RADIOBUTTON GROUP RADI.
PARAMETERS: THIS_CLI RADIOBUTTON GROUP RADI.
PARAMETERS: SELECT__ RADIOBUTTON GROUP RADI.
SELECT-OPTIONS SEND_TO FOR C NO INTERVALS.
SELECTION-SCREEN SKIP.
PARAMETERS: SUBJECT(30).
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT /1(20) TEXT-999.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: L1(84).
SELECTION-SCREEN END OF LINE.SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: L2(84).
SELECTION-SCREEN END OF LINE.SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: L3(84).
SELECTION-SCREEN END OF LINE.SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: L4(84).
SELECTION-SCREEN END OF LINE.SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: L5(84).
SELECTION-SCREEN END OF LINE.SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: L6(84).
SELECTION-SCREEN END OF LINE.SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: L7(84).
SELECTION-SCREEN END OF LINE.SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: L8(84).
SELECTION-SCREEN END OF LINE.SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: L9(84).
SELECTION-SCREEN END OF LINE.
***********************************************
EMAIL_TEXT-LINE = L1.
APPEND EMAIL_TEXT.
EMAIL_TEXT-LINE = L2.
APPEND EMAIL_TEXT.
EMAIL_TEXT-LINE = L3.
APPEND EMAIL_TEXT.
EMAIL_TEXT-LINE = L4.
APPEND EMAIL_TEXT.
EMAIL_TEXT-LINE = L5.
APPEND EMAIL_TEXT.
EMAIL_TEXT-LINE = L6.
APPEND EMAIL_TEXT.
EMAIL_TEXT-LINE = L7.
APPEND EMAIL_TEXT.
EMAIL_TEXT-LINE = L8.
APPEND EMAIL_TEXT.
EMAIL_TEXT-LINE = L9.
APPEND EMAIL_TEXT.
EMAIL_DATA-OBJ_NAME = 'MESSAGE'.
EMAIL_DATA-OBJ_DESCR = SUBJECT.
EMAIL_DATA-OBJ_LANGU = 'E'.
EMAIL_DATA-SENSITIVTY = 'P'.
EMAIL_DATA-OBJ_PRIO = '1'.
EMAIL_DATA-NO_CHANGE = 'X'.
EMAIL_DATA-PRIORITY = '1'.
IF SELECT__ = 'X'.
LOOP AT SEND_TO.
EMAIL_SEND-RECEIVER = SEND_TO-LOW.
EMAIL_SEND-REC_TYPE = 'U'.
EMAIL_SEND-EXPRESS = 'X'.
APPEND EMAIL_SEND.
ENDLOOP.
ELSEIF THIS_CLI = 'X'.
SELECT * FROM USR02.
IF USR02-USTYP = 'A' AND USR02-BNAME NE 'SAP*'
AND USR02-BNAME NE 'DDIC'.
EMAIL_SEND-RECEIVER = USR02-BNAME.
EMAIL_SEND-REC_TYPE = 'U'.
EMAIL_SEND-EXPRESS = 'X'.
APPEND EMAIL_SEND.
ENDIF.
ENDSELECT.
ELSEIF ALL__CLI = 'X'.
SELECT * FROM USR02 CLIENT SPECIFIED.
IF USR02-USTYP = 'A' AND USR02-BNAME NE 'SAP*'
AND USR02-BNAME NE 'DDIC'.
EMAIL_SEND-RECEIVER = USR02-BNAME.
EMAIL_SEND-REC_TYPE = 'U'.
EMAIL_SEND-EXPRESS = 'X'.
APPEND EMAIL_SEND.
ENDIF.
ENDSELECT.
ENDIF.
WRITE:/ 'End of program'.
*****************************************************
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = EMAIL_DATA
DOCUMENT_TYPE = 'RAW'
PUT_IN_OUTBOX = 'X'
IMPORTING
SENT_TO_ALL = SENT
NEW_OBJECT_ID = EMAIL_ID
TABLES
OBJECT_CONTENT = EMAIL_TEXT
RECEIVERS = EMAIL_SEND
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
Q.Write a program that lists the Vendors and their Accounting documents. Create
extract dataset from KDF logical database. Loop through the dataset to create the
required report. Don't list those vendors which has no documents.
Creating Extract Dataset
Your code should be like this.
report zfwr0001 no standard page heading.
tables: lfa1, bsik.
field-groups: header, item1, item2.
insert lfa1-lifnr bsik-belnr into header.
insert lfa1-land1 lfa1-name1 into item1.
insert bsik-belnr bsik-budat into item2.
start-of-selection.
get lfa1.
....extract item1.
get bsik.
....extract item2.
end-of-selection.
loop.
....at item1 with item2.
........skip.
........write:/ 'Vendor number:', 28 'Name:', 56 'City:'.
........write: 16 lfa1-lifnr, 33(20) lfa1-name1, 62(20) lfa1-ort01.
........write:/ 'Document no.', 15 'Date'.
....endat.
....at item2.
........write:/ bsik-belnr, 13 bsik-budat.
....endat.
endloop.
Additional task:
Don't forget to set the Logical database to KDF on the "Program Attributes"
screen.
Result:
Vendor number: 100124 Name:Coca Cola City: New York
Document no. Date
1800000316 01/08/1997
Vendor number: 100126 Name: Universal Studios City: Los Angeles
Document no. Date
1800000109 12/02/1996
1800000341 01/10/1997
1800000321 01/14/1997
Program name
Program function
Z_Display_menupath
Version: 4.0 & above
Display Menupath
Author
Date Added
Program name
Program function
Author
Z_abap_list_viewer
Version: 4.0 & above
Viren Shah
Date Added
REPORT Z_LIST_MATERIALS.
TYPE-POOLS: SLIS.
TABLES:MARC, MARD, VBAP, LIPS, EKPO, VBFA, EKBE, MARM, VBBE, MARA, MBEW.
SELECTION-SCREEN BEGIN OF BLOCK SEL WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_WERKS FOR MARC-WERKS, " Plant
S_MATNR FOR MARC-MATNR, " Material
S_MTART FOR MARA-MTART. " Material Type
SELECTION-SCREEN END OF BLOCK SEL.
PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT. " ALV Variant
CONSTANTS: FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE
'TOP_OF_PAGE'.
DATA: BEGIN OF INV OCCURS 100,
WERKS LIKE MARD-WERKS, " Plant
MATNR LIKE MARD-MATNR, " Material
MTART LIKE MARA-MTART, " Material Type
STPRS LIKE MBEW-STPRS, " Standard Price
AVAIL LIKE MARD-LABST, " Available
*&---------------------------------------------------------------------*
*&
Form INITIALIZE_FIELDCAT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
*
-->P_FIELDTAB[] text
*
*----------------------------------------------------------------------*
FORM INITIALIZE_FIELDCAT USING P_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV.
DATA: L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
* fixed columns (obligatory)
CLEAR L_FIELDCAT.
L_FIELDCAT-TABNAME = 'INV'.
L_FIELDCAT-FIX_COLUMN = 'X'.
L_FIELDCAT-NO_OUT = 'O'.
L_FIELDCAT-FIELDNAME = 'WERKS'.
APPEND L_FIELDCAT TO P_FIELDTAB.
L_FIELDCAT-FIELDNAME = 'MATNR'.
APPEND L_FIELDCAT TO P_FIELDTAB.
* totalized columns
CLEAR L_FIELDCAT.
L_FIELDCAT-TABNAME = 'INV'.
L_FIELDCAT-SP_GROUP = 'A'.
L_FIELDCAT-DO_SUM = 'X'.
L_FIELDCAT-FIELDNAME = 'LABST'.
APPEND L_FIELDCAT TO P_FIELDTAB.
L_FIELDCAT-FIELDNAME = 'INSME'.
APPEND L_FIELDCAT TO P_FIELDTAB.
L_FIELDCAT-FIELDNAME = 'RETME'.
APPEND L_FIELDCAT TO P_FIELDTAB.
L_FIELDCAT-FIELDNAME = 'UMLME'.
APPEND L_FIELDCAT TO P_FIELDTAB.
L_FIELDCAT-FIELDNAME = 'WESBS'.
APPEND L_FIELDCAT TO P_FIELDTAB.
L_FIELDCAT-FIELDNAME = 'SPEME'.
APPEND L_FIELDCAT TO P_FIELDTAB.
* columns with different description
L_FIELDCAT-FIELDNAME = 'KWMENG'.
L_FIELDCAT-SELTEXT_M = 'Sales Orders'.
L_FIELDCAT-SELTEXT_S = 'Sales Or'.
L_FIELDCAT-SELTEXT_L = 'Sales Orders Qty'.
APPEND L_FIELDCAT TO P_FIELDTAB.
L_FIELDCAT-FIELDNAME = 'LFIMG'.
L_FIELDCAT-SELTEXT_M = 'Sched. Delivery'.
L_FIELDCAT-SELTEXT_S = 'Schd. Del'.
L_FIELDCAT-SELTEXT_L = 'Scheduled for Delivery'.
APPEND L_FIELDCAT TO P_FIELDTAB.
L_FIELDCAT-FIELDNAME = 'TRANS'.
L_FIELDCAT-SELTEXT_M = 'Stk. in transit'.
L_FIELDCAT-SELTEXT_S = 'Stk. trns'.
L_FIELDCAT-SELTEXT_L = 'Stock in transit (sum)'.
APPEND L_FIELDCAT TO P_FIELDTAB.
L_FIELDCAT-FIELDNAME = 'AVAIL'.
L_FIELDCAT-SELTEXT_M = 'Available'.
L_FIELDCAT-SELTEXT_S = 'Avail.'.
L_FIELDCAT-SELTEXT_L = 'Stock Available'.
SEP(20) TYPE C.
CLEAR: HLINE, TEXT.
HLINE-TYP = 'H'.
WRITE: TEXT-101 TO TEXT+23.
HLINE-INFO = TEXT.
APPEND HLINE TO P_HEADING.
CLEAR TEXT.
WRITE: 'User: ' TO TEXT,
SY-UNAME TO TEXT+6,
'Date: ' TO TEXT+25,
SY-DATUM TO TEXT+31,
'Page: ' TO TEXT+50,
SY-PAGNO TO TEXT+56.
HLINE-INFO = TEXT.
APPEND HLINE TO P_HEADING.
ENDFORM.
" BUILD_COMMENT
*---------------------------------------------------------------------*
*
FORM TOP_OF_PAGE
*
*---------------------------------------------------------------------*
*
........
*
*---------------------------------------------------------------------*
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEADING.
ENDFORM.
*&---------------------------------------------------------------------*
*&
Form INITIALIZE_VARIANT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM INITIALIZE_VARIANT.
G_SAVE = 'A'.
CLEAR G_VARIANT.
G_VARIANT-REPORT = REPNAME.
GX_VARIANT = G_VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
I_SAVE = G_SAVE
CHANGING
CS_VARIANT = GX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 0.
P_VARI = GX_VARIANT-VARIANT.
ENDIF.
ENDFORM.
" INITIALIZE_VARIANT
*&---------------------------------------------------------------------*
*&
Form F4_FOR_VARIANT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM F4_FOR_VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = G_VARIANT
I_SAVE = G_SAVE
IMPORTING
E_EXIT = G_EXIT
ES_VARIANT = GX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 2.
MESSAGE ID SY-MSGID TYPE 'S'
NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
IF G_EXIT = SPACE.
P_VARI = GX_VARIANT-VARIANT.
ENDIF.
ENDIF.
ENDFORM.
" F4_FOR_VARIANT
*&---------------------------------------------------------------------*
*&
Form PAI_OF_SELECTION_SCREEN
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM PAI_OF_SELECTION_SCREEN.
*
IF NOT P_VARI IS INITIAL.
MOVE G_VARIANT TO GX_VARIANT.
MOVE P_VARI TO GX_VARIANT-VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
I_SAVE = G_SAVE
CHANGING
CS_VARIANT = GX_VARIANT.
G_VARIANT = GX_VARIANT.
ELSE.
PERFORM INITIALIZE_VARIANT.
ENDIF.
ENDFORM.
" PAI_OF_SELECTION_SCREEN
*&---------------------------------------------------------------------*
*&
Form GET_MARD
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM GET_MARD.
SELECT MATNR WERKS LABST INSME RETME UMLME SPEME
FROM MARD
INTO CORRESPONDING FIELDS OF INV
WHERE MATNR IN S_MATNR
AND WERKS IN S_WERKS.
COLLECT INV.
ENDSELECT.
PERFORM FILTER_BY_MATERIAL_TYPE.
ENDFORM.
" GET_MARD
*&---------------------------------------------------------------------*
*&
Form FILTER_BY_MATERIAL_TYPE
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM FILTER_BY_MATERIAL_TYPE.
LOOP AT INV.
CLEAR INV-MTART.
SELECT SINGLE MTART
INTO INV-MTART
FROM MARA
WHERE MATNR EQ INV-MATNR
AND MTART IN S_MTART.
IF SY-SUBRC EQ 0.
MODIFY INV.
ELSE.
DELETE INV.
ENDIF.
ENDLOOP.
ENDFORM.
" FILTER_BY_MATERIAL_TYPE
*&---------------------------------------------------------------------*
*&
Form GET_MARC
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM GET_MARC.
LOOP AT INV.
SELECT SINGLE UMLMC TRAME
FROM MARC
INTO CORRESPONDING FIELDS OF INV
WHERE MATNR EQ INV-MATNR
AND WERKS EQ INV-WERKS.
IF SY-SUBRC EQ 0.
INV-TRANS = INV-UMLMC + INV-TRAME.
MODIFY INV.
ENDIF.
ENDLOOP.
ENDFORM.
" GET_MARC
*&---------------------------------------------------------------------*
*&
Form GET_EKPO
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM GET_EKPO.
DATA: WESBS LIKE INV-WESBS,
SHKZG LIKE EKBE-SHKZG,
MEINS LIKE EKPO-MEINS,
LMEIN LIKE EKPO-LMEIN.
LOOP AT INV.
CLEAR: WESBS, SHKZG, MEINS, LMEIN.
SELECT Y~WESBS Y~SHKZG X~MEINS X~LMEIN
INTO (WESBS, SHKZG, MEINS, LMEIN)
MODIFY INV.
ENDLOOP.
ENDFORM.
" GET_VBAP
*&---------------------------------------------------------------------*
*&
Form GET_UNIT_OF_MEASURE
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM GET_UNIT_OF_MEASURE.
LOOP AT INV.
SELECT SINGLE MEINS
FROM MARA
INTO INV-MEINS
WHERE MATNR EQ INV-MATNR.
MODIFY INV.
ENDLOOP.
ENDFORM.
" GET_UNIT_OF_MEASURE
*&---------------------------------------------------------------------*
*&
Form GET_OPEN
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM GET_OPEN.
DATA: BEGIN OF XTAB OCCURS 10,
" Open orders table
WERKS LIKE EKPO-WERKS,
LGORT LIKE EKPO-LGORT,
MATNR LIKE EKPO-MATNR,
MENGE LIKE EKPO-MENGE,
MENGK LIKE EKPO-MENGE,
END OF XTAB.
RANGES: L_WERKS FOR MARD-WERKS.
LOOP AT INV.
REFRESH XTAB.
CLEAR: XTAB, L_WERKS.
MOVE INV-WERKS TO L_WERKS-LOW.
CALL FUNCTION 'MB_ADD_PURCHASE_ORDER_QUANTITY'
EXPORTING
X_MATNR = INV-MATNR
X_MEINS = INV-MEINS
X_ELIKZ = SPACE
X_LOEKZ = SPACE
TABLES
XTAB = XTAB
XWERKS = L_WERKS.
MOVE XTAB-MENGE TO INV-MENGE.
MODIFY INV.
ENDLOOP.
ENDFORM.
" GET_OPEN
*&---------------------------------------------------------------------*
*&
Form GET_PRICE
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM GET_PRICE.
LOOP AT INV.
SELECT SINGLE STPRS
FROM MBEW
INTO INV-STPRS
WHERE MATNR EQ INV-MATNR
AND BWKEY EQ INV-WERKS
AND BWTAR EQ SPACE.
IF SY-SUBRC EQ 0.
INV-VALUE = INV-STPRS *
( INV-LABST + INV-INSME + INV-TRANS + INV-SPEME ).
MODIFY INV.
ENDIF.
ENDLOOP.
ENDFORM.
" GET_PRICE
*---------------------------------------------------------------------*
*
FORM CONVERT_UNIT_OF_MEASURE
*
*---------------------------------------------------------------------*
*
text
*
*---------------------------------------------------------------------*
* --> P_MATNR
*
* --> P_VRKME
*
* --> P_QUANT
*
*---------------------------------------------------------------------*
FORM CONVERT_UNIT_OF_MEASURE USING P_MATNR P_VRKME P_QUANT.
DATA: UMREZ LIKE MARM-UMREZ,
UMREN LIKE MARM-UMREN.
SELECT SINGLE UMREZ UMREN
INTO (UMREZ, UMREN)
FROM MARM
WHERE MATNR EQ P_MATNR
AND MEINH EQ P_VRKME.
IF SY-SUBRC EQ 0.
COMPUTE P_QUANT = ( P_QUANT * UMREZ ) / UMREN.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*&
Form BUILD_LAYOUT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
*
-->P_LAYOUT text
*
*----------------------------------------------------------------------*
FORM BUILD_LAYOUT USING P_LAYOUT TYPE SLIS_LAYOUT_ALV.
P_LAYOUT-F2CODE
= F2CODE.
P_LAYOUT-ZEBRA
= 'X'.
P_LAYOUT-DETAIL_POPUP = 'X'.
ENDFORM.
" BUILD_LAYOUT
*&---------------------------------------------------------------------*
*&
Form WRITE_OUTPUT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM WRITE_OUTPUT.
SORT INV BY WERKS MATNR.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = REPNAME
I_INTERNAL_TABNAME = 'INV'
I_INCLNAME
= REPNAME
CHANGING
CT_FIELDCAT
= FIELDTAB.
IF SY-SUBRC <> 0.
WRITE: 'SY-SUBRC: ', SY-SUBRC, 'REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = REPNAME
I_STRUCTURE_NAME = 'INV'
IS_LAYOUT
= LAYOUT
IT_FIELDCAT
= FIELDTAB
I_DEFAULT
= 'A'
I_SAVE
= G_SAVE
IS_VARIANT
= G_VARIANT
IT_EVENTS
= EVENTS[]
TABLES
T_OUTTAB
= INV.
IF SY-SUBRC <> 0.
WRITE: 'SY-SUBRC: ', SY-SUBRC, 'REUSE_ALV_LIST_DISPLAY'.
ENDIF.
ENDFORM.
" WRITE_OUTPUT