cancel
Showing results for 
Search instead for 
Did you mean: 

BW Transformations Start Routine -Reading Internal Table-Multiple condition

former_member228877
Participant
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

frank_albaum
Discoverer

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

ashu33
Participant
0 Kudos

Hi Shreekanth

Please try this

DATA: lt_empleave TYPE STANDARD TABLE OF t_empleave.
DATA: ls_empleave LIKE LINE OF lt_empleave.
former_member228877
Participant
0 Kudos

Hi Ashu Yadav,

Thanks for your reply, It is not working. I am getting below error.

Regards

Sree

ashu33
Participant
0 Kudos

Starting from Line 297 to 302

IF ls_empleave-/BIC/Z_IBEGDA <= TV_DEPDATE AND

ls_empleave-/BIC/Z_IENDDA >= TV_DEPDATE.

<SOURCE_FIELDS>-/BIC/Z_IFLAG = 'X'.

ENDIF.