JK Notes
JK Notes
Functional Technical
consultants Consultants
-------------------------------------------------------------------------------------------------------------
DATA BASE
DBS BACKEND
SAP OBJECTS:
1.STANDARD : Developed by SAP,
EX:
Note : TSTCT table for all available Tcodes in our SAP server.
LOGON DETAILS:
Project Landscape:
20e0a925
Ex: B72K900061
********************************************************
Ex: a = b.
Comments:
Ex:
*ADDING NUMBERS
Program Flow :
Header DEFINE X , Y ,Z
Declarations
Logic
Body LOGIC Z = X + Y.
Data type is blue print of variables. Data type cannot holds data.
Data Types :(Elementary data types)
PACKED------decimal values
DATA V1 TYPE I.
DATA V2 TYPE I.
DATA V3 TYPE I.
V1 = 90.
V2 = 80.
V3 = V1 + V2.
***********************************************************
V1 = 90.
V2 = 80.
V3 = V1 + V2.
************************************
V3 = V1 + V2.
*************************************************************************
1.Branching techs: (used to execute only one logic among multiple options)
IF , CASE
*********************IF***********************
IF condition.
----
ELSEIF condition.
---
ELSEIF condition.
-----
ELSE.
-----
ENDIF.
*******************CASE****************************
CASE parametername.
WHEN option1.
-----
WHEN option2.
-----
WHEN OTHERS.
-----
ENDCASE.
1).Unconditional Looping: DO
DO n TIMES.
-----------------------
ENDDO.
WHILE condition.
-----------------
ENDWHILE.
Note : SY-INDEX is called normal loop index can be used within the DO & WHILE loops
only
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
PARAMETERS GENDER.
IF GENDER = 'M'.
WRITE 'MALE'.
ELSEIF GENDER = 'F'.
WRITE 'FEMALE'.
ELSE.
WRITE 'INVALID INPUT'.
ENDIF.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
PARAMETERS GENDER.
CASE GENDER.
WHEN 'M'.
WRITE 'MALE'.
WHEN 'F'.
WRITE 'FEMALE'.
WHEN OTHERS.
WRITE 'INVALID INPUT'.
ENDCASE.
######################################################################
DO 10 TIMES.
WRITE :/ SY-INDEX,'ABAP'.
ENDDO.
STRING OPERATIONS
S1 = 'india'.
WRITE S1.
ULINE.
DATA S2 TYPE STRING.
S2 = 'UMA SANKAR'.
CONDENSE S2 NO-GAPS.
WRITE S2.
ULINE.
DATA S3 TYPE STRING VALUE 'SAP-ABAP'.
DATA N1 TYPE I.
N1 = STRLEN( S3 ).
WRITE N1.
ULINE.
DATA S4 TYPE STRING.
WRITE S4.
ULINE.
DATA S5 TYPE STRING VALUE '1234,UMA,HYD'.
DATA : EID TYPE STRING,
ENAME TYPE STRING,
CITY TYPE STRING.
SPLIT S5 AT ',' INTO EID ENAME CITY.
WRITE :/ EID,/ ENAME,/ CITY.
ULINE.
SNAME = S5+5(3).
WRITE SNAME.
ULINE.
PARAMETERS PHONE(10).
PARAMETERS FILE(50).
IF SY-SUBRC EQ 0.
WRITE 'VALID FILE'.
ELSE.
WRITE 'PLZ SELECT TEXT FILES'.
ENDIF.
DATA DICTIONARY /
ABAP DICTIONARY(SE11)-DDic
DDic is a tool used to create data base objects.
FIELDS
datatype
3 JAY B.TECH
4 RAGHAV M.TECH
FIELD
DOMAIN -------> Technical properties like data type , size ,sign ,lower case, fixed values & ranges
TABLE
STRUCTURE BODY(data)
F1 F2 F3
DOMAIN + DESC
DTYPE+SIZE
5.NAME1 - name
6.ORT01 - city
7.LAND1 - country
8.TELF1 - telephone
******************************************************************************
TYPES OF DATA:
*****************************************************************************
Technical Specification:(T.S)
Table : Zstudents
Delivery Class : A
Structure
C - Customizing Table
2.Maintenance Allowed / Allowed with Restrictions : Changes in table data allowed or not
4.Size Category : It defines number of records to be stored in this table. It is a scale from 0-9
5.Buffering : Temporary memory storage. We can Buffer a DB table which with frequently read
operations.
7.Primary Key : To avoid duplicates & Null values. First field of a table must be a primary key.
One table can has up to 16 primary keys( Must be in sequential order)
STANDARD DATABASE TABLES:
VENDOR: LFA1,LFB1,LFMH,LFBK.......
MATERIAL: MARA,MARC,MARD,MAKT,....
SALES: VBAK,VBAP,VBUK,VBUP,VBRK,VBRP...
PURCHASE: EKKO,EKPO,....
DATA BROWSER:(SE16): It allows to display or change data records of a table directly ( No structure is visible)
*********************************************************************
Authorization Group : The group of users who can maintain the table
1.ONE STEP : uses only one screen OVERVIEW SCREEN to maintain data.
2.TWO STEP : uses two screens SINGLE SCREEN & OVERVIEW SCREEN to maintain data.
**********************************************************************************
1.Include Structure : adding structure at any position(except primary keys)----> custom tables
Newly added field of a DB table will not be added into TMG of that DB table automatically.
---------------------------------------------------------------------------------------------------------------------------------------------------
FOREIGN KEY RELATIONSHIP : TO validate values being entered in child table with values set of check table /
parent table f.key relation
ZRESULTS
8
e
3
F.Key Table
2
VALUE TABLE : This info maintained in DOMAIN. While trying to maintain
Foreign key relation this value table will be proposed as parent table. we can 3
override this proposal. After Foreign key relationship only value table
4
becomes CHECK TABLE.
*********************************************************************************************
VIEWS : Copy of Data base tables. These are virtual tables. Views have no physical existence
in DB.
1.Projection view
2.Database View
3.Maintenance View
4.Help View
2.Database View Projects fields from multiple tables based on a joining condition( common
field)
Note: Maintenance is not possible with Data Base views. It supports only inner join.
3.Maintanance view
4.Help view
*******************************************************************
Note : HOT KEY is used to select a specific elementary search help from a collective search
help
*****************************************************************************************
Currency Field must be defined with CURR data type. Its reference
field must be defined with CUKY data type.
Quantity Field must be defined with QUAN data type. Its reference
field must be defined with UNIT data type.
********************************************************
Indexes( primary & secondary) :
These are used to maintain data records of a table in sequential format. Data accessing time
reduces by extracting records using INDEXES.
1.Primary Index: It is default and mandatory. It is automatically created by using primary key
fields.
2.Secondary Indexes : These can be created by using non key fields. We can create up to 6
secondary indexes for a DBTable.
****************************************************************************
Lock Objects :
It is used to lock or release a data base table data from other users.
1.WRITE /EXCLUSIVE LOCK MODE ( E ) : Only one user at a time can access table
2.READ / SHARED LOCK MODE( S ) : Multiple users can access at a time, but only one can edit
3.EXCLUSIVE BUT NOT CUMULATIVE LOCK MODE : One user can lock for only one time during a transaction
REPORT ZDEMO.
Call Function 'ENQUEUE_XXXX'. " to lock table access
DB operations.
--------------------
----------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DDIC DB
2.POOLED TABLE: Multiple pooled tables of DDic grouped into only one physical
table called TABLE POOL in actual DB.
pooled table1
Table Pool
Pooled Table2
Pooled Table 3
3.CLUSTER TABLE: Multiple cluster tables of DDic grouped into only one
physical table called TABLE CLUSTER in actual DB. Generally HR data maintained
in cluster tables. All cluster tables of a group must be having one common field.
Cluster Table1
Common P.key
Cluster Table 2 TABLE CLUSTER
Field
Cluster Table 3
Assignment
1.ZDOCTORS
DOCID ( 01 - 25 )-------key
DNAME
EXP
HNAME
ZADDRESS
STREET
CITY
PHONE
2.ZPHARMA
MEDID ( 0001 - 5999)-------key
MNAME
PRICE
QUANTITY
DOE(DATE OF EXPIRY)
BNO(BATCH NUMBER)
3.ZMED_DOCS
3. STRUCTURE vs TABLE
1.ZCUSTOMERS(CUSTNR,NAME,CITY,COUNTRY,PHONE,EMAILID).
2.ZITEMS(ITEMID,INAME,ITYPE,MFGDATE,EXPDATE,MCOMP_NAME,PRICE).
3.ZSALES(SONR,SITEM,CR_DATE,CUSTNR,ITEMID,QNTY,NETPR)
INTERNAL TABLES(ITAB)
3 Manu Nj 98080
We can access data into Itab only through its Work area(Header Line).
ABAPer------->WA------->ITAB
ABAPer<-------WA<-------ITAB
ABAP
single row
work area
multiple rows
*&---------------------------------------------------------------------*
*& Report ZDEMO_ITAB1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
*&---------------------------------------------------------------------*
*& Report ZDEMO_WA
*& KNA1
*&---------------------------------------------------------------------*
*&KUNNR
*&NAME1 ORT01 LAND1
*&---------------------------------------------------------------------*
Technical Info:
Fields Descriprions
ORT01 City
LAND1 Country
***********************************************************************
TABLES : This keyword is used to define a work area with same name and structure of given
data base table.
******************************************************************************
1.WAP to display purchase order number , item ,material number and net prices of purchase
order numbers between '3000000000' and '400000000'.
3.WAP to display all vendors numbers, names, cities, and countries details based on given city.
ITABS WITH ------
internal table
2.EXPLICIT WA ( itab & wa defined with different names)
**********************************************************
Standard Itab
TYPES OF INTERNAL TABLES
Indexed Itabs
Sorted Itab
Internal tables
Non Indexed Itab Hashed Itab
1.Standard itab:
It is default type of itab.
It is Indexed internal Table i.e index can be generated for this itab.
Syntax:
DATA itabname TYPE STANDARD TABLE OF struturename WITH NON UNIQUE fieldname.
2.Sorted Itab:
It is indexed itab.
Syntax
DATA itabname TYPE SORTED TABLE OF structurename WITH UNIQUE / NON UNIQUE
fieldname.
3.Hashed Itab:
It is non indexed itab i.e index cannot be generated for records of itab i.e SY-TABIX is always 0
for Hashed Itabs.
Syntax
DATA V1 TYPE I.
work area
Append READ
internal table
insert,
collect
5.DESCRIBE : to get properties of an ITAB like type of itab, initial memory of itab and number
of records of itab.
7.READ : used to extract a specific single record from itab into wa.
READ TABLE itabname INTO waname WITH KEY condition BINARY SEARCH.
*********************************************************************
***********************************************************************
wa-ename = 'RAM'.
WA-SAL = 1000.
*APPEND WA TO IT.
COLLECT WA INTO IT.
wa-ename = 'SYAM'.
WA-SAL = 2000.
*APPEND WA TO IT.
COLLECT WA INTO IT.
wa-ename = 'RAM'.
WA-SAL = 3000.
*APPEND WA TO IT.
COLLECT WA INTO IT.
wa-ename = 'SYAM'.
WA-SAL = 4000.
*APPEND WA TO IT.
COLLECT WA INTO IT.
*&---------------------------------------------------------------------*
*& Report ZDEMO_ITAB1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZDEMO_ITAB_OPERS NO STANDARD PAGE HEADING.
******************define structrue***********************
types begin of s1.
TYPES BUKRS type bukrs.
types butxt type butxt.
types land1 type land1.
types end of s1.
**************define wwork area***********************
data wa type s1.
************define itab*****************************
data it type table of s1.
******************fetch dbt---> itab******************
select bukrs butxt land1 from t001 into table it up to 5 rows.
**************display itab******************************
loop at it into wa.
write :/ sy-tabix,wa-bukrs COLOR 3,wa-butxt COLOR 4,wa-land1 COLOR 5.
endloop.
uline.
* *****************append******************
wa-bukrs = '1000'.
wa-butxt = 'igrow soft'.
wa-land1 = 'IN'.
append wa to it.
**************display itab******************************
loop at it into wa.
write :/ sy-tabix,wa-bukrs COLOR 3,wa-butxt COLOR 4,wa-land1 COLOR 5.
endloop.
uline.
******************insert********************
wa-bukrs = '2000'.
wa-butxt = 'micro soft'.
wa-land1 = 'US'.
**************display itab******************************
loop at it into wa.
write :/ sy-tabix,wa-bukrs COLOR 3,wa-butxt COLOR 4,wa-land1 COLOR 5.
endloop.
uline.
***************sort*********************
sort it by bukrs.
**************display itab******************************
loop at it into wa.
write :/ sy-tabix,wa-bukrs COLOR 3,wa-butxt COLOR 4,wa-land1 COLOR 5.
endloop.
uline.
*************d a d************************
delete adjacent duplicates from it COMPARING bukrs.
**************display itab******************************
loop at it into wa.
write :/ sy-tabix,wa-bukrs COLOR 3,wa-butxt COLOR 4,wa-land1 COLOR 5.
endloop.
uline.
******************describe*************************
data n1 type i.
describe table it lines n1.
**************display itab******************************
loop at it into wa.
write :/ sy-tabix,wa-bukrs COLOR 3,wa-butxt COLOR 4,wa-land1 COLOR 5.
endloop.
uline.
******************read***********************
* read table it into wa index 4.
read table it into wa with key bukrs = '1000' BINARY SEARCH.
CLEAR variablename.
CLEAR waname.
CLEAR itabname.
REFRESH itabname.
FREE variablename.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
OPEN SQL : These are used to access data base tables. It supports DB portability.
WA------> DBT or ITAB---------------->DBT
Note : At the time of execution all Open SQL commands converted into corresponding Native
SQL commands by ABAP ENGINE.
ABAP
ABAP er
Consultant
WA INSERT(NEW)
UPDATE(OLD)
OPEN SQL
SY-DBCNT
MODIFY(NEW &
ITAB OLD)
DELETE(OLD)
SAP DB
insert(new),update(old),modify(new&old),delete(old)------>SY-DBCNT
INSERT: to insert only new records into data base table.
MODIFY : it acts as INSERT for new records and UPDATE for existing records.
*&---------------------------------------------------------------------*
*& Report ZDEMO_OPENSQL
*&
wa-bukrs = '1510'.
wa-butxt = 'igrow soft'.
wa-land1 = 'in'.
append wa to it.
wa-bukrs = '1511'.
wa-butxt = 'Micro soft'.
wa-land1 = 'in'.
append wa to it.
insert t001 from table it ACCEPTING DUPLICATE KEYS.
write / sy-subrc.
write / sy-dbcnt.
uline.
write / sy-subrc.
write / sy-dbcnt.
uline.
write / sy-subrc.
write / sy-dbcnt.
uline.
CONTROL BREAK STATEMENTS : These are used to control loop of an internal table. These
statements must be used within the loop only. It is better to sort ITAB before using these statements.
1.AT FIRST : Executed only for once before processing first record of itab.
2.AT NEW fieldname : Executed before processing each new value of given field.
NOTE : The above 2 statements must be used before main write statement of loop.
3.AT END OF fieldname: Executed after processing all similar values of given field.
JOINS: This concept is used to club multiple data base tables data into only one internal table ,based on a given
joining condition.
1.INNER JOIN
2.LEFT OUTER JOIN
****************************************************************************
FOR ALL ENTRIES: It is similar to inner joins concept. It gives better performance than joins.
->It is mandatory to check whether it1 is initial or not before writing second Select statement.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&
REPORT ZDEMO_FOR_ALL_ENTRIES1 NO STANDARD PAGE HEADING line-SIZE 1000.
types:begin of ty_final,
kunnr type kunnr,
name1 type name1,
ort01 type ort01,
land1 type land1,
banks type banks,
bankl type bankl,
bankn type bankn,
end of ty_final.
data it_final type table of ty_final.
data wa_final type ty_final.
select kunnr
name1
ort01
land1
from kna1
into table it_kna1
where land1 = p_land1.
wa_final-kunnr = wa_kna1-kunnr.
wa_final-name1 = wa_kna1-name1.
wa_final-ort01 = wa_kna1-ort01.
wa_final-land1 = wa_kna1-land1.
wa_final-banks = wa_knbk-banks.
wa_final-bankl = wa_knbk-bankl.
wa_final-bankn = wa_knbk-bankn.
endloop.
*******************************************************************
TABLE TYPE: It is a data type , to define internal table directly( with out TABLE OF
keyword).
**********************************************
DATA A TYPE B.
**********************************************
*
CASE 1. If B is a basic data type (C/I/D/N...) or a data element
(KUNNR/ BUKRS/EBELN....)......
CASE 2. If B is a structure
data base
SELECT SINGLE
OPEN SQL
OPEN SQL
work area
SELECT INSERT
READ
APPEND
COLLECT Internal
MODIFY
table
PROGRAM
Modularization Techniques(Subprograms)
---Reusability
Definition SUB1
Z = X + Y.
Formal Parameters
Calling 50 60 ting
call sub1
exp x = 50,y = 60
imp z.
50 60 Actual Parameters
Note :
1.Include programs
2.Macros
3.Subroutines(Forms)
4.Function Modules(FM)
Example:
include z5pms_decls.
include z5pms_display.
**************************************************************
*&---------------------------------------------------------------------*
*& Report ZDEMO_MACROS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
*****************definition*****************
define adds.
&3 = &1 + &2.
write &3.
uline.
end-of-DEFINITION.
****************calling*************************
data v1 type i.
adds 10 30 v1.
adds 37 39 v1.
adds 44 87 v1.
*****************************************************************************
*************call macro***************************
get_row 2.
get_row 4.
get_row 6.
************************** Subroutines(FORMS)*************************
FORM ---- definition
EXAMPLE 1
************calling*******************
perform get_cust using p1 changing wa1.
write : wa1-kunnr,wa1-name1,wa1-land1.
************definition******************
form get_cust using cno type kunnr
changing wa type kna1.
select single * from kna1 into wa where kunnr = cno.
endform.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&
EXAMPLE 2
write : ls_kna1-kunnr,ls_kna1-name1,ls_kna1-ort01.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&
FUNCTION MODULES:(FM)
->global sub programs
Function Builder(SE37).
CHANGING : To pass a variable which can acts as input & output variable
formal parameters
CALL FUNCTION 'ZGET_CUST'
EXPORTING
CNO = p1
IMPORTING actual parameters
WA = wa1
.
write : wa1-kunnr,wa1-name1,wa1-land1.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.i information
2.w warning
3.a abort
4.s success
5.e error
6.x exit
Local & Global messages:(Based on scope of a message)
Syntax:
MESSAGE 'text to be displayed' TYPE 'msgtype'. " msgtype must be in upper case
Global Messages:
MESSAGE e002(Z8AM).
REPORT ZDEMO_MESSAGES NO STANDARD PAGE HEADING.
PARAMETERS cname(10).
AT SELECTION-SCREEN.
if cname = 'SAP'.
message 'WELCOME TO SAP' TYPE 'I'.
ELSE.
MESSAGE 'INVALID COURSE NAME' TYPE 'E'.
ENDIF.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&
PARAMETERS cname(10).
AT SELECTION-SCREEN.
if cname = 'SAP'.
message i001(zsankar).
ELSE.
MESSAGE e002(zsankar) with cname.
ENDIF.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&
PARAMETERS cname(10).
AT SELECTION-SCREEN.
if cname = 'SAP'.
message i001.
ELSE.
MESSAGE e002 with cname.
ENDIF.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
BUSINESS DOCUMENTS
* Printing is optional
2.FORMS(scripts)======>SMARTFORMS
* External use documents
(DATA CUBES)
OLAP(ONLINE ANALYTICAL PROCESS)
***********************************************************************
REPORTS(Lists)
*These are Business docs for internal purpose of an org
---------- screen
SELECTION SCREEN (NUMBER 1000)
* PARAMETERS
*SELECT OPTIONS(Ranges)
*CHECK BOXES
*RADIO BUTTONs
IF C1 = 'X'.
WRITE :/ 'COURSE IS ABAP'.
ENDIF.
IF C2 = 'X'.
WRITE :/ 'COURSE IS SD'.
ENDIF.
IF R1 = 'X'.
WRITE :/ 'MODE IS CLASS ROOM TRAINING'.
ELSE.
WRITE :/ TEXT-003.
ENDIF.
TO TO
It is an internal table with implicit work area.(Internally)
1.LOW
2.HIGH
syntax:
case3 : TABLES KNA1. "CREATES ONLY WORKAREA with given DBtable name
NOTE: If select options is initial ,then all records will be fetched thru select statement.
***********************************************************************
ATTRIBUTES OF SELECT-OPTIONS :
*************************************************************************
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
EVENTS : Events are executed based on priority order or action. Starting of an event is
ending of previous event.
4.AT SELECTION-SCREEN
#############################################################################
INITIALIZATION.
select single bukrs into p1 from t001 where butxt = 'SAP A.G.'.
S1-LOW = '0001'.
S1-HIGH = '6000'.
S1-SIGN = 'I'.
S1-OPTION = 'BT'.
APPEND S1 TO S1.
AT SELECTION-SCREEN ON P1.
IF SY-SUBRC NE 0.
MESSAGE 'INVALID COMPANY CODE' TYPE 'E'.
ENDIF.
AT SELECTION-SCREEN .
IF P2 <> 'SAP'.
MESSAGE 'INVALID COMPANY NAME' TYPE 'E'.
ENDIF.
START-OF-SELECTION.
END-OF-SELECTION.
END-OF-PAGE.
WRITE :/ 'END OF PAGE ' COLOR 5,SY-PAGNO COLOR 5.
***********************************************************
FILE = F1.
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FILE
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = IT
.
IF SY-SUBRC EQ 0.
WRITE 'FILE UPLOADED SUCCESSFULLY'.
ENDIF.
VARIANT: IT IS set of frequently used input values of one screen. For one screen we can create multiple
variants.
A selection-screen or dynamic screen's elements and their properties are maintains in a standard internal table '
SCREEN '. It is an itab with implicit work area.
field description
REQUIRED mandatory
PROCEDURE:
STEP4. MODIFY SCREEN. " update above changes from wa(screen) into
itab(screen)
STEP5. ENDLOOP.
if b = 'X'.
loop at screen.
if screen-group1 = 'SC2'.
screen-active = 0.
endif.
modify screen.
endloop.
endif.
%%%%%%%%%%%%&&&&&&&&&&&&&&%%%%%%%%%
%%%%%%%%%%%%%%%%%%%
0 1 2 3 20
SECONDARY REPORTS
A
b--sbi
B
b--ab
C
D
1.at line-selection ( to generate next report)
WAP to display customers general data(KNA1) in one report and selected customers banks details (KNBK) in next
report
HIDE:
Hide collects double clicked line information. This info can be used in further reports logic. HIDE keyword must be
used within the LOOP and only after main write statement of LOOP.
Hide can converts data from external format into internal format automatically.
NOTE : HIDE is line specific technique. That is any where we click on the line secondary report is generated.
at LINE-SELECTION.
case sy-lsind.
if sy-subrc eq 0.
loop at it_knbk into wa_knbk.
write :/ wa_knbk-kunnr,wa_knbk-banks,wa_knbk-bankl,wa_knbk-bankn.
hide wa_knbk-banks.
endloop.
else.
message 'No banks found for selected customer' type 'I'.
endif.
when 2.
select * from t001 into table it_t001 where land1 = wa_knbk-banks.
if sy-subrc eq 0.
loop at it_t001 into wa_t001.
write :/ wa_t001-bukrs,wa_t001-butxt,wa_t001-land1.
endloop.
else .
message 'no company codes for selected country' type 'I'.
ENDIF.
ENDCASE.
top-of-page.
write :/30 'Customer General Details' color 3.
uline.
NOTE: Get Cursor cannot converts data from external format into internal format.
'CONVERSION_EXIT_ALPHA_INPUT'
*&---------------------------------------------------------------------*
*& Report ZDEMO_IREPORT_HIDE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
at LINE-SELECTION.
get cursor field f1 value v1.
if f1 = 'WA1-LIFNR'.
if sy-subrc eq 0.
loop at it2 into wa2.
write :/ wa2-lifnr,wa2-banks,wa2-bankl,wa2-bankn.
endloop.
else.
message 'no banks found' type 'I'.
ENDIF.
ELSE.
MESSAGE 'pls click on vendor number to view banks details' type 'I'.
endif.
SET PARAMETER: Used to transfer data from one transaction to another transaction.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&*&&&&&&&&&&&&&&&
AT USER-COMMAND :
It is triggered by clicking on push buttons and menu items.
P1 P2 P3 P4 )push buttons
AT USER-COMMAND.
CASE SY-UCOMM.
when 'ZCODE1'.
CALL TRANSACTION 'FI01'.
WHEN 'ZCODE2'.
CALL TRANSACTION 'MK03'.
WHEN 'ZSALL'.
V1 = 'X'.
loop at it into wa.
write :/ v1 as checkbox,wa-bukrs,wa-butxt,wa-land1.
endloop.
WHEN 'ZDALL'.
V1 = ' '.
loop at it into wa.
write :/ v1 as checkbox,wa-bukrs,wa-butxt,wa-land1.
endloop.
ENDCASE.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%
DEBUGGING
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%
To open debugger,
1.break points
F6(EXECUTE): It is used to execute one line at a time. It cannot steps into sub program's logic..It executes
subprogram logic as single statement.
F8(RUN): To execute entire program at a time and to exit from the debugger.
WATCH POINT: It is a logical break point with condition. We can set up to 10 watch points within a program.
/hx in debugging process if we click F8 ,still debugging continues internally...To off debugging need to click
'/HX'
*****************************************************************************
MAIN PROGRAM
F5 ------------------------ --------------- F5
F6 --------------------------- -----------------F5
B.P--> -----------------------------
----------------------------
SAP-SCRIPTS(forms):
Scripts are client dependent. A script designed in 100 client will not be visible in 200 client.
By activating script layout , it is converted into text format. In SAP, text documents are client
dependent ..so Scripts are client dependent.
Scripts layouts can be driven to generate their print output by driver programs(SE38).
SMARTFORMS:
It is word / text processing tool for making External Business documents, to interact with
business trade partners(customers & vendors etc). output of forms must be in printed format.
(LP01 used for demo printing purpose).
Smart forms are Client Independent where as Scripts are Client Dependent.
logo adrs
Driver
activate
Program
print FM
main se38
sign
FORM INTERFACE : Here we can define all types of variables through which we can transfer data
from driver program into smartform layout.
GLOBAL DEFINITIONS : Here we can define all types of variables which can be used within the
layout only.
Main Window : Data beyond the size of main window is not truncated, it extends to next page
automatically.
Secondary Window / Var Window : This is used to display fixed size data.
SE78 to upload our images from presentation server into application server.
SFSY All standard smart form variables are listed in this structure.
In forms text can be displayed through text editors only. On text editor variable has to be used
as a symbol.
Ex : &variablename& . &v1&
WINDOWS : 1. ADDRESS WINDOW : to display addresses from ADRC table of given address
number
Note : The logic of FINAL WINDOW is executed just before leaving the smart form .
In Smart forms layouts we can write all types logic in PROGRAM LINES.
DRIVER PROGRAM :
We can generate a print out based on smart form layout name by using a standard function
module 'SSF_FUNCTION_MODULE_NAME'.
TABLE PAINTER is used to display internal table data in table format on form page. Table should
be designed on MAIN WINDOW only. Table size should not exceeds window size. Each Table
comes with a default loop.
NOTE : In forms currency and quantity fields must be assigned with reference fields. They have
to be defined in GLOBAL DEFINITIONS on smart form layout.
TABLE TYPE : 1.HEADER (field names)
3.FOOTER(optional)
L2
RSTXPDFT4 : Standard program to convert form output from OTF format into PDF format.
Step 1: Execute driver program. Select New Spool Request & click on PRINT.
SMART STYLES are global , can be used in all smart form layouts. Whereas Paragraph &
Character display formats are local in SCRIPTS.
To print Barcode..
Main programs:
1.Executable programs :
Type 1.
Type M.
TCODE
FLE: screen specific editor which allows very limited keywords and logic. This un allowed logic
of FLE can be written in main program in terms of MODULE.
EVENTS OF F.L.E
2.P A I :Process After Input : executes just before leaving the screen
define screen
elements.
LAYOUT FLE
MODULE M1.
DATE = SY-DATUM.
ENDMODULE.
DATE: PBO.
PW: PAI.
MODULE M2.
Note : All screen elements must be defined in main program(SE38) with same names and
properties.
To develop an MPP:
NOTE : To design screen with data base table fields we can use F6 button. Through F6 button
all screen elements are created with DBT fields properties. Also these fields acts as a work area
with DBT name.
NOTE: Corresponding to the above screen work area we must have to define another work
area with same name by using a keyword TABLES.
TABLE CONTROL : Used to display data of internal table on screen in table format.
The screen with table control must contains LOOP in PBO and PAI.
In PBO loop data can be transferred from itab into table control.
In PAI loop data can be transferred from table control into itab.
VALIDATIONS:
SYNTAX: PAI.
Fieldname : to be validated
NOTE: To enable screen fields after throwing error message use CHAIN and ENDCHAIN.
subscreen 6100
subscreen 6200
tab1 tab2
* At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
START-OF-SELECTION.
" Convert Excel Data to SAP internal Table Data
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
i_line_header = p_head
i_tab_raw_data = it_raw " WORK TABLE
i_filename = p_file
TABLES
i_tab_converted_data = it_datatab[] "ACTUAL DATA
EXCEPTIONS
conversion_failed =1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
***********************************************************************
* END-OF-SELECTION.
END-OF-SELECTION.
" For sample, Excel Data transfered to internal table is displayed with write
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3.
ENDLOOP.
SAP FILE
BDC PROGRAM
NON SAP SAP DB
Always used to migrate or upload or transfer large amount of data from legacy system into
SAP data base.
MPP s were developed with validations like mandatory checks , date format checks and foreign
key checks etc.
File
upload Loop
ITAB wa
SQL X validations(MPP)
1. Flow
SAP Logic
DB of BDC Program:
**************************************************************************
**************************************************************************
File upload IT LOOP AT IT INTO WA
IT1(BDCDATA)
Procedure:
2.Record the transaction(MPP) in SHDB to collect technical information like program names,
field names, screen numbers and function codes.
Note :IT must be defined with FILE structure.IT1 must be defined with BDCDATA structure.
D).Prepare IT1 with screenplay of one data record through screens using recorded information.
F).REFRESH IT1.
G).ENDLOOP.
RECORDING (SHDB) : we record a transaction in SHDB to get technical info like Program
names, Field Names, Screen Numbers & Function Codes , which are useful to write a BDC
program.
BDC METHODS :
1.DIRECT INPUT METHOD : we use standard programs and function modules to transfer data
2.CALL TRANSACTION:
'BDC_CLOSE_GROUP'.---------->after loop
BDC
file
PROGRA
SAP DB
M(C.T)
******************************************************************************
BDC S2
file SAP DB
program(s
S3
ession)
S4
SM35
**********************************************************
OPEN DATASET 'ZJDEMO.TXT' FOR INPUT IN TEXT MODE ENCODING DEFAULT.(to upload)
**********************************************************
In LSMW we can transfer data by using STANDARD INPUT METHOD , BATCH INPUT METHOD
(SESSION),BAPI and IDOC.
SAP DBT
IT(ZSRC) IT1(ZREC)
i/p file
Note : No work area and LOOP are required to display ALV report.
To generate an ALV reports need standard data types and standard function modules.
ALV related data types are available in a type group called SLIS.
TYPE-GROUP: Is group of data types. Names of all data types of a type group has to start with
type group name.
To use data type of group we must have to link it in our program as follows.
FIELD CATALOG:
It is set of displaying properties of itab fields which are to displayed on output screen
HIERARCHICAL ALV : To display two internal tables data in hierarchical format i.e, header data
from IT1 and corresponding items details from IT2.
Procedure:
step2 :Extract data from two data base tables using FOR ALL ENTRIES concept.
step4 :Provide common key field information from IT1 & IT2.
'REUSE_ALV_HIERSEQ_LIST_DISPLAY'.
' REUSE_ALV_EVENTS_GET ' : Function Module to get all available events in ALV reports
'END_OF_PAGE'.
'TOP_OF_LIST'.
'END_OF_LIST'.
' USER_COMMAND'.
'OAER' / ‘OAOR’ - Tcode to upload bit map images into document server
Note : V2 holds selected line information like clicked column name, clicked value and
clicked line number ..etc.
Object (OO-ABAP):
Object Oriented ABAP Oriented ABAP
METHODS (PROPERTIES)
Note : In ABAP access modifiers have to be defined in the above order only.
Note : In ABAP multiple inheritance is not possible. Multi level inheritance is possible.
4.POLYMORPHISM : many forms of one method--->
DATA : V1,V2.
METHODS : M1,M2
EVENTS : E1,E2.
CLASS-DATA : V1,V2.
CLASS-METHODS : M1,M2
CLASS-EVENTS : E1,E2.
******************************************************************************
Static methods & variables can be accessed by Class & Object as well.
Importing , Exporting and Changing parameters can be passed by value as well reference also.
ONE METHOD CAN HAS ONLY ONE RETURNING PARAMETER(MAX).It can be called by value
only.
Procedure:
1.Define class with method names " class definition
3.Create object
4.Call methods
********************************************************************
SE38 :
3.Create Object
4.Call method
SE38 :
1.Create Object
2.Call method
***********************************************************************
SUPER : to call one method from parent class into its sub class method
Land _vehicle Truck
-Max_speed inheritance -Max_speed
-No_wheels -No_wheels
-No_plate -No_plate
-Capacity
Narrow Casting
Land_veh_obj Truck_obj
Wide Casting
Between these two objects, you can assign one to the other and at this point casting
occurs.
*If you assign truck_obj to land_vehicle_obj you lose the special attribute load_capacity
since you go from the specialized on to the general one. Thus, this is a narrowing cast.
* If you assign land_vehicle_obj and truck_obj you do not lose any attribute,
nevertheless you add a new one. Thus this is a widening cast.
Demo on "Narrow Casting"
Definition: The assignment of a subclass instance to a reference variable of the type "reference
to super class" is described as a narrowing cast, because you are switching from a more
detailed view to a one with less detail. It is also called as up-casting.
A user who is not interested in the finer points of cars, trucks, and busses (but only, for
example, in the fuel consumption and tank gauge) does not need to know about them. This user
only wants and needs to work with (references to) the lcl_vehicle(super class) class. However,
in order to allow the user to work with cars, busses, or trucks, you generally need a narrowing
cast.
1. In narrowing casting the object which is created with reference to the sub class is
assigned to the reference of type super class.
2. Using the super class reference it is possible to access the methods from the object
which are only defined at the super class.
3. This access is also called as generic access as super class is normally called as
general class.
Example:
Here method4 is the specific for the sub class and remaining methods are inherited from the
super class.
Narrowing cast:
1. By the super class reference (REF_VEHICLE) it is possible to access all the methods which
are defined at the super class but the implementations are taken from the sub class.
2. If any method is redefined at the sub class then that method’s implementation which exist at
the sub class is taken in to consideration.
Like:
Here we can access the implementation which exists at the sub class but not from the super
class.
3. It is not possible to access the methods which only defined in the sub class using the super
class reference.
Go to transaction SE38.
Now execute (F8):
Result:
Constructors:
special methods of a class are used to initialize the objects
1.Instance constructor: Object based, CONSTRUCTOR ,only inputs, executed for each object
EVENT HANDLING:
Exception Handling:
If Exception is not handled properly, then programs execution will be terminated.
Example:
msg_text = ex_ref->get_text( ).
ENDTRY.
IF NOT msg_text IS INITIAL.
WRITE / msg_text.
ELSE.
WRITE: / 'Result :', result.
ENDIF.
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Global classes: Can be defined and implemented globally in class builder(SE24). These
can be called into all programs.
We can Redefine Super class methods logic in Sub classes using INHERITANCE concept.
m1 m1
se38
obj1 OBJ2
******************************************************************************
Enhancements
******************************************************************************
Enhancements: To add extra custom logic for standard applications without disturbing
them. SAP provide enhancement provisions(EXITS) in standard programs where ABAP
consultants can add extra logic.
3.Empty Methods(BAdIs)
Types of Exits:
4.custom includes & append structures(Custom Includes starts with ' CI_XXXXX' )
Note : Custom Includes are provided by SAP for few standard tables through which we can add
new fields to them at mean position.
1.USER EXITS:
procedure 1.
procedure 2.(******)
Ex1. Implement Function exit for XD01 using CUSTOMER EXITS to download given customers
details into a local text file.
Ex2.Implement Menu exit for MC94 using CUSTOMER EXITs to add custom menu items to
standard menu bar.
Ex3.Implement Screen exit for VX11 using CUSTOMER EXITs to add a custom sub screen to its
standard screen
EXIT_SAPMM06E_006 ( PBO)
EXIT_SAPMM06E_012 logic to post data from custom subscreen into database table
BAdI uses abstract methods as enhancement provisions. These are object oriented approach
for enhancements. Multiple implementations are possible with BAdIs.
TYPES OF BAdIs
1.Multiple use BAdI : All implementations of this type BAdI executed one by one in alphabetical
order(Generally)
2.FilterBAdI: Among All implementations of this type BAdI ,only few will be executed which
satisfies given condition.
2.Goto SE80 , to search for available BAdIs from the above package.
Ex:
1.Implicit enhancement option : these are provided at the end of programs , end of FM , end of
subroutines. Provided by SAP inside the program.
These are provided by SAP at specific positions of a program explicitly. BAdI is also one kind of
explicitly provided enhancement option
1.Enhancement point (provided places) can' ve multiple active implementations
NOTE : Enhancement point STATIC contains one INCLUDE program for declarations
NOTE : Enhancement points and sections cannot be controlled where as BAdI can be controlled
Classical BAdI called by using CL_EXITHANDLER (proxy class) class and will take time
Kernel BAdI instances can be called by just Get BAdI ( a single step). Hence Kernel BADi is faster
than Classical BADi.
Enhancement spot is container of new BAdIs , Enhancement points & Enhancement sections.
To find Kernel BAdIs put break-point at GET BADI & CALL BADI statements.
Classical Badi:
1.'Fall back class'(If there is no active implementation present in badi, by default this class
implementation will be trigger) is not there.
2. By default interface and class will be generate(no need to mention it explicitly).
3. Syntax for calling classic badi is 'Call method'.
4. It is Slow(bcz by using cl_exithandler~get_instance we will instantiate the object for the badi).
QUESTIONS
partner1 partner2
Cross Applications
Synchronous Asynchronous
BAPI
EDI :(Electronic Data Interchange): It is non SAP technology. It uses EDI Subsystem to transfer
data between partner systems. It can convert data into different technologies. It converts data
from SAP format into FILE format.
ALE is SAP s own integrated technology. It can perform communication between SAP systems.
It transfers data in terms of messages. ALE uses IDoc as container to transfer data.
IDoc is a variable which can be prepared by using a data type 'IDOC TYPE'.
IDOCTYPE : It is used to prepare IDocs. It is group of segments. Each Segment is group of fields.
Example:
Example:
NOTE: Each IDOCTYPE must be linked with any one of the MESSAGE TYPE.
EDIMSG : Data Base table for all linked idoc types and message types.
Note:
In ALE we can transfer data always at application server level i.e across clients.
Each client must be assigned with an alias name called LOGICAL SYSTEM.
100 300
200 800
300 900
APS1 APS2
1.DATA RECORDS
2.CONTROL RECORD
3.STATUS RECORDS
12345 S2 100IN
SECOND DATA RECORD
IDOC IDOC
100 200
KNA1,KNBK KNA1,KNBK
NOTE : WE02 / WE05 TO VIEW SENT OR RECEIVED IDOCS( INBOX & OUTBOX OF IDOCS)
OUTBOUND :(800):
Note : Naming convention of logical system : 'server id' + 'CLNT' + client number.
Ex: ABCCLNT800
NOTE : SALE must be repeated in both clients if they exists in different servers.
3.WE21(Port Creation) The exit through which we can transfer IDoc to a specific partner
STATUS CODE CONVERSION PROGRAM (BD75): to add extra status code 12 to successfully sent
IDocs.
This program works only for IDoc which has final status code 3.It also displays not sent IDocs.
DB
Sr Rr Msg BD64
IDOCS
PORT1 PORT2 PORT3
INBOUND(810):
BDM2 (IDOC TRACING) : TO check I/B & O/B idoc details from sender system directly.This
option is possible due to a dummy message type SYNCH & idoc type SYNCHRON.
WE19 : Testing tool for reprocessing a received IDoc. And also used to change received
segments details and can reprocess that IDoc. Debugging of I/B IDoc process can be possible
with WE19.
******************************************************************************
5.WE05
NOTE : No Idocs will be generated by BD21 for no changes in master data in our system.
If changes made in child segment, then BD21 generates IDoc with Changed child segment and
mandatory Parent segment.
******************************************************************************
Note: If condition failed by mandatory segment then total IDoc can be dropped. Hence it was
named as IDOC FILTERING.
SEGMENT FILTERING: BD56: To remove unwanted segments for a specific partner from a
message type.
NOte : To hide unwanted segments like E1KNA11 & E1KNB5M from DEBMAS for 810 client
REDUCED MESSAGE TYPE: BD53(creating a new message type with required segments and
fields from a standard message type).This must be defined and configured in partner system
too with same name and properties.
Note : We have to configure reduced message type in BD64(sender system) and WE20 (receiver
system)
***************************************************************************
*********************************************************
CUSTOM IDOC:
Outbound Process:
Inbound Process:(810)
1.Create Data Base Table SE11 Ex : ZADMS
Extended Idoc: standard idoc type with custom segment ex: DEBMAS07 with
Z1STDS
IN BOUND PROCESS(810)
NOTE: VSV00001 is a customer exit where we can enhance customer outbound and inbound
programs.
RFC BAPI(FM------
interface
>METHOD)
APS2(SAP) JAVA(NONSAP)
An SAP partner can use data of another SAP partner system thru a remote FM.
This FM must be remote enabled and released. It supports SYNCHROUNOUS data transfer.
RFC FM SAP
BAPI
SAP FM FM-->METHOD
NONSAP
METHOD
ENDUSER ENDUSER
BAPI(SAP-NONSAP)
RFC(SAP-SAP)
APPLICATION SERVER
(ABAP PROCESSOR)
APS1(SAP SERVER1)
SAP DB
CUSTOM BAPI:
TABLES :
NOTE : we cannot use DDIC structures which has include and append structures as associated
types. Hence we must have to define a BAPI structure without includes and appends in SE11.
ex: ZBAPIKNA1.
8.Hence each BAPI FM must contains one mandatory export parameter RETURN of
10.We can convert the above FM into method in Business Object Builder(SWO1).
NOTE :ALL BDC programs depends on screen recordings. But few transactions are not handled
properly in recording. Hence we use BAPI as alternative concept for BDC to transfer data for
those transactions : ex: MM01,MIGO,MIRO...
In BAPI FM program we cannot use open SQL statements like 'COMMIT WORK' and 'ROLL
BACK'.
FILE---> ITAB
exporting ......
........ .
importing
RETURN = RETURN.
IF RETURN-TYPE = 'S'. " success
WRITE :/ RETURN-MESSAGE.
ENDIF.
ENDLOOP.
*&---------------------------------------------------------------------*
*& Report ZBAPI_UPLOAD
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZBAPI_UPLOAD.
TYPES : BEGIN OF TY_FILE,
MATNR TYPE MARA-MATNR,
MTART TYPE MARA-MTART,
MBRSH TYPE MARA-MBRSH,
MAKTX TYPE MAKT-MAKTX,
MEINS TYPE MARA-MEINS,
END OF TY_FILE.
DATA : I_FILE TYPE TABLE OF TY_FILE .
DATA : WA_FILE TYPE TY_FILE .
********BAPI VARIBALES
DATA : WA_HEADDATA TYPE BAPIMATHEAD,
WA_CLIENTDATA TYPE BAPI_MARA,
WA_CLIENTDATAX TYPE BAPI_MARAX,
I_MAKTX TYPE TABLE OF BAPI_MAKT,
WA_MAKTX TYPE BAPI_MAKT ,
I_RETURNMSGS TYPE TABLE OF BAPI_MATRETURN2,
WA_RETURNMSGS TYPE BAPI_MATRETURN2,
WA_RETURN TYPE BAPIRET2.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\MARA.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = I_FILE.
IF WA_RETURN-TYPE = 'S'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
WRITE : / WA_RETURN-MESSAGE .
ELSEIF WA_RETURN-TYPE = 'E'.
LOOP AT I_RETURNMSGS INTO WA_RETURNMSGS WHERE TYPE = 'E'.
WRITE : / WA_RETURNMSGS-MESSAGE COLOR 6 .
ENDLOOP.
ENDIF .
CLEAR : WA_FILE,
WA_HEADDATA,
WA_CLIENTDATA,
WA_CLIENTDATAX,
WA_MAKTX,
WA_RETURNMSGS,
WA_RETURN .
REFRESH : I_MAKTX , I_RETURNMSGS .
ENDLOOP .
REPORT ZBAPI_SALEORDER.
*********HRADER INFORMATION
HEADER-DOC_TYPE = 'TA'.
HEADER-SALES_ORG = '1000'.
HEADER-DISTR_CHAN = '12'.
HEADER-DIVISION = '00' .
HEADERX-DOC_TYPE = 'X'.
HEADERX-SALES_ORG = 'X'.
HEADERX-DISTR_CHAN = 'X'.
HEADERX-DIVISION = 'X' .
**************PARTNER INFORMATION
WA_PARTNERS-PARTN_ROLE = 'AG' .
WA_PARTNERS-PARTN_NUMB = '0000001175' .
APPEND WA_PARTNERS TO I_PARTNERS .
ORDER_HEADER_IN = HEADER
ORDER_HEADER_INX = HEADERX
IMPORTING
SALESDOCUMENT = V_VBELN
TABLES
RETURN = I_RETURN
ORDER_PARTNERS = I_PARTNERS .
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
* IMPORTING
* RETURN =
.
By using methods ALV reports can be displayed on dynamic screens along with additional
screen elements.
Procedure:
PRESENTATION SERVER:
APPLICATION SERVER: