2007 May 15 7:56 AM
program name : Ykxjagrut.
parameters : p_dat like sy-datum, p_day type i.
source code : start" INITIALIZATION.
START-OF-SELECTION.
000 All comments are added.
001 code commented parameters.
Parameter for entering the date and parameter for no of days to enter both are mandatory *
PARAMETERS: ws_d_dat LIKE sy-datum OBLIGATORY, ws_i_day TYPE i OBLIGATORY.
*001 code ends.
002 code start (added).
PARAMETERS: p_dat TYPE sy-datum OBLIGATORY,
p_day TYPE i OBLIGATORY.
*002 code end.
Declaring the variables for date and no of days.
DATA: ws_d_ans LIKE sy-datum, w_c_rep LIKE dtresr-weekday.
The addition equation for adding the no of days to the given date.
003 code change of parameters name ws_d_dat as p_dat and ws_i_day as p_day.
ws_d_ans = p_dat + p_day.
003 end.
changing the color
FORMAT COLOR 3 INTENSIFIED INVERSE.
Displaying the Date which user enterd.
004 Code change of parameters name.
WRITE: 'Date Enterd:',20 p_dat. " code changed.
WRITE: /.
Displaying no of days user enterd.
WRITE: / 'No of Days to ADD', 20 p_day. " code changed
WRITE: /.
ULINE 20(20).
WRITE: /.
004 code end.
function for displaying the day of the result date.
CALL FUNCTION 'DATE_TO_DAY'
EXPORTING
date = ws_d_ans
IMPORTING
weekday = w_c_rep.
The result of the addition and the function.
WRITE: /19 '|'.
WRITE: 20 ws_d_ans,'|', w_c_rep,42 '|'.
WRITE: /.
ULINE 20(20).
AT SELECTION-SCREEN.
*005 Code added .
condition to check the sum if date exceed the calender limit it should display error message.
IF p_dat EQ '99991231' AND p_day > 0.
MESSAGE 'enter date less than this' TYPE 'E'.
ENDIF.
IF p_dat LT '09991231'.
MESSAGE 'enter date greater than this' TYPE 'E'.
ENDIF.
IF p_day GT '20000'.
MESSAGE 'The result is out of calender limits.'(001) TYPE 'E'.
ENDIF.
*005 code ended.
"end
above given is in txt file and i want store it into itab so please help me by field seperation and how to store file lines in different fields,
by help in "gui_upload"
Points awarded if right
2007 May 15 8:01 AM
2007 May 15 8:01 AM
2007 May 15 8:05 AM
Hi Jagrut,
declare a internal table as per data in ur flat file
Refer this code :
data : BEGIN OF I_TAB occurs 0,
EMP_ID(8),
NAME(10),
SURNAME(10),
PRACTICE(10),
MOB(11),
END OF T_TAB.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = V_FILE "file path
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X' "Field separator
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = I_TAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Rewrad points if helpful.
Regards,
Hemant
2007 May 15 8:28 AM
give me example of flat file which contain abap program and structure
2007 May 15 1:04 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |