Sie sind auf Seite 1von 294

INDEX..

1.WELCOME PROGRAM Z9AMPROGRAM1:


REPORT Z9AMPROGRAM1. write 'welcome'.

Z9AMPROGRAM2:
REPORT Z9AMPROGRAM2. data x type i. "declaration data y type i. data z type i. x = 10. "initialization y = 20. z = x + y. write : ' a + b = ',z. "display

Z9AMPROGRAM3:
REPORT Z9AMPROGRAM3. data : x type i, y type i,

1|Pa g e

Santosh P

z type i. 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.

Z9AMPROG RAM4:
REPORT Z9AMPROGRAM4. *parameters x type i. *parameters y type i. parameters : abc type i default 20 , y type i default 10 obligatory . data z type i. z = abc + y. write z.

Z9AMPROGRAM5:
REPORT Z9AMPROGRAM5. data : x type i value 10, y type i value 20, z type i. z = x + y.

2|Pa g e

Santosh P

write z. x = 34. y = 44. z = x + y. write / z. constants m type i value 56. write :/ m. *m = 57.

Z9AMPROG RAM6:
REPORT Z9AMPROGRAM6. data x type i. write x. data y type c. write :/ 'y is ',y. y = 'Gensoft'. write :/ y. data m(10) type c. m = 'Gensoft systems'. write / m. data k type string. k = 'Gensoft systems'. write / k.

Z9AMPROG RAM7:
3|Pa g e Santosh P

REPORT

Z9AMPROGRAM7.

parameters : x type i, y type i. data r type i. parameters : r1 radiobutton group g1, r2 radiobutton group g1 , r3 radiobutton group g1 default 'X', r4 radiobutton group g1. if r1 = 'X'. r = x + y. write :/ 'sum is ',r. elseif r2 = 'X'. r = x - y. if r >= 0. write :/ 'Difference is ',r. else. write :/ 'Difference is -' no-gap,r no-sign left-justified. endif. elseif r3 = 'X'. r = x * y. write :/ 'Product is ',r. elseif r4 = 'X'. r = x / y. write :/ 'Division is ',r. endif. FIRST SCREEN :ENTER INPUTS AND SELECT RADIO BUTTON AND PRESS EXECUTE

SECOND SECEND SCREEN :

4|Pa g e

Santosh P

Z9AMPROGRAM8:
REPORT Z9AMPROGRAM8. parameters : x type i, y type i. data r type i. parameters : r1 r2 r3 r4 as as as as checkbox, checkbox, checkbox, checkbox.

if r1 = 'X'. r = x + y. write :/ 'sum is ',r. endif. if r2 = 'X'. r = x - y. if r >= 0. write :/ 'Difference is ',r. else. write :/ 'Difference is -' no-gap,r no-sign left-justified. endif. endif. if r3 = 'X'. r = x * y. write :/ 'Product is ',r. endif. if r4 = 'X'. r = x / y. write :/ 'Division is ',r. endif. FIRST SCREEN: ENTER THE VALUES AND AND TICK THE CHECK BOXES AND PRESS EXECUTE

5|Pa g e

Santosh P

S ECEND SCREEN: OUTPUT

Z9AMPROGRAM9:
REPORT Z9AMPROGRAM9. parameters x type i default 7. data : y type i value 1, z type i. while y le 10. if y ne 4. z = x * y. write :/ x,'*',y,'=',z. endif. y = y + 1. endwhile. FIRST SCREEN:

6|Pa g e

Santosh P

SECEND SCREEN: OUTPUT

Z9AMPROGRAM10:
REPORT Z9AMPROGRAM10. parameters x type i default 7. data : y type i value 1, z type i. while y le 10. if y eq 4. y = y + 1. continue. endif. z = x * y. write :/ x,'*',y,'=',z. y = y + 1. endwhile. FIRST SCREEN:

7|Pa g e

Santosh P

SECEND SCREEN:

Z9AMPROGRAM11:
REPORT Z9AMPROGRAM11. parameters x type i default 7. data : y type i value 1, z type i. while y le 10. if y eq 4. exit. endif. z = x * y. write :/ x,'*',y,'=',z. y = y + 1. endwhile. write :/ 'end of program'. FIRST SCREEN:

8|Pa g e

Santosh P

SECEND SCREEN:

Z9AMPROGRAM12:
REPORT Z9AMPROGRAM12 no standard page heading. write :/ 'hello'. exit. write :/ 'welcome'. write :/ 'bye'.

Z9AMPROGRAM13:
REPORT Z9AMPROGRAM13. data : x type i value 10, y type i. write :/ 'x is ',x, / 'y is ',y.

9|Pa g e

Santosh P

y = x. write :/ / x = 20. write :/ /

'x is ',x, 'y is ',y. 'x is ',x, 'y is ',y.

Z9AMPROGRAM14:
REPORT Z9AMPROGRAM14. DATA : x type i value 10. field-symbols <fs>. <fs> = x. PROGRAM WILL BE TERMINATED:THERE IS NO ASIGN KEY WORD SO I LEADS TO RUN TIME ERROR.

Z9AMPROGRAM15:
REPORT Z9AMPROGRAM15.

10 | P a g e

Santosh P

data : x type i value 10. field-symbols <fs>.

assign x to <fs>. write :/ 'x is ',x, / '<fs> is ',<fs>. x = 20. write :/ 'x is ',x, / '<fs> is ',<fs>. <fs> = 30. write :/ 'x is ',x, / '<fs> is ',<fs>. data y type string value 'Gensoft'. assign y to <fs>. write :/ '**************'. write :/ 'x is ',x, / '<fs> is ',<fs>, / 'y is ',y.

Z9AMPROGRAM16:
REPORT data Z9AMPROGRAM16. x type d value '13042011'. "DDMMYYYY

11 | P a g e

Santosh P

write :/ x. x = '20110413'. "YYYYMMDD write :/ x. "ddmmyyyy write :/(10) x. "dd.mm.yyyy write :/(10) x using edit mask '__/__/____'. data y type t value '102045'. "HHMMSS write :/ y. "HHMMSS write :/(8) y. "HH:MM:SS write :/(8) y using edit mask '__-__-__'. write :/ 'Date is ',sy-datum, / 'Time is ',sy-uzeit.

Z9AMPROGRAM17:
REPORT Z9AMPROGRAM17. parameters : x type i. write :/ 'hello'. if x <= 10. write :/ 'welcome'. endif. write :/ 'bye'. OUTPUT 1:

12 | P a g e

Santosh P

OUTPUT 2:

Z9AMPROGRAM18:
REPORT Z9AMPROGRAM18. parameters : x type i. write :/ 'hello'. check x <= 10.

13 | P a g e

Santosh P

write :/ 'welcome'. write :/ 'bye'.

Z9AMPROGRAM19:
REPORT Z9AMPROGRAM19. write :/ 'inside program 19'. *submit z9amprogram20. submit z9amprogram20 and return. write :/ 'end of program 19'.

Z9AMPROGRAM20:
REPORT Z9AMPROGRAM20. write :/ 'inside program20'.

14 | P a g e

Santosh P

Z9AMPROGRAM21:
REPORT Z9AMPROGRAM21. parameters : p_x type i, p_y type i. export p_x to memory id 'ABC'. export p_y to memory id 'PQR'. submit z9amprogram22.

Z9AMPROGRAM22:
REPORT Z9AMPROGRAM22. data : k type i, p_x type i, p_y type i. import p_x from memory id 'ABC'(001).

15 | P a g e

Santosh P

import p_y from memory id 'PQR'. k = p_x + p_y. write :/ 'sum is ',k.

Z9AMPROGRAM23:
REPORT Z9AMPROGRAM23. parameters : str type string. data k type i. k = strlen( str ). write :/ 'length of string is ',k.

Z9AMPROGRAM24:
REPORT Z9AMPROGRAM24. data : str1 type string value 'Gensoft', str2 type string value 'Systems', str type string.

16 | P a g e

Santosh P

write :/ 'str is concatenate str1 write :/ 'str is str = ' '. write :/ 'str is concatenate str1 write :/ 'str is

',str. str2 into str. ',str. ',str. str2 into str separated by ' '. ',str.

Z9AMPROGRAM25:
REPORT Z9AMPROGRAM25. 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. write :/ '********************'. split str at ',' into str1 str2. write :/ 'str1 is ',str1, / 'str2 is ',str2, / 'str3 is ',str3. write :/ '********************'. clear : str1,str2,str3. write :/ 'str1 is ',str1, / 'str2 is ',str2, / 'str3 is ',str3. write :/ '********************'. split str at ',' into str1 str2 str3. write :/ 'str1 is ',str1,

17 | P a g e

Santosh P

/ 'str2 is ',str2, / 'str3 is ',str3.

Z9AMPROGRAM26:
REPORT Z9AMPROGRAM26. data : str type string value 'GenSoft'. write :/ str. translate str to lower case. write :/ str. translate str to upper case. write :/ str.

Z9AMPROGRAM27:
18 | P a g e Santosh P

REPORT

Z9AMPROGRAM27.

data : str1 type string value 'Wipro Technologies', str2 type string value 'Genesis software Systems'. write :/ 'str1 is ',str1, / 'str2 is ',str2. write :/ '*****************'. overlay str2 with str1. write :/ 'str1 is ',str1, / 'str2 is ',str2.

Z9AMPROGRAM28:
REPORT Z9AMPROGRAM28. data : str1 type string value 'Gensoft Systems'. write :/ 'str1 is ',str1.

write :/ '***************'. replace 's' in str1 with 'k'. write :/ 'str1 is ',str1. write :/ '***************'. str1 = 'Gensoft Systems'. write :/ str1. write :/ '***************'. replace all occurrences of 's' in str1 with 'k'. write :/ str1.

19 | P a g e

Santosh P

write :/ '***************'. str1 = 'Gensoft Systems'. write :/ str1. write :/ '***************'. replace all occurrences of 's' in str1 with 'k' ignoring case. write :/ str1.

Z9AMPROGRAM29:
REPORT Z9AMPROGRAM29. data : str1 type string value 'Genesis', str2 type string. write :/ 'str1 is ',str1, / 'str2 is ',str2. transfer str1 to str2. write :/ 'str1 is ',str1, / 'str2 is ',str2. RUN TIME ERROR:

20 | P a g e

Santosh P

Z9AMPROGRAM30:
REPORT Z9AMPROGRAM30. data : str type string value 'Gensoft Systems'. write :/ 'str is ',str. condense str no-gaps. write :/ 'str is ',str.

Z9AMPROGRAM31:
REPORT Z9AMPROGRAM31. data : str1 type string value 'Gensoft Systems', str2 type string.

21 | P a g e

Santosh P

write :/ 'str2 is ',str2. write :/ '******************'. str2 = str1+2(7). write :/ 'str2 is ',str2.

Z9AMPROGRAM32:
REPORT Z9AMPROGRAM32. data : cust(2) type c value '01'. write :/ 'cust is ',cust. data : cust1(3) type c. concatenate 'c' cust+1(1) into cust1. write :/ 'cust1 is ',cust1.

Z9AMPROGRAM33:
REPORT Z9AMPROGRAM33. parameters : str type string lower case. write :/ str.

22 | P a g e

Santosh P

Z9AMPROGRAM34:
REPORT Z9AMPROGRAM34. data : begin of emp, empno type i, ename(20) type c, end of emp. write :/ emp-empno, emp-ename. emp-empno = 1. emp-ename = 'abc'. write :/ '************'. 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....'.

23 | P a g e

Santosh P

write :/ emp1-empno, emp1-ename. move emp to emp1. write :/ 'EMP1 structure after move....'. write :/ emp1-empno, emp1-ename.

Z9AMPROGRAM35:
REPORT Z9AMPROGRAM35. data : begin of emp, empno type i, ename(20) type c, end of emp. emp-empno = 1. emp-ename = 'abc'. write :/ 'EMP structure'. write :/ emp-empno, emp-ename. data : begin of dept, deptno type i, dname(30) type c, loc(30) type c, end of dept. move emp to dept.

24 | P a g e

Santosh P

write :/ 'DEPT structure....'. write :/ dept-deptno, dept-dname, dept-loc.

Z9AMPROGRAM36:
REPORT Z9AMPROGRAM36. data : begin of emp, ename(20) type c, empno type i, end of emp. emp-empno = 1. emp-ename = 'abc'. write :/ 'EMP structure'. write :/ emp-empno, emp-ename. * data : begin of dept, deptno type i, dname(30) type c, loc(30) type c, end of dept. move emp to dept. write :/ 'DEPT structure....'. write :/ dept-deptno, dept-dname, dept-loc.

25 | P a g e

Santosh P

Z9AMPROGRAM37:
REPORT Z9AMPROGRAM37. data : begin of emp, empno type i, ename(20) type c, end of emp. emp-empno = 1. emp-ename = 'raju'. write :/ 'EMP structure'. write :/ emp-empno, emp-ename. data : begin of emp1, ename(20) type c, desig(20) type c, empno type i, end of emp1. move-corresponding emp to emp1. write :/ 'EMP1 structure'. write :/ 'Ename is ',emp1-ename, / 'Desig is ',emp1-desig, / 'empno is ',emp1-empno.

26 | P a g e

Santosh P

Z9AMPROGRAM38:
REPORT Z9AMPROGRAM38. data : begin of emp, empno(3) type c, ename(20) type c, end of emp. emp-empno = 'a11'. emp-ename = 'raju'. write :/ 'EMP structure'. write :/ emp-empno, emp-ename. data : begin of emp1, ename(20) type c, desig(20) type c, empno type i, end of emp1. move-corresponding emp to emp1. write :/ 'EMP1 structure'. write :/ 'Ename is ',emp1-ename, / 'Desig is ',emp1-desig, / 'empno is ',emp1-empno.

27 | P a g e

Santosh P

Z9AMPROGRAM39:
REPORT Z9AMPROGRAM39. data : begin of emp, empno type i, ename(20) type c, begin of dept, deptno type i, dname(20) type c, end of dept, desig(30) type c, end of emp. emp-empno = 1. emp-ename = 'raju'. emp-dept-deptno = 10. emp-dept-dname = 'Sales'. emp-desig = 'Manager'. write : emp-empno, emp-ename, emp-dept-deptno, emp-dept-dname, emp-desig.

28 | P a g e

Santosh P

Z9AMPROGRAM40:
REPORT Z9AMPROGRAM40. data : begin of dept, deptno type i, dname(20) type c, end of dept. data : begin of emp, empno type i, ename(20) type c. include structure dept. data : desig(30) type c, end of emp. emp-empno = 1. emp-ename = 'raju'. emp-deptno = 10. emp-dname = 'sales'. emp-desig = 'director'. write : / emp-empno, emp-ename, emp-deptno, emp-dname, emp-desig.

Z9AMPROGRAM41:
29 | P a g e Santosh P

REPORT

Z9AMPROGRAM41.

data : begin of emp occurs 0, empno type i, ename(20) type c, end of emp. write :/ 'Header area'. write :/ emp-empno, emp-ename. emp-empno = 3. emp-ename = 'raju'. write :/ 'Header area'. write :/ emp-empno, emp-ename. append emp.

emp-empno = 5. emp-ename = 'ravi'. append emp. emp-empno = 2. emp-ename = 'vamshi'. append emp. write :/ 'Body area'. loop at emp. write :/ emp-empno, emp-ename. endloop.

30 | P a g e

Santosh P

Z9AMPROGRAM42:
REPORT Z9AMPROGRAM42. data : begin of emp occurs 0, f1 type i, f2(20) type c, f3(30) type c, f4 type d, f5 type t, end of emp. select empno ename empdesig empjdate empjtime from ZGENESISEMP into table emp. if sy-subrc eq 0. loop at emp. write : / emp-f1, emp-f2, emp-f3, emp-f4, emp-f5. endloop. else. message 'No data' type 'I'. endif.

31 | P a g e

Santosh P

Z9AMPROGRAM43:
REPORT Z9AMPROGRAM43. data : begin of emp occurs 0, f1 type ZEMPNODE, f2 type zgenesisemp-ename, f3 type zgenesisemp-empdesig, f4 type datum, f5 type uzeit, end of emp. select empno ename empdesig empjdate empjtime from ZGENESISEMP into table emp. if sy-subrc eq 0. loop at emp. write :/ emp-f1, emp-f2, emp-f3, emp-f4, emp-f5. endloop. else. message 'No data' type 'I'. endif.

32 | P a g e

Santosh P

Z9AMPROGRAM44:
REPORT Z9AMPROGRAM44. data : begin of emp occurs 0, empno type ZEMPNODE, ename type zgenesisemp-ename, empdesig type zgenesisemp-empdesig, empjdate type datum, empjtime type uzeit, end of emp. select empno ename empdesig empjdate empjtime from ZGENESISEMP into table emp. if sy-subrc eq 0. loop at emp. write :/ emp-empno, emp-ename, emp-empdesig, emp-empjdate, emp-empjtime. endloop. else. message 'No data' type 'I'. endif.

33 | P a g e

Santosh P

Z9AMPROGRAM45:
REPORT Z9AMPROGRAM45. data : begin of emp occurs 0, mandt type mandt, empno type ZEMPNODE, ename type zgenesisemp-ename, empdesig type zgenesisemp-empdesig, empjdate type datum, empjtime type uzeit, end of emp. select * from ZGENESISEMP into table emp. if sy-subrc eq 0. loop at emp. write :/ emp-mandt, emp-empno, emp-ename, emp-empdesig, emp-empjdate, emp-empjtime. endloop. else. message 'No data' type 'I'. endif.

34 | P a g e

Santosh P

Z9AMPROGRAM46:
REPORT Z9AMPROGRAM46. data : begin of emp occurs 0. include structure zgenesisemp. data end of emp. select * from ZGENESISEMP into table emp. if sy-subrc eq 0. loop at emp. write :/ emp-mandt, emp-empno, emp-ename, emp-empdesig, emp-empjdate, emp-empjtime. endloop. else. message 'No data' type 'I'. endif.

35 | P a g e

Santosh P

Z9AMPROGRAM47:
REPORT Z9AMPROGRAM47. data : begin of emp occurs 0. include structure zgenesisemp. data end of emp. select empno ename from ZGENESISEMP into CORRESPONDING FIELDS OF TABLE if sy-subrc eq 0. loop at emp. write :/ emp-empno, emp-ename. endloop. else. message 'No data' type 'I'. endif.

emp.

36 | P a g e

Santosh P

Z9AMPROGRAM48:
REPORT Z9AMPROGRAM48. *parameters : p_x(3) type c. *parameters : p_x type kna1-land1. parameters : p_land1 type kna1-land1. data : lt_kna1 like kna1 occurs 0 with header line. select kunnr land1 name1 from kna1 into corresponding fields of table lt_kna1 where land1 = p_land1. if sy-subrc eq 0. write :/ 'No of records before describe:',sy-tfill. describe table lt_kna1. write :/ 'No of records after describe:',sy-tfill. else. write :/ 'No data'. endif.

37 | P a g e

Santosh P

Z9AMPROGRAM49:
REPORT Z9AMPROGRAM49. parameters : p_land1 type kna1-land1. data : lt_kna1 like kna1 occurs 0. select kunnr land1 name1 from kna1 into corresponding fields of table lt_kna1 where land1 = p_land1. if sy-subrc eq 0. loop at lt_kna1. endloop. else. write :/ 'No data'. endif.

Z9AMPROGRAM50:
REPORT Z9AMPROGRAM50. parameters : p_land1 type kna1-land1. data : lt_kna1 like kna1 occurs 0. *data : begin of wa_kna1. * include structure kna1.

38 | P a g e

Santosh P

*data : end of wa_kna1. data : wa_kna1 like kna1. select kunnr land1 name1 from kna1 into corresponding fields of table lt_kna1 where land1 = p_land1. if sy-subrc eq 0. loop at lt_kna1 into wa_kna1. write :/ wa_kna1-kunnr, wa_kna1-land1, wa_kna1-name1. endloop. else. write :/ 'No data'. endif.

Z9AMPROGRAM51:
REPORT Z9AMPROGRAM51. tables : kna1.

39 | P a g e

Santosh P

parameters : p_land1 type kna1-land1. data : lt_kna1 like kna1 occurs 0. **field-symbols <fs> like line of lt_kna1. field-symbols <fs> type kna1.

select kunnr land1 name1 from kna1 into corresponding fields of table lt_kna1 where land1 = p_land1. if sy-subrc eq 0. loop at lt_kna1 assigning <fs>. write :/ <fs>-kunnr, <fs>-land1, <fs>-name1. endloop. else. write :/ 'No data'. endif.

40 | P a g e

Santosh P

Z9AMPROGRAM52:
REPORT Z9AMPROGRAM52. parameters : p_land1 type kna1-land1. data : lt_kna1 like kna1 occurs 0. data : wa_kna1 like kna1. select kunnr land1 name1 from kna1 into corresponding fields of table lt_kna1 where land1 = p_land1. if sy-subrc eq 0. loop at lt_kna1 into wa_kna1. write :/ wa_kna1-kunnr, wa_kna1-land1, wa_kna1-name1. endloop. else. write :/ 'No data'. endif. loop at lt_kna1 into if wa_kna1-name1 = wa_kna1-name1 = modify lt_kna1 endif. wa_kna1. 'srinivas'. 'srinivas kumar'. from wa_kna1.

41 | P a g e

Santosh P

endloop. write :/ 'Redisplay after modification'. write :/ '*******************************'. skip 1. loop at lt_kna1 into wa_kna1. write :/ wa_kna1-kunnr, wa_kna1-land1, wa_kna1-name1. endloop.

Z9AMPROGRAM53:
REPORT Z9AMPROGRAM53. parameters : p_land1 type kna1-land1. data : lt_kna1 like kna1 occurs 0. field-symbols <fs> like line of lt_kna1. select kunnr land1 name1 from kna1 into corresponding fields of table lt_kna1 where land1 = p_land1.

42 | P a g e

Santosh P

if sy-subrc eq 0. loop at lt_kna1 assigning <fs>. write :/ <fs>-kunnr, <fs>-land1, <fs>-name1. endloop. else. write :/ 'No data'. endif. loop at lt_kna1 assigning <fs>. if <fs>-name1 = 'srinivas'. <fs>-name1 = 'srinivas kumar'. endif. endloop.

write :/ 'After modification'. write :/ '********************'. loop at lt_kna1 assigning <fs>. write :/ <fs>-kunnr, <fs>-land1, <fs>-name1. endloop.

43 | P a g e

Santosh P

Z9AMPROGRAM54:
REPORT Z9AMPROGRAM54. "creates a default work area tables kna1.

types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, name2 type kna1-name2, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1 with header line. select-options : so_land1 for kna1-land1. initialization. so_land1-low = 'AR'. so_land1-high = 'IN'. append so_land1. start-of-selection. select kunnr land1 name1 name2 from kna1 into table lt_kna1 where land1 in so_land1. if sy-subrc eq 0. loop at lt_kna1. * write :/ lt_kna1. write :/ lt_kna1-kunnr, lt_kna1-land1, lt_kna1-name1, lt_kna1-name2. endloop. else. write :/ 'No data'. endif.

44 | P a g e

Santosh P

Z9AMPROGRAM55:
REPORT Z9AMPROGRAM55. "creates a default work area tables kna1.

types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, name2 type kna1-name2, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1 with header line. select-options : so_land1 for kna1-land1. initialization. so_land1-low = 'AR'. so_land1-high = 'IN'. so_land1-sign = 'E'.

45 | P a g e

Santosh P

append so_land1. start-of-selection. select kunnr land1 name1 name2 from kna1 into table lt_kna1 where land1 in so_land1. if sy-subrc eq 0. loop at lt_kna1. * write :/ lt_kna1. write :/ lt_kna1-kunnr, lt_kna1-land1, lt_kna1-name1, lt_kna1-name2. endloop. else. write :/ 'No data'. endif.

Z9AMPROGRAM56:
REPORT Z9AMPROGRAM56. "creates a default work area tables kna1.

46 | P a g e

Santosh P

types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, name2 type kna1-name2, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1. select-options : so_land1 for kna1-land1. initialization. so_land1-low = 'AR'. so_land1-high = 'IN'. append so_land1. start-of-selection. select kunnr land1 name1 name2 from kna1 into table lt_kna1 where land1 in so_land1. if sy-subrc eq 0. loop at lt_kna1 into ls_kna1. write :/ ls_kna1-kunnr, ls_kna1-land1, ls_kna1-name1, ls_kna1-name2. endloop. else. write :/ 'No data'. endif.

47 | P a g e

Santosh P

Z9AMPROGRAM57:
REPORT Z9AMPROGRAM57. "creates a default work area tables kna1.

types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, name2 type kna1-name2, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, * ls_kna1 type ty_kna1. ls_kna1 like line of lt_kna1. select-options : so_land1 for kna1-land1. initialization. so_land1-low = 'AR'. so_land1-high = 'IN'. append so_land1. start-of-selection. select kunnr land1 name1 name2 from kna1 into table lt_kna1 where land1 in so_land1. if sy-subrc eq 0. loop at lt_kna1 into ls_kna1. write :/ ls_kna1-kunnr, ls_kna1-land1,

48 | P a g e

Santosh P

ls_kna1-name1, ls_kna1-name2. endloop. else. write :/ 'No data'. endif.

Z9AMPROGRAM58:
REPORT Z9AMPROGRAM58. "creates a default work area tables kna1.

types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, name2 type kna1-name2, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, gt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1.

49 | P a g e

Santosh P

select-options : so_land1 for kna1-land1. initialization. so_land1-low = 'AR'. so_land1-high = 'IN'. append so_land1. start-of-selection. select kunnr land1 name1 name2 from kna1 into table lt_kna1 where land1 in so_land1. if sy-subrc eq 0. describe table lt_kna1. write :/ 'No of records in lt_kna1 :',sy-tfill. else. write :/ 'No data'. endif. describe table gt_kna1. write :/ 'No of records in gt_kna1 :',sy-tfill. loop at lt_kna1 into ls_kna1. append ls_kna1 to gt_kna1. endloop. describe table gt_kna1. write :/ 'No of records in gt_kna1 after copying:',sy-tfill.

50 | P a g e

Santosh P

Z9AMPROGRAM59:
REPORT Z9AMPROGRAM59. "creates a default work area tables kna1.

types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, name2 type kna1-name2, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, gt_kna1 type standard table of ty_kna1. * ls_kna1 type ty_kna1.

select-options : so_land1 for kna1-land1. initialization. so_land1-low = 'AR'. so_land1-high = 'IN'. append so_land1. start-of-selection. select kunnr land1 name1 name2 from kna1 into table lt_kna1 where land1 in so_land1. if sy-subrc eq 0. describe table lt_kna1. write :/ 'No of records in lt_kna1 :',sy-tfill. else. write :/ 'No data'. endif. describe table gt_kna1. write :/ 'No of records in gt_kna1 :',sy-tfill. *gt_kna1[] = lt_kna1[]. append lines of lt_kna1 to gt_kna1. describe table gt_kna1. write :/ 'No of records in gt_kna1 after copying:',sy-tfill.

51 | P a g e

Santosh P

Z9AMPROGRAM60:
REPORT Z9AMPROGRAM60. "creates a default work area tables kna1.

types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, name2 type kna1-name2, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, gt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1.

select-options : so_land1 for kna1-land1. initialization. so_land1-low = 'AR'. so_land1-high = 'IN'. append so_land1. start-of-selection. select kunnr land1 name1 name2 from kna1 into table lt_kna1

52 | P a g e

Santosh P

where land1 in so_land1. if sy-subrc eq 0. describe table lt_kna1. write :/ 'No of records in lt_kna1 :',sy-tfill. else. write :/ 'No data'. endif. describe table gt_kna1. write :/ 'No of records in gt_kna1 :',sy-tfill. append lines of lt_kna1 from 100 to 200 to gt_kna1. describe table gt_kna1. write :/ 'No of records in gt_kna1 after copying:',sy-tfill.

Z9AMPROGRAM61:
REPORT Z9AMPROGRAM61. "creates a default work area tables kna1.

types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, name2 type kna1-name2, end of ty_kna1.

53 | P a g e

Santosh P

data : lt_kna1 type standard table of ty_kna1, gt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1.

select-options : so_land1 for kna1-land1. initialization. so_land1-low = 'AR'. so_land1-high = 'IN'. append so_land1. start-of-selection. select kunnr land1 name1 name2 from kna1 into table lt_kna1 where land1 in so_land1. if sy-subrc eq 0. describe table lt_kna1. write :/ 'No of records in lt_kna1 :',sy-tfill. else. write :/ 'No data'. endif. describe table gt_kna1. write :/ 'No of records in gt_kna1 :',sy-tfill. loop at lt_kna1 into ls_kna1 where land1 = 'IN'. append ls_kna1 to gt_kna1. endloop. describe table gt_kna1. write :/ 'No of records in gt_kna1 :',sy-tfill.

54 | P a g e

Santosh P

Z9AMPROGRAM62:
REPORT Z9AMPROGRAM62. types : begin of ty_emp. include structure zgenesisemp. types end of ty_emp. data : ls_emp type ty_emp. ls_emp-empno = 68. ls_emp-ename = 'kiran kumar'. *insert zgenesisemp from ls_emp. modify zgenesisemp from ls_emp. write :/ 'no of records affected :',sy-dbcnt.

Z9AMPROGRAM63:
REPORT Z9AMPROGRAM63. types : begin of ty_emp. include structure zgenesisemp. types end of ty_emp. data : lt_emp type standard table of ty_emp, ls_emp type ty_emp.

55 | P a g e

Santosh P

ls_emp-empno = 88. ls_emp-ename = 'vmashi'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 89. ls_emp-ename = 'abc'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 77. ls_emp-ename = 'vamshi kumar'. append ls_emp to lt_emp. *insert zgenesisemp from table lt_emp. *insert zgenesisemp from table lt_emp * accepting duplicate keys. modify zgenesisemp from table lt_emp.

write :/ 'no of records affected :',sy-dbcnt.

Z9AMPROGRAM64:
REPORT Z9AMPROGRAM64. types : begin of ty_emp. include structure zgenesisemp. types end of ty_emp. data : lt_emp type standard table of ty_emp, ls_emp type ty_emp. select * from zgenesisemp into table lt_emp. if sy-subrc eq 0. write :/ 'No of records retrieved :',sy-dbcnt.

56 | P a g e

Santosh P

read table lt_emp into ls_emp index 1. if sy-subrc eq 0. write :/ 'Record record is ',ls_emp-empno, ls_emp-ename. else. write :/ 'Read failed'. endif. clear ls_emp. read table lt_emp into ls_emp with key empno = 88. if sy-subrc eq 0. write :/ 'Record with empno = 88 is ',ls_emp-empno, ls_emp-ename. else. write :/ 'Read failed'. endif. uline. * sort lt_emp by empno. sort lt_emp by empno descending. clear ls_emp. read table lt_emp into ls_emp with key empno = 17 binary search. if sy-subrc eq 0. write :/ 'Record with empno = 17 is ',ls_emp-empno, ls_emp-ename, ls_emp-empdesig. else. write :/ 'Read failed'. endif. uline. clear ls_emp. read table lt_emp into ls_emp with key empno = '90' binary search transporting ename. if sy-subrc eq 0. write :/ 'Record with empno = 90 is ',ls_emp-empno, ls_emp-ename, ls_emp-empdesig. else. write :/ 'Read failed'. endif. endif.

57 | P a g e

Santosh P

Z9AMPROGRAM65:
REPORT Z9AMPROGRAM65. types : begin of ty_emp. include structure zgenesisemp. types end of ty_emp. data : lt_emp type standard table of ty_emp, ls_emp type ty_emp. select * from zgenesisemp into table lt_emp. if sy-subrc eq 0. loop at lt_emp into ls_emp. write :/ 'Index is ',sy-tabix. endloop. endif.

58 | P a g e

Santosh P

Z9AMPROGRAM66:
REPORT Z9AMPROGRAM66. do 10 times. write :/ 'Sy-tabix is ',sy-tabix, 'sy-index is ',sy-index. enddo.

59 | P a g e

Santosh P

Z9AMPROGRAM67:
REPORT Z9AMPROGRAM67. types : begin of ty_emp. include structure zgenesisemp. types end of ty_emp. data : lt_emp type standard table of ty_emp, ls_emp type ty_emp. select * from zgenesisemp into table lt_emp. if sy-subrc eq 0. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename. endloop. endif. sort lt_emp by ename DESCENDING. write :/ 'Data after sorting'. write :/ '*****************'. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename. endloop. delete adjacent duplicates from lt_emp comparing ename. write :/ 'Data after Deleting adjacent duplicates'. write :/ '*****************'.

60 | P a g e

Santosh P

loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename. endloop.

Z9AMPROGRAM68:
REPORT Z9AMPROGRAM68. types : begin of ty_emp. include structure zgenesisemp. types end of ty_emp. data : lt_emp type standard table of ty_emp, ls_emp type ty_emp. select * from zgenesisemp into table lt_emp. if sy-subrc eq 0. describe table lt_emp. write :/ 'No of records :',sy-tfill. endif. *clear lt_emp. refresh lt_emp.

61 | P a g e

Santosh P

describe table lt_emp. write :/ 'No of records after Refresh :',sy-tfill.

Z9AMPROGRAM69:
REPORT Z9AMPROGRAM69. types : begin of ty_dept. include structure zgdept. types end of ty_dept. data : lt_dept type standard table of ty_dept, ls_dept type ty_dept. types : begin of ty_emp. include structure zgemp. types end of ty_emp. data : lt_emp type standard table of ty_emp, ls_emp type ty_emp. select * from zgdept into table lt_dept. if sy-subrc eq 0. loop at lt_dept into ls_dept. select * from zgemp into table lt_emp where deptno = ls_dept-deptno. endloop. endif. loop at lt_dept into ls_dept. write :/ ls_dept-deptno, ls_dept-dname, ls_dept-loc. loop at lt_emp into ls_emp where deptno = ls_dept-deptno. write :/5 ls_emp-empno, ls_emp-ename, ls_emp-deptno.

62 | P a g e

Santosh P

endloop. endloop.

Z9AMPROGRAM70:
REPORT Z9AMPROGRAM70. types : begin of ty_dept. include structure zgdept. types end of ty_dept. data : lt_dept type standard table of ty_dept, ls_dept type ty_dept. types : begin of ty_emp. include structure zgemp. types end of ty_emp. data : lt_emp type standard table of ty_emp, ls_emp type ty_emp. select * from zgdept into table lt_dept. if sy-subrc eq 0. loop at lt_dept into ls_dept. select * from zgemp appending corresponding fields of table lt_emp where deptno = ls_dept-deptno. endloop. endif. loop at lt_dept into ls_dept. write :/ ls_dept-deptno, ls_dept-dname,

63 | P a g e

Santosh P

ls_dept-loc. loop at lt_emp into ls_emp where deptno = ls_dept-deptno. write :/5 ls_emp-empno, ls_emp-ename, ls_emp-deptno. endloop. endloop.

