CLEAR: TD_AUSP ,TD_AUSP[] .
SELECT
AUSP~ATINN
AUSP~ATWRT
INTO CORRESPONDING FIELDS OF TABLE TD_AUSP
FROM AUSP
WHERE AUSP~OBJEK = TH_MARA-CUOBF .
DATA L_ATWTB TYPE CAWNT-ATWTB .
DATA L_ATINN TYPE CAWN-ATINN .
DATA L_ATNAM TYPE CABN-ATNAM .
DATA L_ATBEZ TYPE CABNT-ATBEZ .
LOOP AT TD_AUSP INTO TH_AUSP .
CLEAR L_ATWTB .
CLEAR L_ATINN .
CLEAR L_ATNAM .
CLEAR L_ATBEZ .
SELECT SINGLE CABN~ATNAM CABNT~ATBEZ INTO (L_ATNAM, L_ATBEZ)
FROM CABN INNER JOIN CABNT ON ( CABN~ATINN = CABNT~ATINN AND CABN~ADZHL = CABNT~ADZHL )
WHERE CABN~ATINN = TH_AUSP-ATINN AND
CABNT~SPRAS = SY-LANGU .
SELECT SINGLE CAWNT~ATWTB CAWN~ATINN INTO (L_ATWTB , L_ATINN)
FROM CAWN INNER JOIN CAWNT ON ( CAWN~ATINN = CAWNT~ATINN AND CAWN~ATZHL = CAWNT~ATZHL )
WHERE CAWN~ATINN = TH_AUSP-ATINN AND
CAWN~ATWRT = TH_AUSP-ATWRT AND
CAWNT~SPRAS = SY-LANGU .
IF L_ATNAM+0(1) = 'C' .
TH_DATA-C_VALUE = TH_AUSP-ATWRT .
TH_DATA-C_VALUET = L_ATWTB .
TH_DATA-C_CHAR = L_ATNAM .
TH_DATA-C_CHART = L_ATBEZ .
ENDIF .
IF L_ATNAM+0(1) = 'S' .
TH_DATA-S_VALUE = TH_AUSP-ATWRT .
TH_DATA-S_VALUET = L_ATWTB .
TH_DATA-S_CHAR = L_ATNAM .
TH_DATA-S_CHART = L_ATBEZ .
ENDIF .
CLEAR TH_AUSP .
ENDLOOP .