Professional Documents
Culture Documents
Prog2
REPORT
Z9AMPROG2.
*data x type i. *data y type i. *data z type i. data : x type i, y type i, z type i. write / x. x = 10. y = 20. z = x + y. write z. write :/ 'sum of two numbers is ',z. write :/ 'sum of two numbers is ',z left-justified. write :/ 'sum of two numbers is ',z centered. data m type i value 12. write / m. m = 34. write / m. constants r type i value 20. write / r. *r = 44. data w type c. w = 'gensoft'. write / w. data h(10) type c. h = 'gensoft systems'. write / h. data n type string. n = 'gensoft systems'. write / n. data g type i. g = '123.45'. write / g. g = '123.56'. write / g. data v type p decimals 2. v = '123.458'. write / v.
Prog3
REPORT
Z9AMPROG3.
*parameters x type i. *parameters y type i. parameters : x type i obligatory default 20, y type i obligatory default 10.
if r1 = 'X'. z = x + y. write :/ 'sum is :',z. elseif r2 = 'X'. z = x - y. write :/ 'Difference is :',z. elseif r3 = 'X'. z = x * y. write :/ 'Product is :',z. elseif r4 = 'X'. z = x / y. write :/ 'Division is :',z. endif.
Prog4
REPORT
Z9AMPROG4.
parameters : x type i, y type i. data z type i. parameters : c1 c2 c3 c4 as as as as checkbox default 'X', checkbox, checkbox default 'X', checkbox.
if c1 = 'X'. z = x + y. write :/ 'sum is :',z. endif. if c2 = 'X'. z = x - y. if z < 0. write :/ 'Difference is -' no-gap,z no-sign left-justified. else. write :/ 'Difference is ',z. endif. endif. if c3 = 'X'. z = x * y. write :/ 'Product is :',z. endif. if c4 = 'X'. z = x / y. write :/ 'Division is :',z. endif.
Prog5
REPORT
Z9AMPROG5.
parameters : x type i, y type i, ch type i. data z type i. case ch. when 1. z = x + y. write :/ 'sum is :',z.
Prog6
REPORT
when 2. z = x - y. write :/ 'Difference is :',z. when 3. z = x * y. write :/ 'Product is :',z. when 4. z = x / y. write :/ 'Division is :',z. when 5. z = x mod y. write :/ 'Remainder is :',z. when others. message 'Invalid choice,please enter 1,2,3,4,5' type 'I'. endcase.
Z9AMPROG6.
parameters x type i. data z type i. z = x mod 2. write :/ 'before check'. check z eq 0. write :/ 'welcome'. write :/ 'hello'.
Prog7
REPORT
Z9AMPROG6.
parameters x type i. data z type i. z = x mod 2. write :/ 'before check'. check z eq 0. write :/ 'welcome'. write :/ 'hello'.
Prog8
REPORT
Z9AMPROG8.
parameters x type i. data : y type i value 1, z type i. while y <= 10. if y eq 4. continue. endif. z = x * y. write :/ x,'*',y,'=',z. y = y + 1. endwhile.
Prog9
REPORT
Z9AMPROG9.
Prog10
REPORT
Z9AMPROG10.
parameters x type i. data : y type i value 1, z type i. while y <= 10. if y eq 4. exit. endif. z = x * y. write :/ x,'*',y,'=',z. y = y + 1. endwhile. write :/ 'end of program'. exit. write :/ 'welcome'. write :/ 'hello'.
Prog11
REPORT
Z9AMPROG11.
parameters x type i. data : y type i value 1, z type i. do 20 times. z = x * y. write :/ x,'*',y,'=',z. y = y + 1. enddo.
Prog12
REPORT Z9AMPROG12.
parameters x type i. data : y type i value 1, z type i. do. z = x * y. write :/ x,'*',y,'=',z,sy-index. y = y + 1. if y gt 10. exit. endif. enddo.
Prog13
REPORT
Z9AMPROG13.
data : x type i value 10, y type i. write :/ x,y. y = x. write :/ x,y. x = 20. write :/ x,y. field-symbols <abc>. *<abc> = x. assign x to <abc>. write :/ x,<abc>. x = 30. write :/ x,<abc>. <abc> = 40. write :/ x,<abc>. data m(20) type c value 'Gensoft'. assign m to <abc>. write :/ x,m,<abc>.
Prog14
REPORT
Z9AMPROG14.
write :/ sy-repid,sy-datum,sy-uzeit. data x type d value '20121227'. "yyyymmdd write / x. write /(10) x. write /(10) x using edit mask '__/__/____'. data y type t value '102543'. write / y. write /(8) y. write /(8) y using edit mask '__-__-__'. write /(10) y using edit mask '__-__-__'.
Prog15
REPORT
Z9AMPROG15.
write :/ 'inside program 15'. *submit z9amprog16. submit z9amprog16 and return. write :/ 'end of program 15'.
Prog16
REPORT Z9AMPROG16.
Prog17
REPORT Z9AMPROG17.
export x to memory id 'A1'. export y to memory id 'A2'. submit z9amprog18 and return. import z from memory id 'A3'. write :/ 'sum is :',z.
Prog18
REPORT Z9AMPROG18.
data : x type i, y type i, z type i. import x from memory id 'A1'. import y from memory id 'A2'. z = x + y. export z to memory id 'A3'.
Prog19
REPORT Z9AMPROG19.
Prog20
REPORT Z9AMPROG20.
parameters str type string. data len type i. len = strlen( str ). data x type c. x = str+0(1). translate x to upper case. data pos type i. pos = len - 1. data y type string. y = str+1(pos). translate y to lower case. clear str. concatenate x y into str. write / str.
Prog21
REPORT Z9AMPROG21.
data : str type string value 'Genesis@Software@Systems', str1 type string, str2 type string, str3 type string. write :/ 'str1 is :',str1, / 'str2 is :',str2,
/ 'str3 is :',str3. uline. split str at '@' into str1 str2. write :/ 'str1 is :',str1, / 'str2 is :',str2, / 'str3 is :',str3. uline. clear : str1,str2,str3. write :/ 'str1 is :',str1, / 'str2 is :',str2, / 'str3 is :',str3. uline. split str at '@' into str1 str2 str3. write :/ 'str1 is :',str1, / 'str2 is :',str2, / 'str3 is :',str3.
Prog22
REPORT
Z9AMPROG22.
data str type string value 'Genesis Software Systems'. write str. replace 's' in str with 'k'. write / str. str = 'Genesis Software Systems'. write / str. replace all occurrences of 's' in str with 'k'. write / str. str = 'Genesis Software Systems'. write / str. replace all occurrences of 's' in str with 'k' ignoring case. write / str.
Prog23
REPORT
Z9AMPROG23.
data str type string value 'Genesis'. write str. shift str. write / str. str = 'Genesis'. write / str. shift str by 2 places. write / str. str = 'Genesis'. write / str. shift str by 2 places right. write / str. str = 'Genesis'. write / str. shift str by 2 places circular. write / str.
Prog24
REPORT
Z9AMPROG24.
data : str1 type string value 'Genesis software Systems', str2 type string value 'Wipro Technologies'. write str1.
Prog25
REPORT
Z9AMPROG25.
data str type string value 'Genesis software Systems'. write str. condense str no-gaps. write / str.
Prog26
REPORT
Z9AMPROG26.
Prog27
REPORT
Z9AMPROG27.
Prog28
REPORT
Z9AMPROG28.
data : begin of emp, empno type i, ename(20) type c, end of emp. write :/ emp-empno, emp-ename. emp-empno = 5. emp-ename = 'raju'. write :/ emp-empno, emp-ename. data emp1 like emp. write :/ 'EMP1 structure'. write :/ emp1-empno, emp1-ename. emp1 = emp. write :/ 'EMP1 structure after assignment'. write :/ emp1-empno, emp1-ename. clear emp1. write :/ 'EMP1 structure after clear'. write :/ emp1-empno, emp1-ename. move emp to emp1. write :/ 'EMP1 structure after move'. write :/ emp1-empno, emp1-ename. clear emp1. write :/ 'EMP1 structure after clear'. write :/ emp1-empno, emp1-ename.
move-corresponding emp to emp1. write :/ 'EMP1 structure after move corresponding'. write :/ emp1-empno, emp1-ename.
Prog29
REPORT
Z9AMPROG29.
data : begin of emp, empno type i, ename(20) type c, end of emp. data : begin of dept, deptno type i, dname(10) type c, loc(20) type c, end of dept. emp-empno = 2. emp-ename = 'rajesh khanna'. move emp to dept. write :/ 'DEPT structure'. write :/ dept-deptno, dept-dname, dept-loc.
Prog30
REPORT
Z9AMPROG30.
data : begin of emp, empno type i, ename(20) type c, end of emp. emp-empno = 5. emp-ename = 'raju'. data : begin of dept, dname(20) type c, deptno type i, loc(30) type c, ename(20) type c, end of dept. move-corresponding emp to dept. write :/ 'DEPT structure'. write :/ dept-dname, dept-deptno, dept-loc, dept-ename.
Prog31
REPORT Z9AMPROG31.
data : begin of emp, empno(3) type c, ename(20) type c, end of emp. emp-empno = 'A12'.
emp-ename = 'raju'. data : begin of dept, dname(20) type c, deptno type i, loc(30) type c, empno type i, end of dept. move-corresponding emp to dept. write :/ 'DEPT structure'. write :/ dept-dname, dept-deptno, dept-loc, dept-empno.
Prog32
REPORT Z9AMPROG32.
data : begin of emp, empno type i, ename(20) type c, begin of dept, deptno type i, dname(20) type c, end of dept, empdesig(30) type c, end of emp. emp-empno = 6. emp-ename = 'raju'. emp-dept-deptno = 10. emp-dept-dname = 'sales'. emp-empdesig = 'ceo'. write :/ emp-empno, / emp-ename, / emp-dept-deptno, / emp-dept-dname, / emp-empdesig.
Prog33
REPORT Z9AMPROG33.
data : begin of dept, deptno type i, dname(20) type c, end of dept. data : begin of emp, empno type i. include structure data : empdesig(30) type c, end of emp. emp-empno = 5. emp-deptno = 10. emp-dname = 'sales'. emp-empdesig = 'mnager'. write :/ emp-empno,
dept.
Prog34
REPORT Z9AMPROG34.
data : begin of emp occurs 0, empno type i, ename(20) type c, empdesig(20) type c, end of emp. write :/ emp-empno,emp-ename,emp-empdesig. emp-empno = 6. emp-ename = 'raju'. emp-empdesig = 'ceo'. append emp. clear emp. emp-empno = 3. emp-ename = 'kiran'. emp-empdesig = 'manager'. append emp. clear emp. emp-empno = 8. emp-ename = 'ramesh'. emp-empdesig = 'employee'. append emp. clear emp. emp-empno = 7. emp-ename = 'srinivas'. emp-empdesig = 'employee'. append emp. write :/ emp-empno,emp-ename,emp-empdesig. uline. loop at emp. write :/ emp-empno,emp-ename,emp-empdesig. endloop. uline. loop at emp where empdesig = 'employee'. write :/ emp-empno,emp-ename,emp-empdesig. endloop. uline. loop at emp from 2 to 4. write :/ emp-empno,emp-ename,emp-empdesig. endloop. uline. loop at emp. write :/ sy-index,sy-tabix. endloop.
Prog35
REPORT Z9AMPROG35.
data : begin of emp occurs 0, empno type i, ename(20) type c, empdesig(20) type c, end of emp. clear emp. emp-empno = 6. emp-ename = 'raju'. emp-empdesig = 'ceo'. append emp. clear emp. emp-empno = 3. emp-ename = 'kiran'. emp-empdesig = 'manager'. append emp. clear emp. emp-empno = 8. emp-ename = 'ramesh'. emp-empdesig = 'employee'. append emp. clear emp. emp-empno = 7. emp-ename = 'srinivas'. emp-empdesig = 'employee'. append emp. uline. loop at emp. write :/ emp-empno,emp-ename,emp-empdesig. endloop. uline. sort emp. write :/ 'Data after sorting'. loop at emp. write :/ emp-empno,emp-ename,emp-empdesig. endloop. uline. *Sort emp by empno. Sort emp by empno descending. write :/ 'Data after sorting on empno'. loop at emp. write :/ emp-empno,emp-ename,emp-empdesig. endloop.
Prog36
REPORT
Z9AMPROG36.
data : begin of emp, empno type i, ename(20) type c, end of emp. data lt_emp like emp occurs 0 with header line. clear lt_emp. lt_emp-empno = 5. lt_emp-ename = 'raju'. append lt_emp. clear lt_emp. lt_emp-empno = 15. lt_emp-ename = 'ravi'. append lt_emp. clear lt_emp. lt_emp-empno = 3. lt_emp-ename = 'ramu'. append lt_emp. loop at lt_emp. write :/ lt_emp-empno, lt_emp-ename. endloop.
Prog37
REPORT Z9AMPROG37.
data : begin of emp, empno type i, ename(20) type c, end of emp. data: lt_emp like emp occurs 0. clear lt_emp. lt_emp-empno = 6. lt_emp-ename = 'raju'. append emp to lt_emp.
Prog38
REPORT Z9AMPROG38.
data : begin of emp, empno type i, ename(20) type c, end of emp. data : lt_emp like emp occurs 0. clear emp. emp-empno = 4. emp-ename = 'ravi'. append emp to lt_emp.
clear emp. emp-empno = 3. emp-ename = 'ramu'. append emp to lt_emp. clear emp. emp-empno = 5. emp-ename = 'rajesh'. append emp to lt_emp. loop at lt_emp into emp. write :/ emp-empno, emp-ename. endloop.
Prog39
REPORT Z9AMPROG39.
types : begin of ty_emp, empno type i, ename(20) type c, empdesig(25) type c, end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. clear ls_emp. ls_emp-empno = 6. ls_emp-ename = 'raju'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 16. ls_emp-ename = 'ravi'. ls_emp-empdesig = 'CEO'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 3. ls_emp-ename = 'kiran'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. endloop. data gt_emp type table of ty_emp. describe table gt_emp. write :/ 'No of records in gt_emp:',sy-tfill. uline. gt_emp[] = lt_emp[]. describe table gt_emp. write :/ 'No of records in gt_emp after assignment:',sy-tfill.
uline. clear gt_emp[]. describe table gt_emp. write :/ 'No of records in gt_emp after clear:',sy-tfill. uline. append lines of lt_emp to gt_emp. describe table gt_emp. write :/ 'No of records in gt_emp after append lines:',sy-tfill. uline. refresh gt_emp. describe table gt_emp. write :/ 'No of records in gt_emp after refresh:',sy-tfill. uline. append lines of lt_emp from 2 to 3 to gt_emp. describe table gt_emp. write :/ 'No of records in gt_emp after append lines of specific indexes:',sy-tfill. uline. free gt_emp. describe table gt_emp. write :/ 'No of records in gt_emp after free:',sy-tfill.
Prog40
REPORT Z9AMPROG40.
types : begin of ty_emp, empno type i, ename(20) type c, empdesig(25) type c, end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. clear ls_emp. ls_emp-empno = 6. ls_emp-ename = 'raju'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 16. ls_emp-ename = 'ravi'. ls_emp-empdesig = 'CEO'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 3. ls_emp-ename = 'kiran'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 17. ls_emp-ename = 'raju'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp.
clear ls_emp. ls_emp-empno = 9. ls_emp-ename = 'ravi'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. endloop. sort lt_emp by ename. delete adjacent duplicates from lt_emp comparing ename. uline. write :/ 'Internal table after deleting adjacent duplicates'. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. endloop.
Prog41
REPORT Z9AMPROG41.
types : begin of ty_emp, empno type i, ename(20) type c, empdesig(30) type c, end of ty_emp. data : lt_emp type standard table of ty_emp with NON-unique key empno, ls_emp type ty_emp. clear ls_emp. ls_emp-empno = 6. ls_emp-ename = 'raju'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 3. ls_emp-ename = 'ravi'. ls_emp-empdesig = 'ceo'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 4. ls_emp-ename = 'ashok'. ls_emp-empdesig = 'employee'. append ls_emp to lt_emp. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig.
endloop. uline. sort lt_emp. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. endloop. uline. read table lt_emp into ls_emp index 2. if sy-subrc eq 0. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. else. write :/ 'Second record not found'. endif. uline. read table lt_emp into ls_emp with key empno = 34. if sy-subrc eq 0. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. else. * write :/ 'no record found with empno 6'. message s001(z9ammsg). endif. uline. read table lt_emp into ls_emp with key empno = 6 binary search. if sy-subrc eq 0. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. else. write :/ 'no record found with empno 6'. endif. uline. clear ls_emp. read table lt_emp into ls_emp with key empno = 3 binary search transporting ename. if sy-subrc eq 0. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. else. write :/ 'no record found with empno 6'. endif. uline. clear ls_emp. read table lt_emp if sy-subrc eq 0.
write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. else. write :/ 'no record found with empno 6'. endif.
Prog42
REPORT Z9AMPROG42.
types : begin of ty_emp, empno type i, ename(20) type c, empdesig(30) type c, end of ty_emp. data : lt_emp type sorted table of ty_emp with unique key empno, ls_emp type ty_emp. clear ls_emp. ls_emp-empno = 6. ls_emp-ename = 'raju'. ls_emp-empdesig = 'manager'. insert ls_emp into lt_emp. clear ls_emp. ls_emp-empno = 13. ls_emp-ename = 'ravi'. ls_emp-empdesig = 'ceo'. insert ls_emp into lt_emp. clear ls_emp. ls_emp-empno = 14. ls_emp-ename = 'ashok'. ls_emp-empdesig = 'employee'. insert ls_emp into lt_emp. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. endloop. *uline. *sort lt_emp. *loop at lt_emp into ls_emp. * write :/ ls_emp-empno, * ls_emp-ename, * ls_emp-empdesig. *endloop. * *uline. *read table lt_emp into ls_emp index 2. *if sy-subrc eq 0. * write :/ ls_emp-empno, * ls_emp-ename, * ls_emp-empdesig. *else. * write :/ 'Second record not found'.
*endif. * *uline. *read table lt_emp into ls_emp with key empno = 6. *if sy-subrc eq 0. * write :/ ls_emp-empno, * ls_emp-ename, * ls_emp-empdesig. *else. * write :/ 'no record found with empno 6'. *endif. * *uline. *read table lt_emp into ls_emp with key empno = 6 * binary search. *if sy-subrc eq 0. * write :/ ls_emp-empno, * ls_emp-ename, * ls_emp-empdesig. *else. * write :/ 'no record found with empno 6'. *endif. * *uline. *clear ls_emp. *read table lt_emp into ls_emp with key empno = 3 * binary search * transporting ename. *if sy-subrc eq 0. * write :/ ls_emp-empno, * ls_emp-ename, * ls_emp-empdesig. *else. * write :/ 'no record found with empno 6'. *endif. * *uline. *clear ls_emp. *read table lt_emp with key empno = 4 * binary search * transporting no fields. *if sy-subrc eq 0. * write :/ ls_emp-empno, * ls_emp-ename, * ls_emp-empdesig. *else. * write :/ 'no record found with empno 6'. *endif.
Prog43
REPORT Z9AMPROG43.
types : begin of ty_emp, empno type i, ename(20) type c, empdesig(30) type c, end of ty_emp. data : lt_emp type sorted table of ty_emp with unique key empno,
ls_emp type ty_emp. clear ls_emp. ls_emp-empno = 6. ls_emp-ename = 'raju'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 13. ls_emp-ename = 'ravi'. ls_emp-empdesig = 'ceo'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 9. ls_emp-ename = 'ashok'. ls_emp-empdesig = 'employee'. append ls_emp to lt_emp.
Prog44
REPORT Z9AMPROG44.
types : begin of ty_emp, empno type i, ename(20) type c, empdesig(30) type c, end of ty_emp. data : lt_emp type sorted table of ty_emp with unique key empno, ls_emp type ty_emp. clear ls_emp. ls_emp-empno = 6. ls_emp-ename = 'raju'. ls_emp-empdesig = 'manager'. insert ls_emp into table lt_emp. clear ls_emp. ls_emp-empno = 13. ls_emp-ename = 'ravi'. ls_emp-empdesig = 'ceo'. insert ls_emp into table lt_emp. clear ls_emp. ls_emp-empno = 9. ls_emp-ename = 'ashok'. ls_emp-empdesig = 'employee'. insert ls_emp into table lt_emp. clear ls_emp. ls_emp-empno = 9. ls_emp-ename = 'ashok1'. ls_emp-empdesig = 'employee'. insert ls_emp into table lt_emp. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename,
endloop.
ls_emp-empdesig.
*sort lt_emp by empdesig. read table lt_emp into ls_emp index 2. read table lt_emp into ls_emp with key empno = 13. read table lt_emp into ls_emp with key empno = 13 binary search.
Prog45
REPORT Z9AMPROG44.
types : begin of ty_emp, empno type i, ename(20) type c, empdesig(30) type c, end of ty_emp. data : lt_emp type sorted table of ty_emp with unique key empno, ls_emp type ty_emp. clear ls_emp. ls_emp-empno = 6. ls_emp-ename = 'raju'. ls_emp-empdesig = 'manager'. insert ls_emp into table lt_emp. clear ls_emp. ls_emp-empno = 13. ls_emp-ename = 'ravi'. ls_emp-empdesig = 'ceo'. insert ls_emp into table lt_emp. clear ls_emp. ls_emp-empno = 9. ls_emp-ename = 'ashok'. ls_emp-empdesig = 'employee'. insert ls_emp into table lt_emp. clear ls_emp. ls_emp-empno = 9. ls_emp-ename = 'ashok1'. ls_emp-empdesig = 'employee'. insert ls_emp into table lt_emp. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. endloop. *sort lt_emp by empdesig. read table lt_emp into ls_emp index 2. read table lt_emp into ls_emp with key empno = 13.
read table lt_emp into ls_emp with key empno = 13 binary search.
Prog46
REPORT Z9AMPROG46.
types : begin of ty_emp, empno type i, ename(20) type c, empdesig(30) type c, end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. clear ls_emp. ls_emp-empno = 5. ls_emp-ename = 'raju'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 15. ls_emp-ename = 'ravi'. ls_emp-empdesig = 'ceo'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 3. ls_emp-ename = 'vamshi'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 9. ls_emp-ename = 'kiran'. ls_emp-empdesig = 'employee'. append ls_emp to lt_emp. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. endloop. loop at lt_emp into ls_emp. if ls_emp-empdesig = 'manager'. ls_emp-empdesig = 'Sr.manager'. * modify lt_emp from ls_emp. modify lt_emp from ls_emp transporting empdesig. endif. endloop. uline. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. endloop.
Prog47
REPORT Z9AMPROG47.
types : begin of ty_emp, empno type i, ename(20) type c, empdesig(30) type c, end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. clear ls_emp. ls_emp-empno = 5. ls_emp-ename = 'raju'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 15. ls_emp-ename = 'ravi'. ls_emp-empdesig = 'ceo'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 3. ls_emp-ename = 'vamshi'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 9. ls_emp-ename = 'kiran'. ls_emp-empdesig = 'employee'. append ls_emp to lt_emp. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. endloop. clear ls_emp. ls_emp-empdesig = 'Sr.manager'. modify lt_emp from ls_emp transporting empdesig where empdesig = 'manager'. uline. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. endloop.
Prog48
REPORT Z9AMPROG48.
types : begin of ty_emp, empno type i, ename(20) type c, empdesig(30) type c, end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. field-symbols <abc> like line of lt_emp. clear ls_emp. ls_emp-empno = 5. ls_emp-ename = 'raju'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 15. ls_emp-ename = 'ravi'. ls_emp-empdesig = 'ceo'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 3. ls_emp-ename = 'vamshi'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 9. ls_emp-ename = 'kiran'. ls_emp-empdesig = 'employee'. append ls_emp to lt_emp. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. endloop. loop at lt_emp assigning <abc>. if <abc>-empdesig = 'manager'. <abc>-empdesig = 'Sr.Manager'. endif. endloop. uline. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. endloop.
Prog49
REPORT Z9AMPROG49.
end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. clear ls_emp. ls_emp-empsal = 500. ls_emp-ename = 'raju'. collect ls_emp into lt_emp. clear ls_emp. ls_emp-empsal = 1500. ls_emp-ename = 'ravi'. collect ls_emp into lt_emp. clear ls_emp. ls_emp-empsal = 3400. ls_emp-ename = 'raju'. collect ls_emp into lt_emp. clear ls_emp. ls_emp-empsal = 2000. ls_emp-ename = 'ramesh'. collect ls_emp into lt_emp. clear ls_emp. ls_emp-empsal = 6000. ls_emp-ename = 'ravi'. collect ls_emp into lt_emp. * loop at lt_emp into ls_emp. write :/ ls_emp-empsal, ls_emp-ename. endloop.
Prog50
REPORT Z9AMPROG50.
type-pools z9typ. write z9typ_y. data lt_emp type table of z9typ_emp. data ls_emp type z9typ_emp.
Prog51
REPORT Z9AMPROG51.
data : lt_emp type z9amttype, * ls_emp type z9amstype, ls_emp like line of lt_emp. clear ls_emp. ls_emp-empno = 6. ls_emp-ename = 'raju'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 16.
ls_emp-ename = 'ravi'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 10. ls_emp-ename = 'ramu'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename, ls_emp-empdesig. endloop.
Prog52
REPORT Z9AMPROG52.
write :/ 'welcome'. perform abc. write :/ 'hello'. perform abc. write :/ 'Hai'. form abc. write :/ 'ABAP'. write :/ 'OOPS ABAP'. write :/ 'CROSS APPS'. endform.
Prog53
REPORT Z9AMPROG53.
PROGRAM
Z9AMPOOL.
form abc. write :/ 'inside abc'. endform. form pqr. write :/ 'inside pqr'. endform.
Prog54
REPORT Z9AMPROG54.
data : x type i value 10, y type i value 5. perform abc using x y. "actual parameters *write :/ 'sum is :',z. perform abc using 30 40.
form abc using m n. data z type i. "local variables z = m + n. write :/ 'sum is :',z. endform.
Prog55
REPORT data : x y m n Z9AMPROG55. type type type type i value 10, i value 5, i, i.
perform abc using x y changing m n. write :/ m,n. form abc using r1 r2 r3 = r1 + r2. r4 = r1 - r2. endform. changing r3 r4.
Prog56
REPORT Z9AMPROG56.
data : x type i value 10, y type i value 20. write :/ 'X and Y before subroutine call :',x,y. perform abc using x y. write :/ 'X and Y after subroutine call :',x,y. form abc using m n. data z type i. z = m. m = n. n = z. endform.
Prog57
REPORT Z9AMPROG57.
data : x type i value 10, y type i value 20. write :/ 'X and Y before subroutine call :',x,y. perform abc using x y. write :/ 'X and Y after subroutine call :',x,y. form abc using value(m) value(n). data z type i. z = m. m = n. n = z. endform.
Prog58
REPORT Z9AMPROG58.
types : begin of ty_emp, empno type i, ename(20) type c, end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. clear ls_emp. ls_emp-empno = 4. ls_emp-ename = 'raju'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 14. ls_emp-ename = 'ravi'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 3. ls_emp-ename = 'srinivas'. append ls_emp to lt_emp. perform abc tables lt_emp. form abc tables gt_emp. describe table gt_emp. write :/ 'No of records :',sy-tfill. endform.
Prog59
REPORT Z9AMPROG59.
types : begin of ty_emp, empno type i, ename(20) type c, end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. clear ls_emp. ls_emp-empno = 4. ls_emp-ename = 'raju'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 14. ls_emp-ename = 'ravi'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 3. ls_emp-ename = 'srinivas'. append ls_emp to lt_emp.
describe table lt_emp. write :/ 'No of records in lt_emp :',sy-tfill. perform abc tables lt_emp. describe table lt_emp. write :/ 'No of records in lt_emp :',sy-tfill. form abc tables gt_emp structure ls_emp. delete gt_emp where empno = 14. endform.
Prog60
REPORT Z9AMPROG60.
Prog61
REPORT Z9AMPROG61.
include z9aminc1.
start-of-selection. write :/ 'hello'. x = 10. perform abc. data x type i. form abc. write :/ 'inside abc'. endform.
Prog62
REPORT Z9AMPROG62.
parameters : p_x type i, p_y type i. data : lv_r1 type i, lv_r2 type i. CALL FUNCTION 'Z9AMFM1' EXPORTING I_X = p_x I_Y = p_y IMPORTING E_R1 = lv_r1 E_R2 = lv_r2. . write :/ lv_r1,lv_r2.
Prog63
REPORT Z9AMPROG63.
parameters : p_x type i, p_y type i. CALL FUNCTION 'Z9AMFM2' EXPORTING I_X = p_x CHANGING C_Y = p_y. write :/ p_y.
Prog64
REPORT Z9AMPROG64.
types : begin of ty_emp. include structure zemp. types end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. clear ls_emp. ls_emp-empno = '11'. ls_emp-ename = 'raju'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = '10'. ls_emp-ename = 'ravi'. ls_emp-empdesig = 'ceo'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = '13'. ls_emp-ename = 'ayub'. ls_emp-empdesig = 'supervisor'. append ls_emp to lt_emp.
clear ls_emp. ls_emp-empno = '3'. ls_emp-ename = 'vamshi'. ls_emp-empdesig = 'manager'. append ls_emp to lt_emp. CALL FUNCTION 'Z9AMFM3' TABLES T_EMP = lt_emp[].
Prog65
REPORT Z9AMPROG65.
define abc. &3 = &1 + &2. &4 = &1 - &2. end-of-definition. data : lv_r1 type i, lv_r2 type i. abc 20 10 lv_r1 lv_r2. write :/ lv_r1,lv_r2. abc 30 5 lv_r1 lv_r2. write :/ lv_r1,lv_r2.
Prog66
REPORT ZCALL_TABLEMAINTAINANCE.
Prog67
REPORT ZCALL_TABLEMAINTAINANCE1.
parameters p_empno type z8amemp-empno. * Lock a particular row CALL FUNCTION 'ENQUEUE_EZEMP' EXPORTING EMPNO = p_empno. CALL FUNCTION 'VIEW_MAINTENANCE_CALL' EXPORTING ACTION SHOW_SELECTION_POPUP VIEW_NAME CALL FUNCTION 'DEQUEUE_EZEMP' EXPORTING EMPNO = p_empno.
Prog68
REPORT
Z9AMPROG66.
parameters p_x type i. data : lv_y(25) type c, lv_z(25) type c. select single ename empdesig from z9amemp into (lv_y,lv_z) where empno = p_x. if sy-subrc eq 0. write :/ lv_y,lv_z. else. write :/ 'No record'. endif.
Prog69
REPORT Z9AMPROG67.
parameters p_x type z9amemp-empno. data : lv_y type z9amemp-ename, lv_z type z9amemp-empdesig. select single ename empdesig from z9amemp into (lv_y,lv_z) where empno = p_x. if sy-subrc eq 0. write :/ lv_y,lv_z. else. write :/ 'No record'. endif.
Prog70
REPORT Z9AMPROG68.
parameters p_empno type z9amemp-empno. data : lv_ename type z9amemp-ename, lv_desig type z9amemp-empdesig. select single ename empdesig from z9amemp into (lv_ename,lv_desig) where empno = p_empno. if sy-subrc eq 0. write :/ lv_ename,lv_desig. else. write :/ 'No record'. endif.
Prog71
REPORT Z9AMPROG69.
ename type z9amemp-ename, desig type z9amemp-empdesig, end of ty_emp. data ls_emp type ty_emp. select single ename empdesig from z9amemp into ls_emp where empno = p_empno. if sy-subrc eq 0. write :/ ls_emp-ename, ls_emp-desig. else. write :/ 'No record'. endif.
Prog72
REPORT Z9AMPROG70.
parameters p_empno type z9amemp-empno. types : begin of ty_emp. include structure z9amemp. types end of ty_emp. data ls_emp type ty_emp. select single * from z9amemp into ls_emp where empno = p_empno. if sy-subrc eq 0. write :/ ls_emp-ename, ls_emp-empdesig, ls_emp-empsal. else. write :/ 'No record'. endif.
Prog73
REPORT Z9AMPROG71.
types : begin of ty_emp. include structure z9amemp. types end of ty_emp. data ls_emp type ty_emp. select single * from z9amemp into ls_emp where empdesig = 'CEO'. if sy-subrc eq 0. write :/ ls_emp-ename, ls_emp-empdesig, ls_emp-empsal. else. write :/ 'No record'. endif.
Prog74
REPORT
Z9AMPROG72.
types : begin of ty_emp. include structure z9amemp. types end of ty_emp. data ls_emp type ty_emp. select * from z9amemp into ls_emp where empdesig = 'CEO'. write :/ ls_emp-ename, ls_emp-empdesig, ls_emp-empsal. endselect.
Prog75
REPORT Z9AMPROG73.
types : begin of ty_emp. include structure z9amemp. types end of ty_emp. data lt_emp type table of ty_emp. data ls_emp type ty_emp. select * from z9amemp into table lt_emp where empdesig = 'CEO'. if sy-subrc eq 0. loop at lt_emp into ls_emp. write :/ ls_emp-ename, ls_emp-empdesig, ls_emp-empsal. endloop. endif.
Prog76
REPORT Z9AMPROG74.
types : begin of ty_emp. include structure z9amemp. types end of ty_emp. data lt_emp type table of ty_emp. data ls_emp type ty_emp. select * from z9amemp into table lt_emp where empno in (18,19,88,94). if sy-subrc eq 0. loop at lt_emp into ls_emp. write :/ ls_emp-ename, ls_emp-empdesig, ls_emp-empsal. endloop. endif.
Prog77
REPORT Z9AMPROG75.
types : begin of ty_emp. include structure z9amemp. types end of ty_emp. data lt_emp type table of ty_emp. data ls_emp type ty_emp. select * from z9amemp into table lt_emp where empno between 15 and 100. if sy-subrc eq 0. loop at lt_emp into ls_emp. write :/ ls_emp-ename, ls_emp-empdesig, ls_emp-empsal. endloop. endif.
Prog78
REPORT Z9AMPROG76.
tables z9amemp. types : begin of ty_emp, ename type z9amemp-ename, empdesig type z9amemp-empdesig, end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. select-options so_empno for z9amemp-empno. select ename empdesig from z9amemp into table lt_emp where empno in so_empno. if sy-subrc eq 0. loop at lt_emp into ls_emp. write :/ ls_emp-ename, ls_emp-empdesig. endloop. else. write :/ 'No data found'. endif.
Prog79
REPORT Z9AMPROG77.
types : begin of ty_emp, ename type z9amemp-ename, empdesig type z9amemp-empdesig, end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. data lv_empno type z9amemp-empno. select-options so_empno for lv_empno. select ename empdesig from z9amemp
into table lt_emp where empno in so_empno. if sy-subrc eq 0. loop at lt_emp into ls_emp. write :/ ls_emp-ename, ls_emp-empdesig. endloop. else. write :/ 'No data found'. endif.
Prog80
REPORT Z9AMPROG78.
types : begin of ty_emp, ename type z9amemp-ename, empdesig type z9amemp-empdesig, end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. data lv_empno type z9amemp-empno. select-options so_empno for lv_empno. initialization. so_empno-low = 18. so_empno-high = 95. append so_empno. start-of-selection. select ename empdesig from z9amemp into table lt_emp where empno in so_empno. if sy-subrc eq 0. loop at lt_emp into ls_emp. write :/ ls_emp-ename, ls_emp-empdesig. endloop. else. write :/ 'No data found'. endif.
Prog81
REPORT Z9AMPROG79.
types : begin of ty_emp, ename type z9amemp-ename, empdesig type z9amemp-empdesig, end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. data lv_empno type z9amemp-empno. select-options so_empno for lv_empno. initialization. so_empno-sign = 'E'.
so_empno-low = 19. so_empno-high = 88. append so_empno. start-of-selection. select ename empdesig from z9amemp into table lt_emp where empno in so_empno. if sy-subrc eq 0. loop at lt_emp into ls_emp. write :/ ls_emp-ename, ls_emp-empdesig. endloop. else. write :/ 'No data found'. endif.
Prog81
REPORT Z9AMPROG80.
types : begin of ty_emp, ename type z9amemp-ename, empdesig type z9amemp-empdesig, end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. data lv_empno type z9amemp-empno. select-options so_empno for lv_empno no-extension. *select-options so_empno for lv_empno no intervals no-extension. initialization. so_empno-low = 18. so_empno-high = 50. append so_empno. start-of-selection. select ename empdesig from z9amemp into table lt_emp where empno in so_empno. if sy-subrc eq 0. loop at lt_emp into ls_emp. write :/ ls_emp-ename, ls_emp-empdesig. endloop. else. write :/ 'No data found'. endif.
Prog82
REPORT Z9AMPROG81.
types : begin of ty_emp, ename type z9amemp-ename, empdesig type z9amemp-empdesig, end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. ranges r_empno for z9amemp-empno. start-of-selection.
r_empno-low = 1. r_empno-high = 50. append r_empno. select ename empdesig from z9amemp into table lt_emp where empno in r_empno. if sy-subrc eq 0. loop at lt_emp into ls_emp. write :/ ls_emp-ename, ls_emp-empdesig. endloop. else. write :/ 'No data found'. endif.
Prog83
REPORT Z9AMPROG82.
types : begin of ty_emp, ename type z9amemp-ename, empdesig type z9amemp-empdesig, end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. ranges r_empno for z9amemp-empno. start-of-selection. r_empno-low = 1. r_empno-high = 50. r_empno-option = 'BT'. append r_empno. select ename empdesig from z9amemp into table lt_emp where empno in r_empno. if sy-subrc eq 0. loop at lt_emp into ls_emp. write :/ ls_emp-ename, ls_emp-empdesig. endloop. else. write :/ 'No data found'. endif.
Prog84
REPORT Z9AMPROG83.
types : begin of ty_emp, ename type z9amemp-ename, empdesig type z9amemp-empdesig, end of ty_emp. data : lt_emp type table of ty_emp, ls_emp type ty_emp. ranges r_empno for z9amemp-empno. start-of-selection. r_empno-low = 1. r_empno-high = 50. r_empno-option = 'BT'.
r_empno-sign = 'I'. append r_empno. r_empno-low = 100. r_empno-high = 220. r_empno-option = 'BT'. r_empno-sign = 'I'. append r_empno. select ename empdesig from z9amemp into table lt_emp where empno in r_empno. if sy-subrc eq 0. loop at lt_emp into ls_emp. write :/ ls_emp-ename, ls_emp-empdesig. endloop. else. write :/ 'No data found'. endif.
Prog85
REPORT Z9AMPROG85.
parameters p_land1 type kna1-land1. data : lv_kunnr type kna1-kunnr, lv_name1 type kna1-name1. exec sql. open abc for select kunnr, name1 from kna1 where land1 = :p_land1 endexec. do. exec sql. fetch next abc into :lv_kunnr, :lv_name1 endexec. if sy-subrc eq 0. write :/ lv_kunnr,lv_name1. else. exit. endif. enddo. exec sql. close abc endexec.
Prog86
REPORT
Z9AMPROG86.
data lv_flag type i. selection-screen begin of block bk1 with frame title abc. selection-screen begin of line. selection-screen comment 6(15) lb1. parameters p_empno type y9amemp-empno. selection-screen end of line. selection-screen begin of line. selection-screen comment 6(15) lb2. parameters p_ename type y9amemp-ename. selection-screen end of line.
selection-screen begin of line. selection-screen comment 6(15) lb3. parameters p_Desig type y9amemp-empdesig. selection-screen end of line. selection-screen end of block bk1. selection-screen begin of block bk2 with frame title pqr. selection-screen pushbutton 6(10) b1 user-command p1. selection-screen pushbutton 18(10) b2 user-command p2. selection-screen skip 2. selection-screen pushbutton 6(10) b3 user-command p3. selection-screen end of block bk2. initialization. abc = 'Employee'. b1 = 'Search'. b2 = 'Clear'. b3 = 'Exit'. pqr = 'operations'. lb1 = 'Employee no'. lb2 = 'Employee name'. lb3 = 'Designation'. at selection-screen output. if lv_flag = 0. loop at screen. if screen-name = 'LB2' or screen-name = 'P_ENAME' or screen-name = 'LB3' or screen-name = 'P_DESIG'. screen-invisible = '1'. screen-input = '0'. "this is for input fields modify screen. endif. endloop. elseif lv_flag = 1. loop at screen. if screen-name = 'LB2' or screen-name = 'P_ENAME' or screen-name = 'LB3' or screen-name = 'P_DESIG'. screen-invisible = '0'. screen-input = '1'. "this is for input fields modify screen. endif. endloop. endif. at selection-screen. case sy-ucomm. when 'P3'. leave program. when 'P1'. if p_empno is initial. message 'Please enter empno' type 'I'. else. select single ename empdesig from y9amemp into (p_ename,p_desig) where empno = p_empno. if sy-subrc eq 0. lv_flag = 1. endif. endif.
Prog87