Z9AMPROGRAM71:
REPORT Z9AMPROGRAM71. types : begin of ty_dept. include structure zgdept. types end of ty_dept. data : lt_dept type standard table of ty_dept, ls_dept type ty_dept. types : begin of ty_emp. include structure zgemp. types end of ty_emp. data : lt_emp type standard table of ty_emp, ls_emp type ty_emp. select * from zgdept into table lt_dept. if lt_dept is not initial. select * from zgemp into table lt_emp for all entries in lt_dept where deptno = lt_dept-deptno. endif.

64 | P a g e

Santosh P

loop at lt_dept into ls_dept. write :/ ls_dept-deptno, ls_dept-dname, ls_dept-loc. loop at lt_emp into ls_emp where deptno = ls_dept-deptno. write :/5 ls_emp-empno, ls_emp-ename, ls_emp-deptno. endloop. endloop.

Z9AMPROGRAM72:
REPORT Z9AMPROGRAM72. tables mara. select-options so_matnr for mara-matnr.

types : begin of ty_mara, matnr type mara-matnr, mtart type mara-mtart, matkl type mara-matkl, end of ty_mara. data : lt_mara type standard table of ty_mara, ls_mara type ty_mara. types : begin of matnr werks pstat ty_marc, type marc-matnr, type marc-werks, type marc-pstat,

65 | P a g e

Santosh P

end of ty_marc. data : lt_marc type standard table of ty_marc, ls_marc type ty_marc. types : begin of ty_t001w, werks type t001w-werks, name1 type t001w-name1, end of ty_t001w. data : lt_t001w type standard table of ty_t001w, ls_t001w type ty_t001w. types : begin of ty_final, matnr type mara-matnr, mtart type mara-mtart, werks type marc-werks, name1 type t001w-name1, end of ty_final. data : lt_final type standard table of ty_final, ls_final type ty_final. select matnr mtart matkl from mara into table lt_mara where matnr in so_matnr. if lt_mara[] is not initial. select matnr werks pstat from marc into table lt_marc for all entries in lt_mara where matnr = lt_mara-matnr. if lt_marc[] is not initial. select werks name1 from t001w into table lt_t001w for all entries in lt_marc where werks = lt_marc-werks. endif. endif. if lt_mara[] is not initial. if lt_marc[] is not initial. if lt_t001w[] is not initial. loop at lt_mara into ls_mara. write :/(110) ls_mara-matnr, ls_mara-mtart. loop at lt_marc into ls_marc

66 | P a g e

Santosh P

where matnr = ls_mara-matnr. write ls_marc-werks. loop at lt_t001w into ls_t001w where werks = ls_marc-werks. write ls_t001w-name1. endloop. endloop. endloop. endif. endif. endif.

Z9AMPROGRAM73:
REPORT Z9AMPROGRAM73. tables mara. select-options so_matnr for mara-matnr. types : begin of ty_mara, matnr type mara-matnr,

67 | P a g e

Santosh P

mtart type mara-mtart, matkl type mara-matkl, end of ty_mara. data : lt_mara type standard table of ty_mara, ls_mara type ty_mara. types : begin of ty_marc, matnr type marc-matnr, werks type marc-werks, pstat type marc-pstat, end of ty_marc. data : lt_marc type standard table of ty_marc, ls_marc type ty_marc. types : begin of ty_t001w, werks type t001w-werks, name1 type t001w-name1, end of ty_t001w. data : lt_t001w type standard table of ty_t001w, ls_t001w type ty_t001w. types : begin of ty_final, matnr type mara-matnr, mtart type mara-mtart, werks type marc-werks, name1 type t001w-name1, end of ty_final. data : lt_final type standard table of ty_final, ls_final type ty_final.

select matnr mtart matkl from mara into table lt_mara where matnr in so_matnr. if lt_mara[] is not initial. select matnr werks pstat from marc into table lt_marc for all entries in lt_mara where matnr = lt_mara-matnr. if lt_marc[] is not initial. select werks name1 from t001w into table lt_t001w

68 | P a g e

Santosh P

for all entries in lt_marc where werks = lt_marc-werks. endif. endif. if lt_mara[] is not initial. if lt_marc[] is not initial. if lt_t001w[] is not initial. loop at lt_mara into ls_mara. ls_final-matnr = ls_mara-matnr. ls_final-mtart = ls_mara-mtart. loop at lt_marc into ls_marc where matnr = ls_mara-matnr. ls_final-werks = ls_marc-werks. loop at lt_t001w into ls_t001w where werks = ls_marc-werks. ls_final-name1 = ls_t001w-name1. append ls_final to lt_final. endloop. clear ls_final. endloop. endloop. endif. endif. endif. if lt_final[] is not initial. loop at lt_final into ls_final. write :/ ls_final-matnr, ls_final-mtart, ls_final-werks, ls_final-name1. skip 1. endloop. endif.

69 | P a g e

Santosh P

Z9AMPROGRAM74:
REPORT Z9AMPROGRAM74. parameters : p_land1 type kna1-land1 default 'IN'. types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1. select kunnr land1 name1 from kna1 into ls_kna1 where land1 = 'IN'. write :/ ls_kna1-kunnr, ls_kna1-land1, ls_kna1-name1. endselect.

70 | P a g e

Santosh P

Z9AMPROGRAM75:
REPORT Z9AMPROGRAM75. : p_kunnr type kna1-kunnr. PARAMETERS

types : begin of ty_kna1, land1 type kna1-land1, name1 type kna1-name1, end of ty_kna1. data : ls_kna1 type ty_kna1. select single land1 name1 from kna1 into ls_kna1 where kunnr = p_kunnr. if sy-subrc eq 0. write :/ ls_kna1-land1, ls_kna1-name1. else.

71 | P a g e

Santosh P

write :/ 'No data'. endif.

Z9AMPROGRAM76:
REPORT Z9AMPROGRAM76. : p_kunnr type kna1-kunnr. PARAMETERS

data : lv_land1 type kna1-land1, lv_name1 type kna1-name1. exec sql. select land1 , name1 from kna1 into :lv_land1, :lv_name1 where kunnr = :p_kunnr *here we are giving period that's y it is giving runtime error endexec. if sy-subrc eq 0. write :/ lv_land1, lv_name1. else. message 'No data' type 'I'. endif.

72 | P a g e

Santosh P

Z9AMPROGRAM77:
REPORT Z9AMPROGRAM77. parameters : p_land1 type kna1-land1. types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, end of ty_kna1. data : ls_kna1 type ty_kna1. data abc type cursor. open cursor abc for select kunnr land1 name1 from kna1 where land1 = p_land1. do. fetch next cursor abc into ls_kna1. if sy-subrc eq 0. write :/ ls_kna1-kunnr, ls_kna1-land1, ls_kna1-name1. else. exit. endif. enddo.

73 | P a g e

Santosh P

close cursor abc.

Z9AMPROGRAM78:
REPORT z9amprogram78. PARAMETERS : p_land1 TYPE kna1-land1. DATA : lv_kunnr TYPE kna1-kunnr, lv_land1 TYPE kna1-land1, lv_name1 TYPE kna1-name1. EXEC SQL. open abc for select kunnr, land1, name1 from kna1 where land1 = :p_land1 ENDEXEC. DO.

74 | P a g e

Santosh P

EXEC SQL. fetch next abc into :lv_kunnr,:lv_land1,:lv_name1 ENDEXEC. IF sy-subrc EQ 0. WRITE :/ lv_kunnr, lv_land1, lv_name1. ELSE. EXIT. ENDIF. ENDDO. EXEC SQL. close abc ENDEXEC.

Z9AMPROGRAM79:
75 | P a g e Santosh P

REPORT

Z9AMPROGRAM79.

ranges : r_land1 for kna1-land1. r_land1-low = 'AR'. r_land1-high = 'IN'. r_land1-option = 'BT'. r_land1-sign = 'I'. append r_land1. data : lt_kna1 type zcustttype, * ls_kna1 like line of lt_kna1, ls_kna1 type zcustltype. select kunnr land1 name1 from kna1 into table lt_kna1 where land1 in r_land1. if sy-subrc eq 0. loop at lt_kna1 into ls_kna1. write :/ ls_kna1-kunnr, ls_kna1-land1, ls_kna1-name1. endloop. else. write :/ 'No data'. endif.

76 | P a g e

Santosh P

Z9AMPROGRAM80:
REPORT Z9AMPROGRAM80. type-pools : zcgrp,slis. write :/ zcgrp_x. data : lt_kna1 type standard table of zcgrp_ty_kna1, ls_kna1 type zcgrp_ty_kna1. types : begin of ty_kna1. include type zcgrp_ty_kna1. types : name2 type kna1-name2, end of ty_kna1. data k type zcgrp_y. k = 20. write :/ k. data m type slis_tabname. data gt_kna1 type zcgrp_kna1.

Z9AMPROGRAM81:
REPORT Z9AMPROGRAM81. types : begin of ty_count, cnt type i, end of ty_count. data : lt_count type standard table of ty_count. data cnt type i. select count(*) from zgemp into cnt

77 | P a g e

Santosh P

group by deptno. write :/ cnt. endselect.

Z9AMPROGRAM82:
REPORT Z9AMPROGRAM82. data cnt type i. data dno type zgemp-deptno. select count(*) deptno from zgemp into (cnt,dno) group by deptno. write :/ cnt,dno. endselect.

78 | P a g e

Santosh P

Z9AMPROGRAM83:
REPORT Z9AMPROGRAM83. data cnt type i. data dno type zgemp-deptno. select count(*) deptno from zgemp into (cnt,dno) group by deptno * where deptno ne 10. having deptno ne 10. write :/ cnt,dno. endselect.

79 | P a g e

Santosh P

Z9AMPROGRAM84:
REPORT Z9AMPROGRAM84. types : begin of ty_emp, empno type i, ename(20) 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 = 1. ls_emp-ename = 'Raju'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 3. ls_emp-ename = 'Ravi'. append ls_emp to lt_emp. clear ls_emp. ls_emp-empno = 2. ls_emp-ename = 'Ramu'. append ls_emp to lt_emp. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename.

80 | P a g e

Santosh P

endloop. sort lt_emp by empno. write :/ 'after sort'. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename. endloop.

Z9AMPROGRAM85:
REPORT Z9AMPROGRAM85. types : begin of ty_emp, empno type i, ename(20) type c, end of ty_emp. data : lt_emp type sorted table of ty_emp with non-unique KEY empno, ls_emp type ty_emp. clear ls_emp. ls_emp-empno = 3. ls_emp-ename = 'Raju'. insert ls_emp into table lt_emp. clear ls_emp. ls_emp-empno = 1. ls_emp-ename = 'Ravi'. insert ls_emp into table lt_emp.

clear ls_emp.

81 | P a g e

Santosh P

ls_emp-empno = 2. ls_emp-ename = 'Ramu'. insert ls_emp into table lt_emp.

clear ls_emp. ls_emp-empno = 1. ls_emp-ename = 'Ramesh'. insert ls_emp into table lt_emp.

loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename. endloop.

Z9AMPROGRAM86:
REPORT Z9AMPROGRAM86. types : begin of ty_emp, empno type i, ename(20) type c, end of ty_emp. data : lt_emp type sorted table of ty_emp with unique KEY empno ename, ls_emp type ty_emp. clear ls_emp. ls_emp-empno = 3. ls_emp-ename = 'Raju'. insert ls_emp into table lt_emp. clear ls_emp. ls_emp-empno = 1. ls_emp-ename = 'Ravi'.

82 | P a g e

Santosh P

insert ls_emp into table lt_emp. clear ls_emp. ls_emp-empno = 2. ls_emp-ename = 'Ramu'. insert ls_emp into table lt_emp. clear ls_emp. ls_emp-empno = 1. ls_emp-ename = 'Ramesh'. insert ls_emp into table lt_emp.

loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename. endloop.

Z9AMPROGRAM87:
REPORT Z9AMPROGRAM87. types : begin of ty_emp, empno type i, ename(20) type c, end of ty_emp. data : lt_emp type sorted table of ty_emp with unique KEY empno ename, ls_emp type ty_emp. clear ls_emp. ls_emp-empno = 3. ls_emp-ename = 'Raju'. insert ls_emp into table lt_emp.

83 | P a g e

Santosh P

clear ls_emp. ls_emp-empno = 1. ls_emp-ename = 'Ravi'. insert ls_emp into table lt_emp. clear ls_emp. ls_emp-empno = 2. ls_emp-ename = 'Ramu'. insert ls_emp into table lt_emp. clear ls_emp. ls_emp-empno = 1. ls_emp-ename = 'Ramesh'. insert ls_emp into table lt_emp. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename. endloop. write :/ '*****************'. clear ls_emp. read table lt_emp into ls_emp index 2. if sy-subrc eq 0. write :/ ls_emp-empno, ls_emp-ename. else. write :/ 'No record'. endif. write :/ '*****************'. clear ls_emp. read table lt_emp into ls_emp with key empno = 1. if sy-subrc eq 0. write :/ ls_emp-empno, ls_emp-ename. else. write :/ 'No record'. endif.

84 | P a g e

Santosh P

Z9AMPROGRAM88:
REPORT Z9AMPROGRAM88. types : begin of ty_emp, empno type i, ename(20) type c, end of ty_emp. data : lt_emp type hashed table of ty_emp with unique key empno, ls_emp type ty_emp. clear ls_emp. ls_emp-empno = 3. ls_emp-ename = 'raju'. insert ls_emp into table lt_emp. clear ls_emp. ls_emp-empno = 1. ls_emp-ename = 'ravi'. insert ls_emp into table lt_emp. clear ls_emp. ls_emp-empno = 2. ls_emp-ename = 'ramu'. insert ls_emp into table lt_emp. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename. endloop.

85 | P a g e

Santosh P

sort lt_emp. write :/ 'After sort'. loop at lt_emp into ls_emp. write :/ ls_emp-empno, ls_emp-ename. endloop. write :/ '****************'. clear ls_emp. read table lt_emp into ls_emp with key empno = 1. if sy-subrc eq 0. write :/ ls_emp-empno, ls_emp-ename. else. write :/ 'No record'. endif.

Z9AMPROGRAM89:
REPORT Z9AMPROGRAM89. data : begin of wa, deptno(3) type c, ename(20) type c, empsal type i, end of wa. data : lt_emp like sorted table of wa with non-unique key deptno ename. clear wa. wa-deptno = 'a1'.

86 | P a g e

Santosh P

wa-ename = 'raju'. wa-empsal = 1000. insert wa into table lt_emp. clear wa. wa-deptno = 'a2'. wa-ename = 'ravi'. wa-empsal = 2000. insert wa into table lt_emp. clear wa. wa-deptno = 'a1'. wa-ename = 'raju'. wa-empsal = 3000. insert wa into table lt_emp. loop at lt_emp into wa. write :/ wa-deptno, wa-ename, wa-empsal. endloop.

Z9AMPROGRAM90:
REPORT Z9AMPROGRAM90. data : begin of wa, deptno(3) type c, ename(20) type c, empsal type i, end of wa. data : lt_emp like sorted table of wa with non-unique key deptno ename. clear wa. wa-deptno = 'a1'.

87 | P a g e

Santosh P

wa-ename = 'raju'. wa-empsal = 1000. collect wa into lt_emp. clear wa. wa-deptno = 'a2'. wa-ename = 'ravi'. wa-empsal = 2000. collect wa into lt_emp. clear wa. wa-deptno = 'a1'. wa-ename = 'raju'. wa-empsal = 3000. collect wa into lt_emp. loop at lt_emp into wa. write :/ wa-deptno, wa-ename, wa-empsal. endloop.

Z9AMPROGRAM91:
REPORT Z9AMPROGRAM91. data : begin of wa, deptno(3) type c, ename(20) type c, empsal type i, end of wa. data : lt_emp like standard table of wa. clear wa. wa-deptno = 'a1'. wa-ename = 'raju'. wa-empsal = 1000.

88 | P a g e

Santosh P

append wa to lt_emp. clear wa. wa-deptno = 'a2'. wa-ename = 'ravi'. wa-empsal = 2000. append wa to lt_emp.

clear wa. wa-deptno = 'a1'. wa-ename = 'raju'. wa-empsal = 3000. append wa to lt_emp.

loop at lt_emp into wa. write :/ wa-deptno, wa-ename, wa-empsal. endloop.

Z9AMPROGRAM92:
REPORT Z9AMPROGRAM92. data : begin of wa, deptno(3) type c, ename(20) type c, empsal type i, end of wa. data : lt_emp like standard table of wa. clear wa. wa-deptno = 'a1'. wa-ename = 'raju'.

89 | P a g e

Santosh P

wa-empsal = 1000. collect wa into lt_emp. clear wa. wa-deptno = 'a2'. wa-ename = 'ravi'. wa-empsal = 2000. collect wa into lt_emp. clear wa. wa-deptno = 'a1'. wa-ename = 'raju'. wa-empsal = 3000. collect wa into lt_emp. loop at lt_emp into wa. write :/ wa-deptno, wa-ename, wa-empsal. endloop.

Z9AMPROGRAM93:
REPORT Z9AMPROGRAM93. *message i900(z9ammsg) with 'information'. *message s902(z9ammsg) with 'status'. *message w903(z9ammsg) with 'warning'. *message a904(z9ammsg) with 'abort'. message e901(z9ammsg) with 'error'.

Z9AMPROGRAM94:
90 | P a g e Santosh P

REPORT

Z9AMPROGRAM94.

types : begin of ty_emp_dept. include structure zgemp. types : v_deptno type zgdept-deptno, dname type zgdept-dname, loc type zgdept-loc, end of ty_emp_dept. data : lt_emp_dept type standard table of ty_emp_dept, ls_emp_dept type ty_emp_dept. select * from zgemp inner join zgdept on zgemp~deptno = zgdept~deptno into table lt_emp_dept. if sy-subrc eq 0. loop at lt_emp_dept into ls_emp_dept. write :/ ls_emp_dept-empno, (10) ls_emp_dept-ename, ls_emp_dept-deptno, ls_emp_dept-v_deptno, ls_emp_dept-dname, ls_emp_dept-loc. skip 2. endloop. else. write :/ 'No data'. endif.

