개발과 운영의 Table 이름이 틀려서
아래와 같이 조건문을 주어 INNER JOIN에 넣으면
Wrong Expression "LEFT" IN FROM Clause. WHERE condition
이라는 Syntax error가 나옵니다.
어떻게 해결해야 하는지 좀 알려 주세요~
DATA : l_tabname1 type tabname.
IF sy-sysid = 'BWD'.
l_tabname1 = '/1FB/MD___2S00B5'.
ELSE.
l_tabname1 = '/1FB/MD___2S00CZ'.
ENDIF.
* 자본변동표 계정을 모두 구한다.
SELECT
a~/1fb/cs_item " 계정코드
b~txtlg " 계정명
INTO TABLE lt_es
FROM (l_tabname1) "/1FB/MD___2S00B5 AS a
LEFT JOIN /bi0/tcs_item AS b
ON b~cs_chart = a~/1fb/cs_chart
AND b~cs_item = a~/1fb/cs_item
AND b~langu = sy-langu
WHERE a~/1fb/cs_chart EQ gs_parameter-cs_chart
AND a~ittype EQ c_ittype_es
.
l_tabname1 <- 요거를 255자리로 바꾸시고
IF SY-SYSID = 'BWD'.
L_TABNAME1 = '/1FB/MD___2S00B5 AS A LEFT JOIN /bi0/tcs_item AS b' .
ELSE.
L_TABNAME1 = '/1FB/MD___2S00CZ AS A LEFT JOIN /bi0/tcs_item AS b'.
ENDIF.
CONCATENATE L_TABNAME1 'ON b~cs_chart = a~/1fb/cs_chart'
INTO L_TABNAME1 SEPARATED BY SPACE.
CONCATENATE L_TABNAME1 'AND b~cs_item = a~/1fb/cs_item'
INTO L_TABNAME1 SEPARATED BY SPACE.
CONCATENATE L_TABNAME1 'AND b~langu = sy-langu'
INTO L_TABNAME1 SEPARATED BY SPACE.
CONCATENATE L_TABNAME1 'ON b~cs_chart = a~/1fb/cs_chart'
INTO L_TABNAME1 SEPARATED BY SPACE.
SELECT A~/1FB/CS_ITEM " 계정코드
B~TXTLG " 계정명
INTO TABLE LT_ES
FROM (L_TABNAME1)
WHERE A~/1FB/CS_CHART EQ GS_PARAMETER-CS_CHART
AND A~ITTYPE EQ C_ITTYPE_ES
이렇게 해보세요~