2008 Mar 26 12:15 PM
hi this is ravi
please help me how to code for the folling
Create a work area with the following fields
o EMPNO
o EMPNA
o EMPID
o EMPDA (Joining Date)
o EMPSA (Salary)
1. Initialize the EMPDA to 30/01/2008 and EMPSA to 1000
2. Populate 10 records in a ?DO LOOP?
3. Everytime you fill up the record increment the Month and
Year by one for the field EMPDA and EMPSA by 1000
4. Output the record
2008 Mar 26 12:47 PM
Hi,
Use the following code,
data : begin of empl,
empna(40),
empid(10),
empda like sy-datum,
empsa(13) type p decimals 2,
end of empl.
empl-empna = 'name1'.
empl-empid = '1000'.
empl-empda = '20080130'.
empl-empsa = '1000'.
do 10 times.
if not ( sy-index > 10 ).
write : /1 empl-empna, 20 empl-empid, 30 empl-empda,
42 empl-empsa.
else.
exit.
endif.
empl-empda4(2) = empl-empda4(2) + 1.
empl-empda0(4) = empl-empda0(4) + 1.
empl-empsa = empl-empsa + 1000.
enddo.
Regards,
Sankar.
hi this is ravi
please help me how to code for the folling
Create a work area with the following fields
o EMPNO
o EMPNA
o EMPID
o EMPDA (Joining Date)
o EMPSA (Salary)
1. Initialize the EMPDA to 30/01/2008 and EMPSA to 1000
2. Populate 10 records in a ?DO LOOP?
3. Everytime you fill up the record increment the Month and
Year by one for the field EMPDA and EMPSA by 1000
4. Output the record
2008 Mar 26 12:33 PM
here you go
DATA:
BEGIN OF wa,
empno TYPE i,
empna(20) TYPE c,
empid TYPE i,
empda TYPE d,
empsa TYPE i,
END OF wa.
START-OF-SELECTION.
wa-empno = 1.
wa-empna = 'My Name'.
wa-empid = 1.
wa-empda = '20080130'.
wa-empsa = 1000.
DO 10 TIMES.
WRITE:/ wa-empno,
wa-empna,
wa-empid,
wa-empda,
wa-empsa.
wa-empsa = wa-empsa + 1000.
CALL FUNCTION 'ADD_TIME_TO_DATE'
EXPORTING
i_idate = wa-empda
i_time = '13.0'
i_iprkz = '2'
* I_RDMHD =
IMPORTING
O_IDATE = wa-empda
* EXCEPTIONS
* INVALID_PERIOD = 1
* INVALID_ROUND_UP_RULE = 2
* INTERNAL_ERROR = 3
* OTHERS = 4
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Here's the output
1 My Name 1 01302008 1,000
1 My Name 1 02282009 2,000
1 My Name 1 03282010 3,000
1 My Name 1 04282011 4,000
1 My Name 1 05282012 5,000
1 My Name 1 06282013 6,000
1 My Name 1 07282014 7,000
1 My Name 1 08282015 8,000
1 My Name 1 09282016 9,000
1 My Name 1 10282017 10,000
2008 Mar 26 12:38 PM
This was your homework, was it Ravi? Rather than expecting to be given the answer, you should have tried to do it first, and posted your efforts. That way, you might have learned something.
"Give a man a fish and he eats for a day, teach him how to fish, and he eats for the rest of his life".
2008 Mar 26 12:47 PM
Hi,
Use the following code,
data : begin of empl,
empna(40),
empid(10),
empda like sy-datum,
empsa(13) type p decimals 2,
end of empl.
empl-empna = 'name1'.
empl-empid = '1000'.
empl-empda = '20080130'.
empl-empsa = '1000'.
do 10 times.
if not ( sy-index > 10 ).
write : /1 empl-empna, 20 empl-empid, 30 empl-empda,
42 empl-empsa.
else.
exit.
endif.
empl-empda4(2) = empl-empda4(2) + 1.
empl-empda0(4) = empl-empda0(4) + 1.
empl-empsa = empl-empsa + 1000.
enddo.
Regards,
Sankar.