Z9AMPROGRAM95:
REPORT Z9AMPROGRAM95. types : begin of ty_emp_dept. include structure zgemp. types : v_deptno type zgdept-deptno, dname type zgdept-dname,

91 | P a g e

Santosh P

loc type zgdept-loc, end of ty_emp_dept. data : lt_emp_dept type standard table of ty_emp_dept, ls_emp_dept type ty_emp_dept. select * from zgemp as x inner join zgdept as y on x~deptno = y~deptno into table lt_emp_dept. if sy-subrc eq 0. loop at lt_emp_dept into ls_emp_dept. write :/ ls_emp_dept-empno, (10) ls_emp_dept-ename, ls_emp_dept-deptno, ls_emp_dept-v_deptno, ls_emp_dept-dname, ls_emp_dept-loc. skip 2. endloop. else. write :/ 'No data'. endif.

Z9AMPROGRAM96:
REPORT Z9AMPROGRAM96. types : begin of ty_emp_dept. include structure zgemp. types : v_deptno type zgdept-deptno, dname type zgdept-dname, end of ty_emp_dept. data : lt_emp_dept type standard table of ty_emp_dept, ls_emp_dept type ty_emp_dept.

92 | P a g e

Santosh P

select empno ename x~deptno y~deptno dname from zgemp as x inner join zgdept as y on x~deptno = y~deptno into table lt_emp_dept. if sy-subrc eq 0. loop at lt_emp_dept into ls_emp_dept. write :/ ls_emp_dept-empno, (10) ls_emp_dept-ename, ls_emp_dept-deptno, ls_emp_dept-v_deptno, ls_emp_dept-dname. skip 2. endloop. else. write :/ 'No data'. endif.

Z9AMPROGRAM97:
93 | P a g e Santosh P

REPORT

Z9AMPROGRAM97.

types : begin of ty_emp_dept. include structure zgemp. types : v_deptno type zgdept-deptno, dname type zgdept-dname, end of ty_emp_dept. data : lt_emp_dept type standard table of ty_emp_dept, ls_emp_dept type ty_emp_dept. select empno ename zgemp~deptno zgdept~deptno dname from zgemp inner join zgdept on zgemp~deptno = zgdept~deptno into table lt_emp_dept. if sy-subrc eq 0. loop at lt_emp_dept into ls_emp_dept. write :/ ls_emp_dept-empno, (10) ls_emp_dept-ename, ls_emp_dept-deptno, ls_emp_dept-v_deptno, ls_emp_dept-dname. skip 2. endloop. else. write :/ 'No data'. endif.

94 | P a g e

Santosh P

Z9AMPROGRAM98:
REPORT Z9AMPROGRAM98. types : begin of ty_emp_dept. include structure zgemp. types : v_deptno type zgdept-deptno, dname type zgdept-dname, end of ty_emp_dept. data : lt_emp_dept type standard table of ty_emp_dept, ls_emp_dept type ty_emp_dept. select empno ename zgemp~deptno zgdept~deptno dname from zgemp inner join zgdept on zgemp~deptno = zgdept~deptno

95 | P a g e

Santosh P

into table lt_emp_dept where zgemp~deptno ne 10. if sy-subrc eq 0. loop at lt_emp_dept into ls_emp_dept. write :/ ls_emp_dept-empno, (10) ls_emp_dept-ename, ls_emp_dept-deptno, ls_emp_dept-v_deptno, ls_emp_dept-dname. skip 2. endloop. else. write :/ 'No data'. endif.

Z9AMPROGRAM99:
96 | P a g e Santosh P

REPORT

Z9AMPROGRAM99.

types : begin of ty_emp_dept. include structure zgemp. types : v_deptno type zgdept-deptno, dname type zgdept-dname, end of ty_emp_dept. data : lt_emp_dept type standard table of ty_emp_dept, ls_emp_dept type ty_emp_dept. select empno ename zgemp~deptno zgdept~deptno dname from zgemp left outer join zgdept on zgemp~deptno = zgdept~deptno into table lt_emp_dept. if sy-subrc eq 0. loop at lt_emp_dept into ls_emp_dept. write :/ ls_emp_dept-empno, (10) ls_emp_dept-ename, ls_emp_dept-deptno, ls_emp_dept-v_deptno, ls_emp_dept-dname. skip 2. endloop. else. write :/ 'No data'. endif.

97 | P a g e

Santosh P

Z9AMPROGRAM100:
REPORT Z9AMPROGRAM100. write :/ 'welcome'. write :/ 'hello'. write :/ 'hai'. write :/ 'welcome'. write :/ 'hello'. write :/ 'bye'. write :/ 'welcome'. write :/ 'hello'.

98 | P a g e

Santosh P

Z9AMPROGRAM101:
REPORT Z9AMPROGRAM101. write :/ 'begin'. perform abc. write :/ 'hello'. perform abc. write :/ 'bye'. perform abc. form abc. write :/ 'welcome'. write :/ 'hello'. endform.

99 | P a g e

Santosh P

Z9 AMPROGRAM102:
REPORT Z9AMPROGRAM102. perform abc(z9ampool). perform pqr(z9ampool). write :/ 'hello'.

Z9AMPOOL:(SUBROUTINE)
PROGRAM Z9AMPOOL. data : x type i value 10, y type i value 5, z type i. types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, end of ty_kna1. data : ls_kna1 type ty_kna1. * lt_kna1 type table of ty_kna1. form abc. z = x + y. write :/ 'sum is ',z. endform. form pqr. z = x - y. write :/ 'difference is ',z. endform. form lmn tables gt_kna1 structure ls_kna1. delete gt_kna1 where land1 = 'AR'. endform.

100 | P a g e

Santosh P

Z9AMPROGRAM103:
REPORT Z9AMPROGRAM103. data : x type i value 10, y type i value 20. write :/ 'X and Y before subroutine',x,y. perform abc using x y. form abc. endform. "actual parameters

Z9AMPROGRAM104:
REPORT Z9AMPROGRAM104.

data : x type i value 10, y type i value 20. write :/ 'X and Y before subroutine',x,y. perform abc using x y. "actual parameters

write :/ 'X and Y after subroutine',x,y. form abc using m n. "formal parameters data z type i. "local variable z = m. m = n. n = z. endform.

101 | P a g e

Santosh P

Z9AMPROGRAM105:
REPORT Z9AMPROGRAM105.

data : x type i value 10, y type i value 20. write :/ 'X and Y before subroutine',x,y. perform abc using x y. "actual parameters

write :/ 'X and Y after subroutine',x,y. form abc using value(m) value(n). data z type i. "local variable z = m. m = n. n = z. endform. "formal parameters

Z9AMPROGRAM106:
REPORT Z9AMPROGRAM106. types : begin of ty_kna1, kunnr type kna1-kunnr,

102 | P a g e

Santosh P

land1 type kna1-land1, name1 type kna1-name1, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1. select kunnr land1 name1 from kna1 into table lt_kna1 where land1 in ('AR','IN'). if sy-subrc eq 0. describe table lt_kna1. write :/ 'No of records before sub:',sy-tfill. perform abc tables lt_kna1. describe table lt_kna1. write :/ 'No of records after sub:',sy-tfill. endif. form abc tables gt_kna1 structure ls_kna1. delete gt_kna1 where land1 = 'AR'. endform.

Z9AMPROGRAM107:
REPORT Z9AMPROGRAM107. types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1.

103 | P a g e

Santosh P

select kunnr land1 name1 from kna1 into table lt_kna1 where land1 in ('AR','IN'). if sy-subrc eq 0. describe table lt_kna1. write :/ 'No of records before sub:',sy-tfill. perform lmn(z9ampool) tables lt_kna1 . describe table lt_kna1. write :/ 'No of records after sub:',sy-tfill. endif.

Z9AMPOOL:
*&---------------------------------------------------------------------* *& Subroutine Pool Z9AMPOOL *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* PROGRAM Z9AMPOOL.

data : x type i value 10, y type i value 5, z type i. types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, end of ty_kna1. data : ls_kna1 type ty_kna1. * lt_kna1 type table of ty_kna1. form abc. z = x + y. write :/ 'sum is ',z. endform. form pqr. z = x - y. write :/ 'difference is ',z. endform.

104 | P a g e

Santosh P

form lmn tables gt_kna1 structure ls_kna1. delete gt_kna1 where land1 = 'AR'. endform.

Z9AMPROGRAM108:
REPORT Z9AMPROGRAM108. data : x type i value 10, y type i value 20, z type i, z1 type i. write :/ 'Z is ',z. write :/ 'Z1 is ',z1.

perform abc using x y z z1. write :/ 'Z is ',z. write :/ 'Z1 is ',z1. form abc using m n r r1. r = m + n. r1 = m * n. endform.

105 | P a g e

Santosh P

Z9AMPROGRAM109:
REPORT Z9AMPROGRAM109. data : x type i value 10, y type i value 20, z type i, z1 type i. write :/ 'Z is ',z. write :/ 'Z1 is ',z1.

perform abc using x y changing z z1. write :/ 'Z is ',z. write :/ 'Z1 is ',z1. form abc using m n changing value(r) value(r1). r = m + n. r1 = m * n. endform.

Z9AMPROGRAM110:
REPORT Z9AMPROGRAM110. data : x type i value 10, y type i value 20, z type i, z1 type i. write :/ 'Z is ',z. write :/ 'Z1 is ',z1. perform abc using x y z z1.

106 | P a g e

Santosh P

write :/ 'Z is ',z. write :/ 'Z1 is ',z1. write :/ 'X is ',x. write :/ 'Y is ',y. form abc using value(m) value(n) r r1. r = m + n. r1 = m * n. m = 30. n = 40. endform.

Z9AMPROGRAM111:
REPORT Z9AMPROGRAM111. parameters : p_land1 type kna1-land1. types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1. describe table lt_kna1. write :/ 'No of records :',sy-tfill. perform abc tables lt_kna1 using p_land1. describe table lt_kna1. write :/ 'No of records :',sy-tfill.

107 | P a g e

Santosh P

form abc tables gt_kna1 structure ls_kna1 using i_land1. select kunnr land1 name1 from kna1 into table gt_kna1 where land1 = i_land1. endform.

Z9AMPROGRAM112:
REPORT Z9AMPROGRAM112. parameters : p_land1 type kna1-land1. types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1. describe table lt_kna1. write :/ 'No of records :',sy-tfill. perform abc tables lt_kna1 changing p_land1. describe table lt_kna1.

108 | P a g e

Santosh P

write :/ 'No of records :',sy-tfill. form abc tables gt_kna1 structure ls_kna1 changing i_land1. select kunnr land1 name1 from kna1 into table gt_kna1 where land1 = i_land1. endform.

Z9AMPROGRAM113:
data : x type i, y type i, z type i. form abc. write :/ 'inside abc'. endform.

Z9AMPROGRAM114:
109 | P a g e Santosh P

REPORT

Z9AMPROGRAM114.

include z9amprogram113. x = 10. y = 20. z = x + y. write z.

Z9AMPROGRAM115:
REPORT Z9AMPROGRAM115. include Z9AMPROGRAM113. start-of-selection. perform abc.

Z9AMPROGRAM116:
REPORT Z9AMPROGRAM116. parameters : p_x type i, p_y type i. data r type i. CALL FUNCTION 'Z930FM1'

EXPORTING I_X I_Y * IMPORTING * E_Z

= p_x = p_y. = r.

110 | P a g e

Santosh P

* r = p_x + p_y. write :/ 'sum is ',r.

FUNCTION MODULE Z930FM1:

111 | P a g e

Santosh P

OUTPUT:

Z9AMPROGRAM117:
REPORT Z9AMPROGRAM117. data : i_x type i, i_y type i.

112 | P a g e

Santosh P

data: K_Z type i. CALL FUNCTION 'ZFUN'. * EXPORTING * I_X = 10 * I_Y = 20 * IMPORTING * E_Z = K_Z. K_Z = I_X + I_Y. write : / 'Sum is ',K_Z.

FUNCTION MODULE ZFUN:

113 | P a g e

Santosh P

OUTPUT:

Z9AMPROGRAM118:
REPORT Z9AMPROGRAM118. parameters : p_land1 type kna1-land1. types : begin of ty_kna1. include structure zcstype. types end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1. CALL FUNCTION 'Z930FM3'

114 | P a g e

Santosh P

EXPORTING i_land1 tables t_kna1

= p_land1 = lt_kna1.

if lt_kna1[] is not initial. loop at lt_kna1 into ls_kna1. write :/ ls_kna1-kunnr, ls_kna1-land1, ls_kna1-name1. endloop. else. message 'No data' type 'I'. endif.

FUNCTION MODULE Z930FM3:

115 | P a g e

Santosh P

OUTPUT:

116 | P a g e

Santosh P

Z 9AMPROGRAM119:
REPORT Z9AMPROGRAM119. parameters : p_land1 type kna1-land1. types : begin of ty_kna1. include structure zcstype. types end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1. CALL FUNCTION 'Z930FM4' EXPORTING i_land1 = p_land1 changing t_kna1 = lt_kna1.

if lt_kna1[] is not initial. loop at lt_kna1 into ls_kna1. write :/ ls_kna1-kunnr, ls_kna1-land1, ls_kna1-name1. endloop. else. message 'No data' type 'I'. endif.

117 | P a g e

Santosh P

FUNCTION MODULE Z930FM4:

118 | P a g e

Santosh P

OUTPUT:

119 | P a g e

Santosh P

Z9AMPROGRAM120:
REPORT Z9AMPROGRAM120. types : begin of ty_kna1. include structure zcstype. types end of ty_kna1. data : lt_kna1 type standard table of ty_kna1. select kunnr land1 name1 from kna1 into table lt_kna1 where land1 in ('AR','IN'). if sy-subrc eq 0. describe table lt_kna1. write :/ 'No of records :',sy-tfill. CALL FUNCTION 'Z930FM5' CHANGING t_kna1 = lt_kna1. describe table lt_kna1. write :/ 'No of records :',sy-tfill. endif.

120 | P a g e

Santosh P

FUNCTION MODULE Z930FM5:

OUTPUT:

121 | P a g e

Santosh P

Z9AMPROGRAM121:
REPORT Z9AMPROGRAM121. parameters : p_x type i, p_y type i. data r type i. CALL FUNCTION 'Z930FM6' EXPORTING i_x = p_x i_y = p_y IMPORTING E_Z = r. write :/ 'Division is ',r. write :/ 'end'.

FUNCTION MODULE Z930FM6:

122 | P a g e

Santosh P

OUTPUT:

123 | P a g e

Santosh P

Z9AMPROGRAM122:
REPORT Z9AMPROGRAM122. parameters : p_x type i, p_y type i. data res type i. CALL FUNCTION 'Z930FM7' EXPORTING i_x = p_x i_y = p_y IMPORTING E_Z = res EXCEPTIONS MYEXCEPTION = 1 OTHERS = 2. if sy-subrc eq 1. message 'Cannot divide by zero' type 'I'. elseif sy-subrc eq 2. message 'Unknown error' type 'I'.

124 | P a g e

Santosh P

elseif sy-subrc eq 0. write :/ 'Division is ',res. endif.

FUNCTION MODULE Z930FM7:

125 | P a g e

Santosh P

OUTPUT:

Z9AMPROGRAM123:
126 | P a g e Santosh P

REPORT

Z9AMPROGRAM123.

define abc. &3 = &1 + &2. &4 = &1 - &2. end-of-definition. data : r1 type i, r2 type i. abc 20 10 r1 r2. write :/ 'Sum is ',r1, / 'Difference is ',r2. abc 30 16 r1 r2. write :/ 'Sum is ',r1, / 'Difference is ',r2. abc 80 60 r1.

ERROR:

SELECTION SCREEN PROGRAMING Z9AMPROGRAM124:


REPORT Z9AMPROGRAM124. include zmyinc. selection-screen begin of block b1 with frame title abc. selection-screen begin of line. selection-screen comment 6(20) lb1. parameters : p_empno type zemp200-empno default 10. selection-screen end of line. selection-screen begin of line. selection-screen comment 6(20) lb2.

127 | P a g e

Santosh P

parameters : p_ename type zemp200-ename. selection-screen end of line. selection-screen begin of line. selection-screen comment 6(20) lb3. parameters p_desig type zemp200-empdesig. selection-screen end of line. selection-screen end of block b1. selection-screen begin of block b2 with frame title pqr. selection-screen skip 2. selection-screen pushbutton 5(10) bt1 user-command p1. selection-screen pushbutton 18(10) bt2 user-command p2. selection-screen pushbutton 31(10) bt3 user-command p3. selection-screen pushbutton /5(10) bt4 user-command p4. selection-screen pushbutton 18(10) bt5 user-command p5. selection-screen pushbutton 31(10) bt6 user-command p6. selection-screen end of block b2. initialization. lb1 = 'Employee No'. lb2 = 'Employee Name'. lb3 = 'Employee Designation'. abc = 'Employee'. pqr = 'DB operations'. bt1 = 'Search'. bt2 = 'Insert'. bt3 = 'Delete'. bt4 = 'Modify'. bt5 = 'Clear'. bt6 = 'Exit'. at selection-screen output. if flag eq 0. loop at screen. if screen-name = 'LB2' or screen-name = 'LB3' or screen-name = 'P_ENAME' or screen-name = 'P_DESIG'. screen-invisible = '1'. screen-input = '0'.

128 | P a g e

Santosh P

modify screen. endif. endloop. elseif flag eq 1. loop at screen. if screen-name = 'LB2' or screen-name = 'LB3' or screen-name = 'P_ENAME' or screen-name = 'P_DESIG'. screen-invisible = '0'. screen-input = '1'. modify screen. endif. if screen-name = 'P_EMPNO'. screen-input = '0'. modify screen. endif. endloop. elseif flag = 2. loop at screen. if screen-name = 'LB1' or screen-name = 'P_EMPNO' or screen-name = 'LB2' or screen-name = 'P_ENAME' or screen-name = 'LB3' or screen-name = 'P_DESIG'. screen-invisible = '0'. screen-input = '1'. modify screen. endif. endloop. endif. at selection-screen. case sy-ucomm. when 'P6'. leave program. when 'P4'. if p_empno is not initial. perform modify. else. message 'Please enter empno' type 'I'. endif. endcase. at selection-screen on p_empno. if p_empno is not initial. perform getemployee using p_empno.

129 | P a g e

Santosh P

if ls_emp is not initial. p_ename = ls_emp-ename. p_desig = ls_emp-empdesig. flag = 1. else. message 'Employee Not found' type 'I'. endif. else. message 'Please enter empno' type 'I'. endif. at selection-screen on value-request for p_empno. perform getdata. if lt_emp[] is not initial. perform displayf4. endif.

form modify . clear ls_employee. ls_employee-empno = p_empno. ls_employee-ename = p_ename. ls_employee-empdesig = p_desig. modify zemp200 from ls_employee. if sy-subrc eq 0. message 'Record updated' type 'I'. flag = 2. perform clearscreen. else. message 'Record not updated' type 'I'. endif. endform. " modify

form clearscreen . clear : p_empno, p_ename, p_desig. endform.

" clearscreen

130 | P a g e

Santosh P

Z9AMPROGRAM125:
REPORT Z9AMPROGRAM125. selection-screen begin of tabbed block tb1 for 5 lines. selection-screen tab (10) t1 user-command p1. selection-screen tab (10) t2 user-command p2. selection-screen end of block tb1.

selection-screen pushbutton 6(10) bt1 user-command p3. selection-screen pushbutton 19(10) bt2 user-command p4.

selection-screen begin of screen 100 as subscreen. selection-screen begin of line. selection-screen comment 5(20) lb1. parameters : p_empno type zemp200-empno. selection-screen end of line. selection-screen begin of line. selection-screen comment 5(20) text-011. parameters : p_ename type zemp200-ename. selection-screen end of line. selection-screen end of screen 100.

131 | P a g e

Santosh P

selection-screen begin of screen 200 as subscreen. selection-screen begin of line. selection-screen comment 5(20) lb3. parameters : p_state type zemp200-empstate. selection-screen end of line. selection-screen begin of line. selection-screen comment 5(20) lb4. parameters : p_city type zemp200-empcity. selection-screen end of line. selection-screen end of screen 200.

initialization. lb1 = 'Employee No'. * lb2 = text-002. lb3 = 'Employee state'. lb4 = 'Employee City'. bt1 = 'Insert'. bt2 = 'Exit'. t1 = 'First'. t2 = 'Second'. at selection-screen. case sy-ucomm. when 'P1'. tb1-activetab = 'P1'. tb1-dynnr = '100'. tb1-prog = sy-repid. when 'P2'. tb1-activetab = 'P2'. tb1-dynnr = '200'. tb1-prog = sy-repid. endcase.

132 | P a g e

Santosh P

Z9AMPROGRAM126:
REPORT Z9AMPROGRAM126. tables sscrfields. "creates a default work area parameters x type i default 200. selection-screen selection-screen selection-screen selection-screen selection-screen function function function function function key key key key key 1. 2. 3. 4. 5.

initialization. sscrfields-functxt_01 sscrfields-functxt_02 sscrfields-functxt_03 sscrfields-functxt_04 sscrfields-functxt_05 * at selection-screen.

= = = = =

'Button1'. 'Button2'. 'Button3'. 'EXIT'. 'BACK'.

133 | P a g e

Santosh P

case sy-ucomm. when 'FC01'. message 'Button1' type 'I'. when 'FC02'. message 'Button2' type 'I'. when 'FC03'. leave to list-processing. write :/ 'x=', x. when 'FC04'. Leave program. when 'FC05'. Leave program. endcase.

Z9AMPROGRAM127:
REPORT Z9AMPROGRAM127.

134 | P a g e

Santosh P

set pf-status 'ABC'. write :/ 'hello'. at user-command. case sy-ucomm. WHEN 'BCK'. leave program. when 'P1'. message 'Button1' type 'I'. when 'P2'. message 'Button2' type 'I'. endcase.

SET PF-STATUSABC

135 | P a g e

Santosh P

136 | P a g e

Santosh P

OUTPUT:

MODULE POOL PROGRAMING METHOD 1: Z9AMPROGRAM128:

137 | P a g e

Santosh P

138 | P a g e

Santosh P

SCREEN 100 LAYOUTS:

139 | P a g e

Santosh P

140 | P a g e

Santosh P

141 | P a g e

Santosh P

142 | P a g e

Santosh P

143 | P a g e

Santosh P

DRAG AND DROP THE FIELDS IN THE LAYOUT.

SCREEN 200(SUBSCREEN) LAYOUTS:

144 | P a g e

Santosh P

SCREEN 300(SUBSCREEN) LAYOUTS:

145 | P a g e

Santosh P

SCREEN 400(SUBSCREEN) LAYOUTS:

146 | P a g e

Santosh P

LOW LOGIC OF SCREEN 100:


PROCESS BEFORE OUTPUT. call subscreen ref1 including sy-repid scrno. MODULE abc. * PROCESS AFTER INPUT. call subscreen ref1. MODULE USER_COMMAND_0100.

PBO:
MODULE abc OUTPUT. set pf-status 'PQR'. ENDMODULE. " abc OUTPUT

PAI:
MODULE USER_COMMAND_0100 INPUT. case sy-ucomm. when 'BACK'. leave program. when 'T3'. tbstr-activetab = 'T3'. SCRNO = '400'. when 'P2'. tbstr-activetab = 'P2'. scrno = '300'. when 'P1'. tbstr-activetab = 'P1'. scrno = '200'. when 'P4'. leave program. endcase. ENDMODULE.

147 | P a g e

Santosh P

LOW LOGIC OF SCREEN 200:


PROCESS BEFORE OUTPUT. * MODULE STATUS_0200. * PROCESS AFTER INPUT. * MODULE USER_COMMAND_0200.

LOW LOGIC OF SCREEN 300:

PROCESS BEFORE OUTPUT. * MODULE STATUS_0300. * PROCESS AFTER INPUT. * MODULE USER_COMMAND_0300.

LOW LOGIC OF SCREEN 400:


PROCESS BEFORE OUTPUT. * MODULE STATUS_0400. * PROCESS AFTER INPUT. * MODULE USER_COMMAND_0400.

Z128TOP:
*&---------------------------------------------------------------------* *& Include Z128TOP Module Pool 8 *& *&---------------------------------------------------------------------* PROGRAM Z9AMPROGRAM128. Z9AMPROGRAM12

controls tbstr type tabstrip. data scrno type sy-dynnr value '200'.

MODULE abc OUTPUT. set pf-status 'PQR'. ENDMODULE.

" abc

OUTPUT

MODULE USER_COMMAND_0100 INPUT.

148 | P a g e

Santosh P

case sy-ucomm. when 'BACK'. leave program. when 'T3'. tbstr-activetab = 'T3'. SCRNO = '400'. when 'P2'. tbstr-activetab = 'P2'. scrno = '300'. when 'P1'. tbstr-activetab = 'P1'. scrno = '200'. when 'P4'. leave program. endcase. ENDMODULE.

149 | P a g e

Santosh P

OUTPUT:

150 | P a g e

Santosh P

Z9AMPROGRAM129:

151 | P a g e

Santosh P

152 | P a g e

Santosh P

CREATING T-CODE: (Z129)

153 | P a g e

Santosh P

SCREEN 100 FLOW LOGIC:


PROCESS MODULE * PROCESS MODULE BEFORE OUTPUT. STATUS_0100. AFTER INPUT. USER_COMMAND_0100.

PBO:
MODULE STATUS_0100 OUTPUT. if flag eq 0. loop at screen. if screen-group1 = 'G1' or screen-group2 = 'G2'. screen-invisible = '1'. screen-input = '0'.

154 | P a g e

Santosh P

modify screen. endif. endloop. clear ls_values. ls_values-key = 'K1'. ls_values-text = 'KNA1'. append ls_values to lt_values. clear ls_values. ls_values-key = 'K2'. ls_values-text = 'MARA'. append ls_values to lt_values. clear ls_values. ls_values-key = 'K3'. ls_values-text = 'VBAK'. append ls_values to lt_values. call function 'VRM_SET_VALUES' exporting ID = 'IO1' VALUES = lt_values[]. * flag = 1. elseif flag = 2. loop at screen. if screen-group1 = 'G1'. screen-invisible = '0'. screen-input = '1'. modify screen. elseif screen-group2 = 'G2'. screen-invisible = '1'. screen-input = '0'. modify screen. endif. endloop. elseif flag = 3. loop at screen. if screen-group1 = 'G1'. screen-invisible = '1'. screen-input = '0'. modify screen. elseif screen-group2 = 'G2'. screen-invisible = '0'. screen-input = '1'. modify screen. endif. endloop. endif.

155 | P a g e

Santosh P

ENDMODULE.

" STATUS_0100

OUTPUT

PAI:
MODULE USER_COMMAND_0100 INPUT. case sy-ucomm. when 'P2'. if io1 = 'K1'. flag = 2. elseif io1 = 'K2'. flag = 3. endif. when 'P1'. leave program. endcase. ENDMODULE. " USER_COMMAND_0100

INPUT

129TOP :
*&---------------------------------------------------------------------* *& Include Z129TOP Module Pool 9 *& *&---------------------------------------------------------------------* PROGRAM Z9AMPROGRAM129. Z9AMPROGRAM12

data : io1(10) type c. type-pools vrm. data flag type i. data : lt_values type standard table of vrm_value, ls_values type vrm_value.

OUTPUT:

156 | P a g e

Santosh P

SELECT KNA1

SLELCT MARA

USE EXITBACK TO PROGRAM

Z9AMPRZOGRAM130:
157 | P a g e Santosh P

SCREEN 100 LAYOUT:

158 | P a g e

Santosh P

SCREEN 100 FLOWLOGIC:


PROCESS BEFORE OUTPUT. * MODULE STATUS_0100. PROCESS AFTER INPUT. *chain. field kna1-kunnr. field kna1-land1 values ('IN','AR'). field kna1-updat. *endchain. module abc at exit-command. field kna1-land1 module pqr. MODULE USER_COMMAND_0100.

MODULE ABC:
MODULE abc INPUT. case sy-ucomm. when 'P2'. leave program. endcase. ENDMODULE.

" abc

INPUT

MODULE PQR:
MODULE pqr INPUT. select single * from kna1 where land1 = kna1-land1. if sy-subrc ne 0. message e888(zmymsg) with 'Please choose the country'. endif. ENDMODULE. " pqr INPUT

159 | P a g e

Santosh P

PBO:
* MODULE STATUS_0100.

PAI:
MODULE USER_COMMAND_0100 INPUT. case sy-ucomm. when 'P1'. leave program. endcase. ENDMODULE. " USER_COMMAND_0100

INPUT

Z130TOP:
*&---------------------------------------------------------------------* *& Include Z130TOP Module Pool 0 *& *&---------------------------------------------------------------------* PROGRAM Z9AMPROGRAM130. Z9AMPROGRAM13

tables kna1. MODULE USER_COMMAND_0100 INPUT. case sy-ucomm. when 'P1'. leave program. endcase. ENDMODULE.

OUTPUT:

Z9AMPROGRAM131:
160 | P a g e Santosh P

SCREEN 100 LAYOUT:

161 | P a g e

Santosh P

TRANSACTION CODE:

162 | P a g e

Santosh P

SCREEN 100 FLOW LOGIC:


PROCESS BEFORE OUTPUT. loop at lt_kna1 into ls_kna1 with control tbctrl. module transfer. endloop. * MODULE STATUS_0100. * PROCESS AFTER INPUT. loop. endloop. MODULE USER_COMMAND_0100.

MODULE TRANSFER:
MODULE transfer OUTPUT. kna1-kunnr = ls_kna1-kunnr. kna1-name1 = ls_kna1-name1. kna1-name2 = ls_kna1-name2. * move-corresponding ls_kna1 to kna1. ENDMODULE. " transfer OUTPUT

163 | P a g e

Santosh P

PBO:
* MODULE STATUS_0100.

PAI:
MODULE USER_COMMAND_0100 INPUT. case sy-ucomm. when 'P2'. leave program. when 'P1'. if kna1-land1 is not initial. perform getdata. else. message 'Please enter country' type 'I'. endif. endcase. ENDMODULE. " USER_COMMAND_0100 INPUT

PERFORM GETDATA:
FORM getdata . select kunnr name1 name2 from kna1 into table lt_kna1 where land1 = kna1-land1. if sy-subrc eq 0. describe table lt_kna1. tbctrl-lines = sy-tfill. endif. ENDFORM. " getdata

Z131TOP:
*&---------------------------------------------------------------------* *& Include Z131TOP *&---------------------------------------------------------------------* tables kna1. controls tbctrl type tableview using screen 100. types : begin of ty_kna1, kunnr type kna1-kunnr, name1 type kna1-name1, name2 type kna1-name2, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1.

164 | P a g e

Santosh P

Z9AMPROGRAM132:

165 | P a g e

Santosh P

166 | P a g e

Santosh P

FLOWLOGIC:
PROCESS BEFORE OUTPUT. loop at lt_sales into ls_sales with control tbctrl. MODULE STATUS_0100. endloop. * PROCESS AFTER INPUT. loop. endloop. MODULE USER_COMMAND_0100. process on help-request. field vbak-vbeln module abc. process on value-request. field vbak-vbeln module xyz.

167 | P a g e

Santosh P

MODULE ABC:
MODULE abc INPUT. CALL FUNCTION 'POPUP_TO_INFORM' EXPORTING TITEL = 'Custom F1 help' TXT1 = 'VBAK Table' TXT2 = 'VBELN field'. call screen 200 starting at 10 20 ending at 50 60. ENDMODULE. " abc INPUT

MODULE XYZ:
MODULE xyz INPUT. select vbeln kunnr from vbak into table lt_custom where vbeln ge '0000004970' and vbeln le '0000005000'. if sy-subrc eq 0. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING RETFIELD = 'VBELN' DYNPPROG = sy-cprog DYNPNR = sy-dynnr DYNPROFIELD = 'VBAK-VBELN' VALUE_ORG = 'S' TABLES VALUE_TAB = lt_custom[]. endif. ENDMODULE. " xyz INPUT

PBO:
MODULE STATUS_0100 OUTPUT. vbak-erdat = ls_sales-erdat. vbak-erzet = ls_sales-erzet. vbak-ernam = ls_sales-ernam. vbap-posnr = ls_sales-posnr. vbap-matnr = ls_sales-matnr. ENDMODULE. " STATUS_0100

OUTPUT

PAI:
168 | P a g e Santosh P

MODULE USER_COMMAND_0100 INPUT. case sy-ucomm. when 'P2'. leave program. when 'P1'. if vbak-vbeln is not initial. perform getsalesdata. else. message 'Enter sales doc' type 'I'. endif. endcase. ENDMODULE. " USER_COMMAND_0100

INPUT

PERFORM GETSALESDATA:
FORM getsalesdata . select x~erdat x~erzet x~ernam posnr matnr into table lt_sales from vbak as x inner join vbap as y on x~vbeln = y~vbeln where x~vbeln = vbak-vbeln. if sy-subrc eq 0. tbctrl-lines = sy-dbcnt. endif. ENDFORM. " getsalesdata

Z132TOP:
*&---------------------------------------------------------------------* *& Include Z132TOP Module Pool 2 *& *&---------------------------------------------------------------------* PROGRAM Z9AMPROGRAM132. Z9AMPROGRAM13

types : begin of ty_custom, vbeln type vbak-vbeln, kunnr type vbak-kunnr, end of ty_custom. data : lt_custom type standard table of ty_custom, ls_custom type ty_custom. tables : vbak,vbap.

169 | P a g e

Santosh P

types : begin of ty_sales, erdat type vbak-erdat, erzet type vbak-erzet, ernam type vbak-ernam, posnr type vbap-posnr, matnr type vbap-matnr, end of ty_sales. data : lt_sales type standard table of ty_sales, ls_sales type ty_sales. controls tbctrl type tableview using screen 100.

Z9AMPROGRAM133:

SCREEN 100:

170 | P a g e

Santosh P

FLOW LOGIC:
PROCESS BEFORE OUTPUT. call subscreen ref1 including 'Z9AMPROGRAM134' scrno. call subscreen ref2 including 'Z9AMPROGRAM135' scrno.

171 | P a g e

Santosh P

MODULE STATUS_0100. * PROCESS AFTER INPUT. MODULE USER_COMMAND_0100.

PBO:
MODULE STATUS_0100 OUTPUT. SET PF-STATUS 'ABC'. * SET TITLEBAR 'xxx'. ENDMODULE. " STATUS_0100 OUTPUT

PAI:
MODULE USER_COMMAND_0100 INPUT. case sy-ucomm. when 'SAVE'. message 'save' type 'I'. when 'P4'. leave program. when 'P2'. tbstr-activetab = 'P2'. when 'P1'. tbstr-activetab = 'P1'. when 'P3'. if vbak-vbeln is not initial. perform getsalesdata. else. message 'Please enter sales doc no' type 'I'. endif. endcase. ENDMODULE. " USER_COMMAND_0100 INPUT

