on 08-31-2017 12:07 PM
Hi Abap/BW Experts
I have following requirement and written code, but I am getting syntax while reading from Internal table with multiple conditions. Could any one correct me where I did mistake.
Requirement : I want to Flag if the Employee Trip date(0TV_DEPDATE) lies between or Equal to Employee Leave start date and Leave End date.
DSO1 that stores Employee Leave information (Table 1)
DSO2 that stores Employee expenses claimed with Trip start date
Syntax Error at below bold :
READ TABLE lt_empleave into ls_empleave WITH KEY
/BIC/ZEMPLOYEE = <SOURCE_FIELDS>-EMPLOYEE.
/BIC/Z_IBEGDA <= TV_DEPDATE.
/BIC/Z_IENDDA >= TV_DEPDATE
TYPES:BEGIN OF t_empleave,
/BIC/ZEMPLOYEE TYPE /BIC/OIZEMPLOYEE,
/BIC/Z_IBEGDA TYPE /BIC/OIZ_IBEGDA
/BIC/Z_IENDDA TYPE /BIC/OIZ_IENDDA,
END OF t_empleave.
DATA : lt_empleave TYPE STANDARD TABLE OF t_empleave.
DATA : ls_empleave type t_empleave.
*** To read only 3Years data
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = sy-datum
days = 0
months = 0
signum = '-'
years = 3
importing
calc_date = l_date.
*** Selecting data from DSO1 ( Employee Leave Dates)
SELECT /BIC/ZEMPLOYEE /BIC/Z_IBEGDA /BIC/Z_IENDDA FROM
/BIC/ADS01
INTO TABLE lt_empleave
FOR ALL ENTRIES IN SOURCE_PACKAGE WHERE
/BIC/ZEMPLOYEE EQ SOURCE_PACKAGE-EMPLOYEE
AND /BIC/Z_IBEGDA >= l_date.
SORT lt_empleave by /BIC/ZEMPLOYEE ASCENDING /BIC/Z_IBEGDA DESCENDING.
DELETE ADJACENT DUPLICATES FROM lt_empleave COMPARING /BIC/ZEMPLOYEE
/BIC/Z_IBEGDA.
LOOP at SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.
CLEAR ls_empleave.
READ TABLE lt_empleave into ls_empleave WITH KEY
/BIC/ZEMPLOYEE = <SOURCE_FIELDS>-EMPLOYEE.
/BIC/Z_IBEGDA <= TV_DEPDATE.
/BIC/Z_IENDDA >= TV_DEPDATE
IF SY-SUBRC = 0.
<SOURCE_FIELDS>-/BIC/Z_IFLAG = 'X'.
ENDIF.
ENDLOOP.
Best Regards
Sree
Hi Shreekanth,
the READ TABLE statement is wrong. You can not use comparison conditions with READ TABLE. Only the EQUAL condition is possible. As alternative you can use a LOOP statement and use an EXIT statement if you have found the correct data set.Regards
Frank Albaum
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shreekanth
Please try this
DATA: lt_empleave TYPE STANDARD TABLE OF t_empleave.
DATA: ls_empleave LIKE LINE OF lt_empleave.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.