понедельник, 4 марта 2013 г.

The row structure of the table is incorrect. Using range tables.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
*use a ranges table in this case.
 
FUNCTION Z_CHANGE_EBAKZ_FLAG.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  CHANGING
*"     VALUE(BANFTAB) TYPE  ZBANFN
*"----------------------------------------------------------------------
 
  data:lt_eban type table of eban.
  data:ls_eban type eban.
 
data: 
l_r_banfn type range of banfn,
l_wa_banfn like line of l_r_banfn,
l_wa_banftab like likne of BANFTAB.

loop at banftab into l_wa_banftab.
l_wa_banfn-sign = 'I'.
l_wa_banfn-option = 'EQ'.
l_wa_banfn-low = l_wa_banftab-banfn.
append l_wa_banfn to l_r_banfn.
clear l_wa_banfn.
endloop. 

  SELECT * FROM eban into table lt_eban 
  where 
  BANFN IN L_R_BANFN "BANFN IN BANFTAB 
AND EBAKZ EQ 'X'.
 
  IF SY-SUBRC IS INITIAL.
    LOOP AT lt_eban INTO ls_eban .
      ls_eban-EBAKZ = ' '.
      modify eban from ls_eban.
    ENDLOOP.
  ENDIF.
ENDFUNCTION.
 
or you can use FOR ALL ENTRIES :
 
FUNCTION Z_CHANGE_EBAKZ_FLAG.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  CHANGING
*"     VALUE(BANFTAB) TYPE  ZBANFN
*"----------------------------------------------------------------------
 
  data lt_eban type table of eban.
  data ls_eban type eban.
 
 
  SELECT * FROM eban into table lt_eban 
  FOR ALL ENTRIES IN BANFTAB "--> Add this
  where BANFN = BANFTAB-BANFN
  AND EBAKZ EQ 'X'.
 
  IF SY-SUBRC IS INITIAL.
    LOOP AT lt_eban INTO ls_eban .
      ls_eban-EBAKZ = ' '.
      modify eban from ls_eban.
    ENDLOOP.
  ENDIF.
ENDFUNCTION.

Комментариев нет:

Отправить комментарий