PERFORM GETSALESDATA:
FORM getsalesdata . select vbak~erdat vbak~erzet vbak~ernam vbap~vbeln posnr matnr into table lt_vbak_vbap from vbak inner join vbap on vbak~vbeln = vbap~vbeln where vbak~vbeln = vbak-vbeln. if sy-subrc eq 0. export lt_vbak_vbap to memory id 'ABC'. read table lt_vbak_vbap into ls_vbak_vbap index 1. if sy-subrc eq 0.

172 | P a g e

Santosh P

vbak-erdat = ls_vbak_vbap-erdat. vbak-erzet = ls_vbak_vbap-erzet. vbak-ernam = ls_vbak_vbap-ernam. endif. endif. ENDFORM. " getsalesdata

MAIN-Z9AMPROGRAM 133:(NOT IN TOP INCLUDE)


PROGRAM Z9AMPROGRAM133. tables : vbak,vbap.

types : begin of ty_vbak_vbap, erdat type vbak-erdat, erzet type vbak-erzet, ernam type vbak-ernam, vbeln type vbap-vbeln, posnr type vbap-posnr, matnr type vbap-matnr, end of ty_vbak_vbap. data : lt_vbak_vbap type standard table of ty_vbak_vbap, ls_vbak_vbap type ty_vbak_vbap. controls tbstr type tabstrip. data scrno type sy-dynnr value '300'.

METHOD 2: SE38: Z9AMPROGRAM134:


*&---------------------------------------------------------------------* *& Report Z9AMPROGRAM134 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z9AMPROGRAM134.

SE51:
173 | P a g e Santosh P

PROCESS BEFORE OUTPUT. * MODULE STATUS_0200. * PROCESS AFTER INPUT. * MODULE USER_COMMAND_0200.

SE38: Z9AMPROGRAM135:
*&---------------------------------------------------------------------* *& Module Pool Z9AMPROGRAM135 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* PROGRAM Z9AMPROGRAM135.

tables vbap. controls tbctrl type tableview using screen 300. types : begin of ty_vbak_vbap, erdat type vbak-erdat, erzet type vbak-erzet, ernam type vbak-ernam, vbeln type vbap-vbeln, posnr type vbap-posnr, matnr type vbap-matnr, end of ty_vbak_vbap.

174 | P a g e

Santosh P

data : lt_vbak_vbap type standard table of ty_vbak_vbap, ls_vbak_vbap type ty_vbak_vbap.

SE51:
PROCESS BEFORE OUTPUT. module getdata. loop at lt_vbak_vbap into ls_vbak_vbap with control tbctrl. module transfer. endloop. * MODULE STATUS_0300. * PROCESS AFTER INPUT. loop. endloop. * MODULE USER_COMMAND_0300.

MODULE GETDATA:
*&---------------------------------------------------------------------* *& Module getdata OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE getdata OUTPUT. import lt_vbak_vbap from memory id 'ABC'. if lt_vbak_vbap[] is not initial. describe table lt_vbak_vbap. tbctrl-lines = sy-tfill. endif. ENDMODULE. " getdata OUTPUT

MODULE TRANSFER:
*&---------------------------------------------------------------------* *& Module transfer OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE transfer OUTPUT. vbap-vbeln = ls_vbak_vbap-vbeln. vbap-posnr = ls_vbak_vbap-posnr. vbap-matnr = ls_vbak_vbap-matnr. ENDMODULE. " transfer OUTPUT

Z9AMPROGRAM136:

175 | P a g e

Santosh P

REPORT

Z9AMPROGRAM136.

parameters : io1 type i, io2 type i, io3 type i. parameters : r1 r2 r3 r4 radiobutton radiobutton radiobutton radiobutton group group group group g1, g1, g1, g1.

start-of-selection. message 'start' type 'I'. at selection-screen. message 'at sel' type 'I'. at selection-screen output. message 'at sel output' type 'I'. at selection-screen on radiobutton group g1. message 'at sel on field' type 'I'.

OUTPUT:

EVENTS:

176 | P a g e

Santosh P

Z9AMPRZOGRAM137:

SCREEN100 LAYOUT:

177 | P a g e

Santosh P

T_CODE:
178 | P a g e Santosh P

FLOW LOGIC:
PROCESS MODULE * PROCESS MODULE BEFORE OUTPUT. STATUS_0100. AFTER INPUT. USER_COMMAND_0100.

PBO:
MODULE STATUS_0100.

PAI:
MODULE USER_COMMAND_0100 INPUT. case sy-ucomm. when 'PB1'.

179 | P a g e

Santosh P

if r1 = 'X'. io3 = io1 + io2. elseif r2 = 'X'. io3 = io1 - io2. elseif r3 = 'X'. io3 = io1 * io2. elseif r4 = 'X'. io3 = io1 / io2. endif. when 'P1'. leave program. endcase. ENDMODULE.

" USER_COMMAND_0100

INPUT

Z137TOP:
*&---------------------------------------------------------------------* *& Include Z137TOP Module Pool 7 *& *&---------------------------------------------------------------------* PROGRAM Z9AMPROGRAM137. Z9AMPROGRAM13

data : io1 type i, io2 type i, io3 type i. data : r1 r2 r3 r4 type type type type c, c, c, c.

OUTPUT:

180 | P a g e

Santosh P

RUNTIME ERROR:

Z9AMPRZOGRAM138:
181 | P a g e Santosh P

REPORT

Z9AMPROGRAM138. type type type type i i i i modif modif modif modif id id id id g1, g1, g2, g2.

parameters : io1 io2 io3 io4

data flag type i. at selection-screen output. if flag eq 0. loop at screen. if screen-group1 = 'G2'. screen-invisible = '1'. screen-input = '0'. modify screen. endif. endloop. endif. at selection-screen on io2. flag = 1. loop at screen. if screen-group1 = 'G2'. screen-invisible = '0'. screen-input = '1'. modify screen. endif. endloop.

OUTPUT:

182 | P a g e

Santosh P

FILE HANDELING ON APPLICATION SERVER


Z9AMPRZOGRAM139:
REPORT Z9AMPROGRAM139.

data : dsn(40) type c value '\\200.200.200.20\c$\file1.txt'.

data str type string value 'Ameerpet'.

open dataset dsn for output in text mode encoding default. if sy-subrc eq 0. transfer str to dsn. close dataset dsn. else. message 'unable to open file' type 'I'. endif.

Z9AMPRZOGRAM140:
183 | P a g e Santosh P

REPORT

Z9AMPROGRAM139.

data : dsn(40) type c value '\\200.200.200.20\c$\file1.txt'.

data str type string.

open dataset dsn for input in text mode encoding default. if sy-subrc eq 0. do. read dataset dsn into str. if sy-subrc eq 0. write :/ str. else. exit. endif. enddo. else. message 'File not opened' type 'I'. endif.

Z9AMPRZOGRAM141:

REPORT

Z9AMPROGRAM139.

data : dsn(40) type c value 184 | P a g e

Santosh P

'\\200.200.200.20\c$\file2.txt'.

data str type string.

open dataset dsn for input in text mode encoding default. if sy-subrc eq 0. do. read dataset dsn into str. if sy-subrc eq 0. write :/ str. else. exit. endif. enddo. else. message 'File not opened' type 'I'. endif.

Z9AMPRZOGRAM142:
REPORT Z9AMPROGRAM139.

data : dsn(40) type c value '\\200.200.200.20\c$\file2.txt'.

data str type string. data msg type string. 185 | P a g e Santosh P

open dataset dsn for input in text mode encoding default message msg. if sy-subrc eq 0. do. read dataset dsn into str. if sy-subrc eq 0. write :/ str. else. exit. endif. enddo. else. write :/ msg. endif.

Z9AMPRZOGRAM143:
REPORT Z9AMPROGRAM139.

data : dsn(40) type c value '\\200.200.200.20\c$\file1txt'.

data str type string value 'Gentech systems'. data msg type string.

open dataset dsn for appending in text mode encoding default message msg. 186 | P a g e Santosh P

if sy-subrc eq 0. transfer str to dsn. else. write :/ msg. endif.

Z9AMPRZOGRAM144:

REPORT

Z9AMPROGRAM139.

data : dsn(40) type c value '\\200.200.200.20\c$\file1.txt'.

data str type string value 'Genesis Software Systems'. data msg type string.

open dataset dsn for update in text mode encoding default message msg. if sy-subrc eq 0. transfer str to dsn. clear str. read dataset dsn into str. if sy-subrc eq 0. write :/ str. else. write :/ 'No line to read'. endif. 187 | P a g e

Santosh P

else. write :/ msg. endif.

Z9AMPRZOGRAM145:

REPORT

Z9AMPROGRAM139.

data : dsn(40) type c value '\\200.200.200.20\c$\file1.txt'.

data str type string. data msg type string. data pos type i.

open dataset dsn for input in text mode encoding default message msg. if sy-subrc eq 0. read dataset dsn into str. if sy-subrc eq 0. write :/ 'Line read is ',str. get dataset dsn position pos. write :/ 'Position is ',pos. pos = pos + 5. set dataset dsn position pos. read dataset dsn into str. if sy-subrc eq 0. 188 | P a g e

Santosh P

write :/ 'Line read is ',str. endif. endif. endif.

Z9AMPRZOGRAM146:

REPORT

Z9AMPROGRAM139.

data : dsn(40) type c value '\\200.200.200.20\c$\file1.txt'.

data str type string. data msg type string. data pos type i.

open dataset dsn for input in text mode encoding default message msg. if sy-subrc eq 0. delete dataset dsn. endif.

BDC

189 | P a g e

Santosh P

Z9AMPROGRAM147:(CALL TRANSACTION METHOD)

REPORT

Z9AMPROGRAM147.

types: begin of ty_legacy, str(200) type c, end of ty_legacy. data : lt_legacy type standard table of ty_legacy, ls_legacy type ty_legacy. types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1. types : begin of ty_bdcdata. include structure bdcdata. types end of ty_bdcdata. data : lt_bdcdata type standard table of ty_bdcdata, ls_bdcdata type ty_bdcdata. CALL FUNCTION 'GUI_UPLOAD' EXPORTING

FILENAME FILETYPE
TABLES

= 'c:\RAJ.txt' = 'ASC' = lt_legacy[].

DATA_TAB

if lt_legacy[] is not initial. loop at lt_legacy into ls_legacy. split ls_legacy-str at ',' into ls_kna1-kunnr

ls_kna1-land1 ls_kna1-name1. 190 | P a g e Santosh P

append ls_kna1 to lt_kna1. endloop. endif.

if lt_kna1[] is not initial. loop at lt_kna1 into ls_kna1. perform prginfo using 'Z9AMPROGRAM147_CALLTRANS' '0100'. perform fldinfo using 'KNA1-KUNNR' ls_kna1-kunnr. perform fldinfo using 'KNA1-LAND1' ls_kna1-land1. perform fldinfo using 'KNA1-NAME1' ls_kna1-name1. call transaction 'Z147' using lt_bdcdata. endloop. endif. form prginfo using prgname scrno. refresh lt_bdcdata. clear ls_bdcdata. ls_bdcdata-program = prgname. ls_bdcdata-dynpro = scrno. ls_bdcdata-dynbegin = 'X'. append ls_bdcdata to lt_bdcdata. endform. form fldinfo using fname fvalue. clear ls_bdcdata.

ls_bdcdata-fnam = fname. ls_bdcdata-fval = fvalue. append ls_bdcdata to lt_bdcdata. endform.

Z9AMPROGRAM147_CALLTRANS:

191 | P a g e

Santosh P

SCREEN 100:

192 | P a g e

Santosh P

FLOW LOGIC:
PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100. * PROCESS AFTER INPUT. MODULE USER_COMMAND_0100.

PBO:
* MODULE STATUS_0100.

PAI:
MODULE USER_COMMAND_0100 INPUT. case sy-ucomm. when 'P1'. insert kna1. if sy-subrc eq 0. message 'Inserted' type 'I'. else. message 'Not inserted' type 'I'. endif. leave program. when 'P2'. leave program. endcase. ENDMODULE. " USER_COMMAND_0100 INPUT

193 | P a g e

Santosh P

Z147TOP:
*&---------------------------------------------------------------------* *& Include Z147TOP Module Pool 7_CALLTRANS *& *&---------------------------------------------------------------------* PROGRAM Z9AMPROGRAM14

Z9AMPROGRAM147_CALLTRANS.

tables kna1.

OUTPUT:

Z9AMPROGRAM148: (SESSION)

rePORT

Z9AMPROGRAM148.

types : begin of ty_legacy,

194 | P a g e

Santosh P

str(200) type c, end of ty_legacy.


data : lt_legacy type standard table of ty_legacy, ls_legacy type ty_legacy. types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1. types : begin of ty_bdcdata. include structure bdcdata. types end of ty_bdcdata. data : lt_bdcdata type standard table of ty_bdcdata, ls_bdcdata type ty_bdcdata. CALL FUNCTION 'GUI_UPLOAD' EXPORTING

FILENAME FILETYPE
TABLES

= 'c:\customer.txt' = 'ASC' = lt_legacy[].

DATA_TAB

if lt_legacy[] is not initial. loop at lt_legacy into ls_legacy. split ls_legacy-str at ',' into ls_kna1-kunnr

ls_kna1-land1 ls_kna1-name1. append ls_kna1 to lt_kna1. endloop. endif.


* Create Session object CALL FUNCTION 'BDC_OPEN_GROUP' EXPORTING CLIENT = SY-MANDT GROUP = 'S1'

195 | P a g e

Santosh P

HOLDDATE

KEEP USER

= '20100330' "yyyymmss = 'X'

= sy-uname.

if lt_kna1[] is not initial. loop at lt_kna1 into ls_kna1. perform prginfo using 'Z9AMPROGRAM147_CALLTRANS' '0100'. perform fldinfo using 'KNA1-KUNNR' ls_kna1-kunnr. perform fldinfo using 'KNA1-LAND1' ls_kna1-land1. perform fldinfo using 'KNA1-NAME1' ls_kna1-name1. * map the bdcdata to session object CALL FUNCTION 'BDC_INSERT' EXPORTING TCODE = 'Z147' TABLES

DYNPROTAB endloop.

= lt_bdcdata[].

CALL FUNCTION 'BDC_CLOSE_GROUP'. endif.

form prginfo using prgname scrno. refresh lt_bdcdata. clear ls_bdcdata. ls_bdcdata-program = prgname. ls_bdcdata-dynpro = scrno. ls_bdcdata-dynbegin = 'X'. append ls_bdcdata to lt_bdcdata. endform. form fldinfo using fname fvalue. clear ls_bdcdata.

ls_bdcdata-fnam = fname. ls_bdcdata-fval = fvalue. append ls_bdcdata to lt_bdcdata. endform.

Z9AMPROGRAM147_CALLTRANS:

196 | P a g e

Santosh P

SCREEN 100:

197 | P a g e

Santosh P

FLOW LOGIC:
PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100. * PROCESS AFTER INPUT. MODULE USER_COMMAND_0100.

PBO:
* MODULE STATUS_0100.

PAI:
MODULE USER_COMMAND_0100 INPUT. case sy-ucomm. when 'P1'. insert kna1. if sy-subrc eq 0. message 'Inserted' type 'I'. else. message 'Not inserted' type 'I'. endif. leave program. when 'P2'. leave program. endcase. ENDMODULE. " USER_COMMAND_0100 INPUT

198 | P a g e

Santosh P

Z147TOP:
*&---------------------------------------------------------------------* *& Include Z147TOP Module Pool 7_CALLTRANS *& *&---------------------------------------------------------------------* PROGRAM Z9AMPROGRAM14

Z9AMPROGRAM147_CALLTRANS.

tables kna1.

OUTPUT:

199 | P a g e

Santosh P

Z9AMPROGRAM149: SHDB

200 | P a g e

Santosh P

201 | P a g e

Santosh P

202 | P a g e

Santosh P

203 | P a g e

Santosh P

204 | P a g e

Santosh P

SOURCE CODE:

report Z9AMPROGRAM149 no standard page heading line-size 255. include bdcrecx1. parameters: dataset(132) lower case. *** DO NOT CHANGE - the generated data section - DO NOT CHANGE * * If it is nessesary to change the data section use the rules: * 1.) Each definition of a field exists of two lines * 2.) The first line shows exactly the comment * '* data element: ' followed with the data element * which describes the field. * If you don't have a data element use the * comment without a data element name * 3.) The second line shows the fieldname of the * structure, the fieldname must consist of * a fieldname and optional the character '_' and * three numbers and the field length in brackets * 4.) Each field must be type C. * *** Generated data section with specific formatting - DO NOT CHANGE data: begin of record, * data element: KUNNR KUNNR_001(010),

***

***

205 | P a g e

Santosh P

* data element: LAND1_GP LAND1_002(003), * data element: NAME1_GP NAME1_003(035), end of record. *** End generated data section *** * Begin of custom changes types : begin of ty_legacy, str(100) type c, end of ty_legacy. data : lt_legacy type standard table of ty_legacy, ls_legacy type ty_legacy. types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1. * End of custom changes

start-of-selection.
* begin of custom changes CALL FUNCTION 'GUI_UPLOAD' EXPORTING

FILENAME FILETYPE
TABLES

= 'c:\cust.txt' = 'ASC' = lt_legacy[].

DATA_TAB

if lt_legacy[] is not initial. loop at lt_legacy into ls_legacy. split ls_legacy-str at ',' into ls_kna1-kunnr

ls_kna1-land1 ls_kna1-name1. append ls_kna1 to lt_kna1. endloop. endif. 206 | P a g e Santosh P

* end of custom changes *perform open_dataset using dataset. perform open_group. *do. *read dataset dataset into record. *if sy-subrc <> 0. exit. endif. loop at lt_kna1 into ls_kna1. perform bdc_dynpro using 'Z9AMPROGRAM147_CALLTRANS' '0100'. perform bdc_field using 'BDC_OKCODE' '=P1'. perform bdc_field using 'BDC_CURSOR' 'KNA1-NAME1'. perform bdc_field using 'KNA1-KUNNR' ls_kna1-kunnr. * record-KUNNR_001. perform bdc_field using 'KNA1-LAND1' ls_kna1-land1. * record-LAND1_002. perform bdc_field using 'KNA1-NAME1' ls_kna1-name1. * record-NAME1_003. perform bdc_transaction using 'Z147'. *enddo. endloop. perform close_group. *perform close_dataset using dataset.

Z9AMPROGRAM147_CALLTRANS:

207 | P a g e

Santosh P

SCREEN 100:

208 | P a g e

Santosh P

FLOW LOGIC:
PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100. * PROCESS AFTER INPUT. MODULE USER_COMMAND_0100.

PBO:
* MODULE STATUS_0100.

PAI:
MODULE USER_COMMAND_0100 INPUT. case sy-ucomm. when 'P1'. insert kna1. if sy-subrc eq 0. message 'Inserted' type 'I'. else. message 'Not inserted' type 'I'. endif. leave program. when 'P2'. leave program. endcase. ENDMODULE. " USER_COMMAND_0100 INPUT

209 | P a g e

Santosh P

Z147TOP:
*&---------------------------------------------------------------------* *& Include Z147TOP Module Pool 7_CALLTRANS *& *&---------------------------------------------------------------------* PROGRAM Z9AMPROGRAM14

Z9AMPROGRAM147_CALLTRANS.

tables kna1.

OUT PUT:

210 | P a g e

Santosh P

Z9AMPROGRAM150:

211 | P a g e

Santosh P

212 | P a g e

Santosh P

213 | P a g e

Santosh P

214 | P a g e

Santosh P

215 | P a g e

Santosh P

SOURCECODE:
report Z9AMPROGRAM150 no standard page heading line-size 255. include bdcrecx1.

216 | P a g e

Santosh P

parameters: dataset(132) lower case. *** DO NOT CHANGE - the generated data section - DO NOT CHANGE * * If it is nessesary to change the data section use the rules: * 1.) Each definition of a field exists of two lines * 2.) The first line shows exactly the comment * '* data element: ' followed with the data element * which describes the field. * If you don't have a data element use the * comment without a data element name * 3.) The second line shows the fieldname of the * structure, the fieldname must consist of * a fieldname and optional the character '_' and * three numbers and the field length in brackets * 4.) Each field must be type C. * *** Generated data section with specific formatting - DO NOT CHANGE data: begin of record, * data element: MATNR MATNR_001(018), * data element: MBRSH MBRSH_002(001), * data element: MTART MTART_003(004), * data element: XFELD KZSEL_01_004(001), * data element: MAKTX MAKTX_005(040), * data element: MEINS MEINS_006(003), end of record. *** End generated data section *** * BEGIN OF CHANGES types : begin of ty_legacy, str(200) type c, end of ty_legacy. data : lt_legacy type standard table of ty_legacy, ls_legacy type ty_legacy. types : begin of ty_material, matnr type mara-matnr, mbrsh type mara-mbrsh, mtart type mara-mtart, maktx type makt-maktx, meins type mara-meins, end of ty_material.

***

***

217 | P a g e

Santosh P

data : lt_material type standard table of ty_material, ls_material type ty_material. * END OF CHANGES start-of-selection. * begin of changes CALL FUNCTION 'GUI_UPLOAD' EXPORTING FILENAME = 'C:\material.txt' FILETYPE = 'ASC' TABLES DATA_TAB = lt_legacy[]. if lt_legacy[] is not initial. loop at lt_legacy into ls_legacy. split ls_legacy-str at ',' into ls_material-matnr ls_material-mbrsh ls_material-mtart ls_material-maktx ls_material-meins. append ls_material to lt_material. endloop. endif. * end of changes *perform open_dataset using dataset. perform open_group. *do. loop at lt_material into ls_material. *read dataset dataset into record. *if sy-subrc <> 0. exit. endif. perform bdc_dynpro using 'SAPLMGMM' '0060'. perform bdc_field using 'BDC_CURSOR' 'RMMG1-MTART'. perform bdc_field using 'BDC_OKCODE' '/00'. perform bdc_field using 'RMMG1-MATNR' ls_material-matnr. * record-MATNR_001. perform bdc_field using 'RMMG1-MBRSH' ls_material-mbrsh. * record-MBRSH_002. perform bdc_field using 'RMMG1-MTART' ls_material-mtart. * record-MTART_003.

218 | P a g e

Santosh P

perform bdc_dynpro perform bdc_field

using 'SAPLMGMM' '0070'. using 'BDC_CURSOR' 'MSICHTAUSW-DYTXT(01)'. perform bdc_field using 'BDC_OKCODE' '=ENTR'. perform bdc_field using 'MSICHTAUSW-KZSEL(01)' record-KZSEL_01_004. perform bdc_dynpro using 'SAPLMGMM' '4004'. perform bdc_field using 'BDC_OKCODE' '=BU'. perform bdc_field using 'MAKT-MAKTX' ls_material-maktx. * record-MAKTX_005. perform bdc_field using 'BDC_CURSOR' 'MARA-MEINS'. perform bdc_field using 'MARA-MEINS' ls_material-meins. * record-MEINS_006. perform bdc_transaction using 'MM01'. *enddo. endloop. perform close_group. *perform close_dataset using dataset.

Z9AMPROGRAM147_CALLTRANS:

219 | P a g e

Santosh P

SCREEN 100:

220 | P a g e

Santosh P

FLOW LOGIC:
PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100. * PROCESS AFTER INPUT. MODULE USER_COMMAND_0100.

PBO:
* MODULE STATUS_0100.

PAI:
MODULE USER_COMMAND_0100 INPUT. case sy-ucomm. when 'P1'. insert kna1. if sy-subrc eq 0. message 'Inserted' type 'I'. else. message 'Not inserted' type 'I'. endif. leave program. when 'P2'. leave program. endcase. ENDMODULE. " USER_COMMAND_0100 INPUT

221 | P a g e

Santosh P

Z147TOP:
*&---------------------------------------------------------------------* *& Include Z147TOP Module Pool 7_CALLTRANS *& *&---------------------------------------------------------------------* PROGRAM Z9AMPROGRAM14

Z9AMPROGRAM147_CALLTRANS.

tables kna1.

OUTPUT:

222 | P a g e

Santosh P

Z9AMPROGRAM151:

223 | P a g e

Santosh P

224 | P a g e

Santosh P

225 | P a g e

Santosh P

226 | P a g e

Santosh P

227 | P a g e

Santosh P

SOURCE CODE:
report Z9AMPROGRAM151 no standard page heading line-size 255. include bdcrecx1. parameters: dataset(132) lower case. *** DO NOT CHANGE - the generated data section - DO NOT CHANGE * * If it is nessesary to change the data section use the rules: * 1.) Each definition of a field exists of two lines * 2.) The first line shows exactly the comment * '* data element: ' followed with the data element * which describes the field. * If you don't have a data element use the * comment without a data element name * 3.) The second line shows the fieldname of the

***

228 | P a g e

Santosh P

* structure, the fieldname must consist of * a fieldname and optional the character '_' and * three numbers and the field length in brackets * 4.) Each field must be type C. * *** Generated data section with specific formatting - DO NOT CHANGE data: begin of record, * data element: KUN16 KUNNR_001(016), * data element: KTOKD KTOKD_002(032), * data element: NAME1_GP NAME1_003(035), * data element: SORTL SORTL_004(010), * data element: STRAS_GP STRAS_005(035), * data element: LAND1_GP LAND1_006(003), * data element: SPRAS SPRAS_007(002), * data element: BANKS BANKS_01_008(003), * data element: BANKS BANKS_02_009(003), * data element: BANKS BANKS_03_010(003), * data element: BANKK BANKL_01_011(015), * data element: BANKK BANKL_02_012(015), * data element: BANKK BANKL_03_013(015), * data element: BANKN BANKN_01_014(018), * data element: BANKN BANKN_02_015(018), * data element: BANKN BANKN_03_016(018), * data element: BANKA BANKA_017(060), end of record. *** End generated data section *** * Begin of custom changes types : begin of ty_legacy, str(200) type c, end of ty_legacy.

***

229 | P a g e

Santosh P

data : lt_legacy type standard table of ty_legacy, ls_legacy type ty_legacy. types : begin of ty_kna1, kunnr type kna1-kunnr, name1 type kna1-name1, sortl type kna1-sortl, stras type kna1-stras, land1 type kna1-land1, spras type kna1-spras, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1. types : begin of ty_knbk, kunnr type knbk-kunnr, banks type knbk-banks, bankl type knbk-bankl, bankn type knbk-bankn, end of ty_knbk. data : lt_knbk type standard table of ty_knbk, ls_knbk type ty_knbk. data lv_id(3) type c. DATA lv_rid(2) type n. data lv_fname type bdcdata-fnam. * End of custom changes

start-of-selection. * Begin of custom changes CALL FUNCTION 'GUI_UPLOAD' EXPORTING FILENAME = 'c:\bdc.txt' FILETYPE = 'ASC' TABLES DATA_TAB = lt_legacy[]. if lt_legacy[] is not initial. loop at lt_legacy into ls_legacy. lv_id = ls_legacy-str+0(3). if lv_id = 'KEY'. split ls_legacy-str at ','

230 | P a g e

Santosh P

into lv_id ls_kna1-kunnr ls_kna1-name1 ls_kna1-sortl ls_kna1-stras ls_kna1-land1 ls_kna1-spras. append ls_kna1 to lt_kna1. elseif lv_id = 'BNK'. split ls_legacy-str at ',' into lv_id ls_knbk-kunnr ls_knbk-banks ls_knbk-bankl ls_knbk-bankn. append ls_knbk to lt_knbk. endif. clear lv_id. endloop. endif. * end of custom changes *perform open_dataset using dataset. perform open_group. *do. loop at lt_kna1 into ls_kna1. *read dataset dataset into record. *if sy-subrc <> 0. exit. endif. perform bdc_dynpro using 'SAPMF02D' '0100'. perform bdc_field using 'BDC_CURSOR' 'RF02D-KUNNR'. perform bdc_field using 'BDC_OKCODE' '/00'. perform bdc_field using 'RF02D-KUNNR' ls_kna1-kunnr. * record-KUNNR_001. perform bdc_field using 'RF02D-KTOKD' '0004'. perform bdc_dynpro * perform bdc_dynpro perform bdc_field perform bdc_field using 'SAPMF02D' '7100'. record-KTOKD_002. using 'SAPMF02D' '0110'. using 'BDC_CURSOR' 'KNA1-SPRAS'. using 'BDC_OKCODE' '/00'.

231 | P a g e

Santosh P

perform * perform * perform * perform * perform * perform perform perform perform perform perform

bdc_field using 'KNA1-NAME1' ls_kna1-name1. record-NAME1_003. bdc_field using 'KNA1-SORTL' ls_kna1-sortl. record-SORTL_004. bdc_field using 'KNA1-STRAS' ls_kna1-stras. record-STRAS_005. bdc_field using 'KNA1-LAND1' ls_kna1-land1. record-LAND1_006. bdc_field using 'KNA1-SPRAS' ls_kna1-spras. record-SPRAS_007. bdc_dynpro using 'SAPMF02D' '0120'. bdc_field using 'BDC_CURSOR' 'KNA1-LIFNR'. bdc_field using 'BDC_OKCODE' '=VW'. bdc_dynpro using 'SAPMF02D' '0125'. bdc_field using 'BDC_CURSOR' 'KNA1-NIELS'. bdc_field using 'BDC_OKCODE' '=VW'. using 'SAPMF02D' '0130'. using 'BDC_CURSOR' 'RF02D-KUNNR'. using 'BDC_OKCODE' '=UPDA'.

perform bdc_dynpro perform bdc_field perform bdc_field

CLEAR LV_RID. loop at lt_knbk into ls_knbk where kunnr = ls_kna1-kunnr. lv_rid = lv_rid + 1. concatenate 'KNBK-BANKS(' lv_rid ')' into lv_fname. perform bdc_field using lv_fname ls_knbk-banks. * record-BANKS_01_008. clear lv_fname. concatenate 'KNBK-BANKL(' lv_rid ')' into lv_fname. perform bdc_field using lv_fname ls_knbk-bankl. * record-BANKS_02_009. clear lv_fname. concatenate 'KNBK-BANKN(' lv_rid ')' into lv_fname. perform bdc_field using lv_fname ls_knbk-bankn. * record-BANKS_03_010. endloop. perform bdc_dynpro using 'SAPLBANK' '0100'. perform bdc_field using 'BDC_CURSOR'

232 | P a g e

Santosh P

'BNKA-BANKA'. using 'BDC_OKCODE' '=ENTR'. perform bdc_field using 'BNKA-BANKA' record-BANKA_017. perform bdc_transaction using 'XD01'. perform bdc_field *enddo. endloop. perform close_group. *perform close_dataset using dataset.

OUTPUT:

Z9AMPROGRAM152: (DIRECT METHOD)


REPORT Z9AMPROGRAM152. types : begin of ty_legacy, str(200) type c, end of ty_legacy. data : lt_legacy type standard table of ty_legacy, ls_legacy type ty_legacy. types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1,

233 | P a g e

Santosh P

ls_kna1 type ty_kna1. types : begin of ty_bdcdata. include structure bdcdata. types end of ty_bdcdata. types : begin of ty_bdcmsgcoll. include structure bdcmsgcoll. types end of ty_bdcmsgcoll. data : lt_bdcmsgcoll type standard table of ty_bdcmsgcoll, ls_bdcmsgcoll type ty_bdcmsgcoll. data : lt_bdcdata type standard table of ty_bdcdata, ls_bdcdata type ty_bdcdata. data : dsn(100) type c value '\\200.200.200.20\c$\errors.txt'. data msg type string. CALL FUNCTION 'GUI_UPLOAD' EXPORTING FILENAME = 'c:\customer.txt' FILETYPE = 'ASC' TABLES DATA_TAB = lt_legacy[].

if lt_legacy[] is not initial. loop at lt_legacy into ls_legacy. split ls_legacy-str at ',' into ls_kna1-kunnr ls_kna1-land1 ls_kna1-name1. append ls_kna1 to lt_kna1. endloop. endif.

if lt_kna1[] is not initial. loop at lt_kna1 into ls_kna1. perform prginfo using 'Z9AMPROGRAM147_CALLTRANS' '0100'. perform fldinfo using 'KNA1-KUNNR' ls_kna1-kunnr. perform fldinfo using 'KNA1-LAND1' ls_kna1-land1. perform fldinfo using 'KNA1-NAME1' ls_kna1-name1. call transaction 'Z147' using lt_bdcdata messages into lt_bdcmsgcoll.

234 | P a g e

Santosh P

endloop. endif. if lt_bdcmsgcoll[] is not initial. CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING FILENAME = 'c:\errors.txt' FILETYPE = 'ASC' WRITE_FIELD_SEPARATOR = 'X' TABLES DATA_TAB = lt_bdcmsgcoll[]. * Download the internal table to application server *open dataset dsn for output in text mode * encoding default message msg. *if sy-subrc eq 0. * loop at lt_bdcmsgcoll into ls_bdcmsgcoll. * transfer ls_bdcmsgcoll to dsn. * endloop. *else. * write :/ msg. *endif. endif. form prginfo using prgname scrno. refresh lt_bdcdata. clear ls_bdcdata. ls_bdcdata-program = prgname. ls_bdcdata-dynpro = scrno. ls_bdcdata-dynbegin = 'X'. append ls_bdcdata to lt_bdcdata. endform. form fldinfo using fname fvalue. clear ls_bdcdata. ls_bdcdata-fnam = fname. ls_bdcdata-fval = fvalue. append ls_bdcdata to lt_bdcdata. endform.

Z9AMPROGRAM147_CALLTRANS:

235 | P a g e

Santosh P

SCREEN 100:

236 | P a g e

Santosh P

FLOW LOGIC:
PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100. * PROCESS AFTER INPUT. MODULE USER_COMMAND_0100.

PBO:
* MODULE STATUS_0100.

PAI:
MODULE USER_COMMAND_0100 INPUT. case sy-ucomm. when 'P1'. insert kna1. if sy-subrc eq 0. message 'Inserted' type 'I'. else. message 'Not inserted' type 'I'. endif. leave program. when 'P2'. leave program. endcase. ENDMODULE. " USER_COMMAND_0100 INPUT

237 | P a g e

Santosh P

Z147TOP:
*&---------------------------------------------------------------------* *& Include Z147TOP Module Pool 7_CALLTRANS *& *&---------------------------------------------------------------------* PROGRAM Z9AMPROGRAM14

Z9AMPROGRAM147_CALLTRANS.

tables kna1.

Z9AMPROGRAM153:(SCHEDULING REPORTS IN BACKGROUND)


REPORT Z9AMPROGRAM153 .

data : dsn(40) type c value '\\200.200.200.20\c$\customer.txt'. types : begin of ty_legacy, str(100) type c, end of ty_legacy. data : lt_legacy type standard table of ty_legacy, ls_legacy type ty_legacy. types : begin of ty_kna1. include structure kna1. types end of ty_kna1. data : lt_kna1 type standard table of ty_kna1,
238 | P a g e Santosh P

ls_kna1 type ty_kna1. data msg type string. open dataset dsn for input in text mode encoding default message msg. if sy-subrc eq 0. do. read dataset dsn into ls_legacy-str. if sy-subrc eq 0. append ls_legacy to lt_legacy. else. exit. endif. enddo. else. write :/ msg. endif. if lt_legacy[] is not initial. loop at lt_legacy into ls_legacy. split ls_legacy-str at ',' into ls_kna1-kunnr ls_kna1-land1 ls_kna1-name1. append ls_kna1 to lt_kna1. endloop. else. write :/ 'No data in legacy system file'. endif. if lt_kna1[] is not initial. modify kna1 from table lt_kna1. write :/ sy-dbcnt. endif.

239 | P a g e

Santosh P

Z9AMPROGRAM154:
REPORT Z9AMPROGRAM154. parameters : p_land1 type kna1-land1. types : begin of ty_kna1, kunnr type kna1-kunnr, land1 type kna1-land1, name1 type kna1-name1, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1. if p_land1 is not initial. select kunnr land1 name1 from kna1 into table lt_kna1 where land1 = p_land1. if sy-subrc eq 0. loop at lt_kna1 into ls_kna1. write :/ ls_kna1-kunnr, ls_kna1-land1, ls_kna1-name1. endloop. else. write :/ 'No data'. endif. endif.

OUTPUT:

240 | P a g e

Santosh P

Z9AMPROGRAM155:
*&---------------------------------------------------------------------* *& Report Z9AMPROGRAM155 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z9AMPROGRAM155.

if sy-uname eq 'SAPUSER'. message 'About to raise event' type 'I'. CALL FUNCTION 'BP_EVENT_RAISE' EXPORTING EVENTID = 'ZMYEVENT'. endif.

Z9AMPROGRAM156:
REPORT Z9AMPROGRAM156. parameters : p_jname type TBTCJOB-JOBNAME.

241 | P a g e

Santosh P

data : jcount type TBTCJOB-JOBCOUNT. CALL FUNCTION 'JOB_OPEN' EXPORTING JOBNAME = p_jname IMPORTING JOBCOUNT = jcount. CALL FUNCTION 'JOB_SUBMIT' EXPORTING AUTHCKNAM = sy-uname JOBCOUNT = jcount JOBNAME = p_jname REPORT = 'Z9AMPROGRAM154' VARIANT = 'VAR1'. CALL FUNCTION 'JOB_CLOSE' EXPORTING JOBCOUNT = JCOUNT JOBNAME = P_JNAME.

SAP SCRIPTS: SE71: ZFORM1_930:

242 | P a g e

Santosh P

243 | P a g e

Santosh P

244 | P a g e

Santosh P

245 | P a g e

Santosh P

246 | P a g e

Santosh P

WE NEED DRIVER PROGRAM TO EXECUTE THE SCRIPT.

Z9AMPROGRAM157:( ZFORM1_930)
REPORT Z9AMPROGRAM157.

CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZFORM1_930' LANGUAGE = 'EN'. CALL FUNCTION 'WRITE_FORM' EXPORTING WINDOW

= 'MAIN'.

OUTPUT: RUNTIME ERROR:

247 | P a g e

Santosh P

Z9AMPROGRAM158: ( ZFORM1_930)
REPORT Z9AMPROGRAM158. CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZFORM1_930' LANGUAGE = sy-langu. CALL FUNCTION 'WRITE_FORM' EXPORTING WINDOW CALL FUNCTION 'CLOSE_FORM'.

= 'MAIN'.

OUTPUT:

248 | P a g e

Santosh P

249 | P a g e

Santosh P

Z9AMPROGRAM159: ( ZFORM1_930)
REPORT Z9AMPROGRAM159.

CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZFORM1_930' LANGUAGE = SY-LANGU. CALL FUNCTION 'WRITE_FORM' EXPORTING WINDOW CALL FUNCTION 'CLOSE_FORM'.

= 'MAIN'.

OUTPUT:

250 | P a g e

Santosh P

ZFORM2_930:

251 | P a g e

Santosh P

252 | P a g e

Santosh P

253 | P a g e

Santosh P

254 | P a g e

Santosh P

Z9AMPROGRAM160:( ZFORM2_930)
*&---------------------------------------------------------------------* *& Report Z9AMPROGRAM157 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z9AMPROGRAM160.

CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZFORM2_930' LANGUAGE = SY-LANGU. CALL FUNCTION 'WRITE_FORM' EXPORTING WINDOW CALL FUNCTION 'CLOSE_FORM'.

= 'MAIN'.

OUTPUT:

255 | P a g e

Santosh P

Z9AMPROGRAM161: ( ZFORM1_930)
*&---------------------------------------------------------------------* *& Report Z9AMPROGRAM157 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z9AMPROGRAM161.

CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZFORM1_930' LANGUAGE = sy-langu. CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT WINDOW CALL FUNCTION 'CLOSE_FORM'.

= 'E1' = 'MAIN'.

OUTPUT:
256 | P a g e Santosh P

ZFORM3_930:

257 | P a g e

Santosh P

258 | P a g e

Santosh P

Z9AMPROGRAM162: ( ZFORM3_930)
*&---------------------------------------------------------------------* *& Report Z9AMPROGRAM157 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z9AMPROGRAM162.

CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZFORM3_930' LANGUAGE = sy-langu.

259 | P a g e

Santosh P

CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT WINDOW

= 'E2' = 'MAIN'.

CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT WINDOW CALL FUNCTION 'CLOSE_FORM'.

= 'E1' = 'MAIN'.

OUTPUT:

Z9AMPROGRAM163: ( ZFORM3_930)
REPORT Z9AMPROGRAM163. parameters : p_lang type t002-spras. CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZFORM3_930' LANGUAGE = p_lang.

260 | P a g e

Santosh P

CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT WINDOW CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT WINDOW CALL FUNCTION 'CLOSE_FORM'.

= 'E1' = 'MAIN'.

= 'E2' = 'MAIN'.

OUTPUT:

261 | P a g e

Santosh P

SE76:(SCRIPT FORM TRANSLATION)

262 | P a g e

Santosh P

ZFORM4_930:

263 | P a g e

Santosh P

264 | P a g e

Santosh P

265 | P a g e

Santosh P

266 | P a g e

Santosh P

267 | P a g e

Santosh P

Z9AMPROGRAM164: ZFORM4_930:
REPORT Z9AMPROGRAM164. CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZFORM4_930' LANGUAGE = SY-LANGU. CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT WINDOW CALL FUNCTION 'CLOSE_FORM'.

= 'E1' = 'MAIN'.

OUTPUT:

268 | P a g e

Santosh P

ZFORM5_930:

269 | P a g e

Santosh P

270 | P a g e

Santosh P

271 | P a g e

Santosh P

Z9AMPROGRAM165: ZFORM5_930:
REPORT Z9AMPROGRAM165.

parameters : customer(20) type c. CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZFORM5_930' LANGUAGE = SY-LANGU. CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT WINDOW CALL FUNCTION 'CLOSE_FORM'.

= 'E1' = 'MAIN'.

OUTPUT:

272 | P a g e

Santosh P

ZFORM6_930:

273 | P a g e

Santosh P

274 | P a g e

Santosh P

275 | P a g e

Santosh P

Z9AMPROGRAM166: ZFORM6_930:
REPORT Z9AMPROGRAM166. parameters : p_land1 type kna1-land1. types : begin of ty_kna1, kunnr type kna1-kunnr, name1 type kna1-name1, end of ty_kna1. data : lt_kna1 type standard table of ty_kna1, ls_kna1 type ty_kna1. select kunnr name1 from kna1 into table lt_kna1 where land1 = p_land1. if sy-subrc eq 0. CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZFORM6_930' LANGUAGE = SY-LANGU. * DEVICE = 'SCREEN'.

276 | P a g e

Santosh P

loop at lt_kna1 into ls_kna1. CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT WINDOW endloop. CALL FUNCTION 'CLOSE_FORM'. else. message 'No data' type 'I'. endif.

= 'E1' = 'MAIN'.

OUTPUT:

277 | P a g e

Santosh P

ZFORM8_930:

278 | P a g e

Santosh P

279 | P a g e

Santosh P

280 | P a g e

Santosh P

Z9AMPROGRAM167: ZFORM8_930:
REPORT Z9AMPROGRAM167. CALL FUNCTION 'OPEN_FORM'. CALL FUNCTION 'START_FORM' EXPORTING FORM = 'ZFORM7_930' LANGUAGE = SY-LANGU. CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT WINDOW CALL FUNCTION 'END_FORM'. CALL FUNCTION 'START_FORM' EXPORTING FORM = 'ZFORM8_930' LANGUAGE = SY-LANGU.

= 'E1' = 'MAIN'.

281 | P a g e

Santosh P

CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT WINDOW CALL FUNCTION 'END_FORM'. CALL FUNCTION 'CLOSE_FORM'.

= 'E1' = 'MAIN'.

SO10: CREATING STANDARD TEXT Z930TEXT:

282 | P a g e

Santosh P

ZFORM9_930:

283 | P a g e

Santosh P

Z9AMPROGRAM168: ZFORM9_930:
REPORT Z9AMPROGRAM168. CALL FUNCTION 'OPEN_FORM' EXPORTING FORM = 'ZFORM9_930' LANGUAGE = SY-LANGU. CALL FUNCTION 'WRITE_FORM' EXPORTING ELEMENT = 'E1' WINDOW = 'MAIN'. CALL FUNCTION 'CLOSE_FORM'.

OUTPUT:

PAGE1

PAGE2

284 | P a g e

Santosh P

SO10: CREATING STANDARD TEXT Z930TEXT:

Z9AMPROGRAM169: Z930TEXT:
285 | P a g e Santosh P

REPORT

Z9AMPROGRAM169.

TYPES : BEGIN OF TY_LINES. INCLUDE STRUCTURE TLINE. TYPES END OF TY_LINES. DATA : LT_LINES TYPE STANDARD TABLE OF TY_LINES, LS_LINES TYPE TY_LINES. DATA : LS_HEAD TYPE THEAD. CALL FUNCTION 'READ_TEXT' EXPORTING CLIENT = SY-MANDT ID = 'ST' LANGUAGE = SY-LANGU NAME = 'ZKOTAXT' OBJECT = 'TEXT' TABLES LINES = LT_LINES[]. IF LT_LINES[] IS NOT INITIAL. LOOP AT LT_LINES INTO LS_LINES. IF LS_LINES-TDLINE CS 'BALL'. replace all occurrences of 'BALL' in LS_LINES-TDLINE with 'IBM'. MODIFY LT_LINES FROM LS_LINES TRANSPORTING TDLINE. ENDIF. ENDLOOP. *prepare header LS_HEAD-TDOBJECT = 'TEXT'. LS_HEAD-TDNAME = 'ZKOTAXT'. LS_HEAD-TDID = 'ST'. LS_HEAD-TDSPRAS = SY-LANGU. CALL FUNCTION 'SAVE_TEXT' EXPORTING CLIENT = SY-MANDT HEADER = LS_HEAD * INSERT = ' ' TABLES LINES = LT_LINES[]. ENDIF. HEAR THE PROGRAM WILL BE EXICUTED AND CHANGES WILL BE MADE DIRECTLY IN STANDARD TEXT(ZKOTAXT)

SMART FORMS:
286 | P a g e Santosh P

Z9AMPROGRAM170:
*&---------------------------------------------------------------------* *& Report Z9AMPROGRAM170 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z9AMPROGRAM170.

CALL FUNCTION '/1BCDWB/SF00000400'.

Z9AMPROGRAM171:
*&---------------------------------------------------------------------* *& Report Z9AMPROGRAM171 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z9AMPROGRAM171.

data : lv_fname type RS38L_FNAM. CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING FORMNAME = 'ZSFORM1_930' IMPORTING FM_NAME = lv_fname. call function lv_fname.

Z9AMPROGRAM172:
*&---------------------------------------------------------------------* *& Report Z9AMPROGRAM172 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z9AMPROGRAM172.

287 | P a g e

Santosh P

parameters p_cname(20) type c. CALL FUNCTION '/1BCDWB/SF00000401' EXPORTING I_CNAME = p_cname.

Z9AMPROGRAM173:
*&---------------------------------------------------------------------* *& Report Z9AMPROGRAM173 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z9AMPROGRAM173.

parameters : p_cname(20) type c. data lv_fname type rs38l_fnam. CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING FORMNAME = 'ZSFORM2_930' IMPORTING FM_NAME = LV_FNAME. call function lv_fname exporting i_cname = p_cname.

Z9AMPROGRAM174:
*&---------------------------------------------------------------------* *& Report Z9AMPROGRAM174 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z9AMPROGRAM174.

parameters : p_land1 type kna1-land1.

288 | P a g e

Santosh P

types : begin of ty_kna1. include structure kna1. types end of ty_kna1. data : lt_kna1 type standard table of ty_kna1. data lv_fname type rs38l_fnam.

select kunnr land1 name1 from kna1 into corresponding fields of table lt_kna1 where land1 = p_land1. if sy-subrc eq 0. CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING FORMNAME = 'ZSFORM3_930' IMPORTING FM_NAME = lv_fname. call function lv_fname tables t_kna1 = lt_kna1[]. else. write :/ 'No data'. endif.

Z9AMPROGRAM175:
*&---------------------------------------------------------------------* *& Report Z9AMPROGRAM175 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z9AMPROGRAM175.

data : fname type rs38l_fnam. parameters : p_vbeln type vbrk-vbeln. types : begin of ty_kna1. include structure kna1. types end of ty_kna1. data : ls_kna1 type ty_kna1.

289 | P a g e

Santosh P

types : begin of ty_vbrk. include structure vbrk. types end of ty_vbrk. data : ls_vbrk type ty_vbrk. types : begin of ty_vbrp. include structure vbrp. types end of ty_vbrp. data : lt_vbrp type standard table of ty_vbrp. select single * from vbrk into ls_vbrk where vbeln = p_vbeln. if sy-subrc eq 0. select single * from kna1 into ls_kna1 where kunnr = ls_vbrk-kunag. if sy-subrc eq 0. select * from vbrp into table lt_vbrp where vbeln = ls_vbrk-vbeln. endif. endif. if lt_vbrp[] is not initial. CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING FORMNAME = 'ZSFORM10_930_INVOICE' IMPORTING FM_NAME = fname. if fname is not initial. call function fname exporting i_vbrk = ls_vbrk i_kna1 = ls_kna1 tables t_vbrp = lt_vbrp[]. endif. endif.

Z9AMPROGRAM176:
REPORT Z9AMPROGRAM176.

290 | P a g e

Santosh P

data fname type rs38l_fnam. parameters : p_date type sy-datum, p_rea type char255. data ls_ctrl type SSFCTRLOP. data : ls_out_info type SSFCRESCL. data : lt_otfdata type TSFOTF. data : lv_bin_filesize type i. data : lt_lines type table of TLINE. CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING FORMNAME = 'ZSFORM12_PDF' IMPORTING FM_NAME = fname.

clear ls_ctrl. ls_ctrl-NO_DIALOG = 'X'. ls_ctrl-PREVIEW = ' '. ls_ctrl-GETOTF = 'X'. call function fname exporting CONTROL_PARAMETERS = ls_ctrl compdate = p_date reason = p_rea importing JOB_OUTPUT_INFO = ls_out_info. lt_otfdata[] = ls_out_info-OTFDATA[]. CALL FUNCTION 'CONVERT_OTF' EXPORTING FORMAT MAX_LINEWIDTH IMPORTING BIN_FILESIZE TABLES OTF LINES write :/ 'hello'. CALL FUNCTION 'GUI_DOWNLOAD'

= 'PDF' = 132 = lv_bin_filesize = lt_otfdata[] = lt_lines[].

291 | P a g e

Santosh P

EXPORTING FILENAME FILETYPE TABLES DATA_TAB

= 'C:\SMART.PDF' = 'BIN' = lt_lines[].

Z9AMPROGRAM177:
*&---------------------------------------------------------------------* *& Report Z9AMPROGRAM177 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z9AMPROGRAM177.

data fname type rs38l_fnam. tables vbak. select-options : so_vbeln for vbak-vbeln. CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING FORMNAME = 'ZSFORM13_930' IMPORTING FM_NAME = fname. call function fname tables t_vbeln = so_vbeln.

Z9AMPROGRAM178:(select-options using sub-screens)


REPORT Z9AMPROGRAM178. tables vbak. selection-screen begin of screen 100 as subscreen. select-options : so_vbeln for vbak-vbeln. selection-screen end of screen 100. start-of-selection. call screen 200.

292 | P a g e

Santosh P

MODULE STATUS_0200 OUTPUT. SET PF-STATUS 'ABC'. ENDMODULE. " STATUS_0200 OUTPUT

MODULE USER_COMMAND_0200 INPUT. case sy-ucomm. when 'BACK'. leave program. endcase. ENDMODULE. " USER_COMMAND_0200

INPUT

Screen Painter: Layout:

Flow logic:
293 | P a g e Santosh P

PROCESS BEFORE OUTPUT. call subscreen sarea including sy-repid '100'. MODULE STATUS_0200. * PROCESS AFTER INPUT. MODULE USER_COMMAND_0200.

PBO:
MODULE STATUS_0200 OUTPUT. SET PF-STATUS 'ABC'. ENDMODULE. " STATUS_0200 OUTPUT

PAI:
MODULE USER_COMMAND_0200 INPUT. case sy-ucomm. when 'BACK'. leave program. endcase. ENDMODULE. " USER_COMMAND_0200

INPUT

294 | P a g e

Santosh P