REPORT zmmr_post_account .
TABLES : t030a,t030w,t030r,t030b,t030.
DATA: g_first(1),
g_texth(20),
g_texts(20).
*Text:Chart of Accounts
PARAMETERS p_ktopl LIKE t030-ktopl DEFAULT 'CB00' OBLIGATORY.
*Text: Transaction Key
SELECT-OPTIONS: s_ktosl FOR t030a-ktosl.
*If set 'X',program will output all transaction key which configured Account.
*Text: Display No Account Transaction Key
PARAMETERS p_output AS CHECKBOX .
RANGES r_ktosl FOR t030a-ktosl.
REFRESH r_ktosl.
r_ktosl-sign = 'I'.
r_ktosl-option = 'EQ'.
SELECT * FROM t030a WHERE grupp = 'RMK'.
SELECT SINGLE * FROM t030w WHERE spras = sy-langu AND ktosl = t030a-ktosl.
g_first = 'X'.
SELECT * FROM t030 WHERE ktopl = p_ktopl AND ktosl = t030a-ktosl.
IF g_first = 'X'.
FORMAT COLOR COL_KEY INTENSIFIED OFF.
HIDE: t030a-ktosl.
WRITE:/(16) 'Transaction Key:',
29(6) t030a-ktosl,
41(30) t030w-ltext.
SELECT SINGLE * FROM t030r WHERE ktopl = p_ktopl AND ktosl = t030a-ktosl.
IF sy-subrc = 0 .
IF t030r-xkomo = 'X'.
ENDIF.
IF t030r-xbwmo = 'X'.
ENDIF.
IF t030r-xbkla = 'X'.
ENDIF.
IF t030r-xdiko = 'X'.
ENDIF.
ENDIF.
SELECT SINGLE * FROM t030b WHERE ktosl = t030a-ktosl.
IF sy-subrc = 0 .
FORMAT COLOR COL_BACKGROUND.
WRITE:/(10) ' '.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:10(16) 'Post Key:',
28(2) '|',
29(2) 'De',
62(1) '|',
63(2) 'Cr',
97(1) '|'.
CLEAR:g_texts,g_texth.
IF t030b-bschs NE space.
SELECT SINGLE ltext INTO (g_texts) FROM tbslt WHERE spras = sy-langu AND bschl = t030b-bschs.
ENDIF.
IF t030b-bschh NE space.
SELECT SINGLE ltext INTO (g_texth) FROM tbslt WHERE spras = sy-langu AND bschl = t030b-bschh.
ENDIF.
FORMAT COLOR COL_BACKGROUND.
WRITE:/(27) ' '.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:28(2) '|',
29(2) t030b-bschs,
41(20) g_texts,
62(1) '|',
63(2) t030b-bschh,
75(20) g_texth,
97(1) '|'.
ENDIF.
FORMAT COLOR COL_BACKGROUND.
WRITE:/(10) ' '.
FORMAT COLOR COL_KEY INTENSIFIED ON.
WRITE:10(16) 'Post Account:',
28(2) '|',
29(2) 'De',
41(20) 'Text',
62(1) '|',
63(2) 'Cr',
75(20) 'Text',
97(1) '|'.
g_first = space.
ENDIF.
CLEAR:g_texts,g_texth.
IF t030-konts NE space.
SELECT SINGLE txt20 INTO (g_texts) FROM skat WHERE spras = sy-langu AND ktopl = p_ktopl
AND saknr = t030-konts.
ENDIF.
IF t030-konts NE space.
SELECT SINGLE txt20 INTO (g_texth) FROM skat WHERE spras = sy-langu AND ktopl = p_ktopl
AND saknr = t030-konth.
ENDIF.
FORMAT COLOR COL_BACKGROUND.
WRITE:/(12) ' '.
FORMAT COLOR COL_KEY INTENSIFIED ON.
WRITE:12(4) t030-bwmod,'|',
18(3) t030-komok,'|',
23(4) t030-bklas ,
28(1) '|',
29(10) t030-konts,
41(20) g_texts,
62(1) '|'.
IF t030r-xdiko = 'X'.
WRITE:63(10) t030-konth,
75(20) g_texth.
ENDIF.
WRITE:97(1) '|'.
ENDSELECT.
IF sy-subrc NE 0.
r_ktosl-low = t030a-ktosl.
APPEND r_ktosl.
ENDIF.
ENDSELECT.
*Get No Used Transaction Key
IF ( r_ktosl IS NOT INITIAL ) AND p_output = 'X'.
FORMAT COLOR COL_NEGATIVE INTENSIFIED OFF.
WRITE:/(97) 'UnConfigure Transaction Key:'.
SELECT * FROM t030a WHERE grupp = 'RMK' AND ktosl IN r_ktosl.
FORMAT COLOR COL_KEY INTENSIFIED OFF.
WRITE:/(16) 'Transaction Key:',
29(6) t030a-ktosl,
41(30) t030w-ltext.
SELECT SINGLE * FROM t030b WHERE ktosl = t030a-ktosl.
IF sy-subrc = 0 .
FORMAT COLOR COL_BACKGROUND.
WRITE:/(10) ' '.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:10(16) 'Post Key:',
28(2) '|',
29(2) 'De',
62(1) '|',
63(2) 'Cr',
97(1) '|'.
CLEAR:g_texts,g_texth.
IF t030b-bschs NE space.
SELECT SINGLE ltext INTO (g_texts) FROM tbslt WHERE spras = sy-langu AND bschl = t030b-bschs.
ENDIF.
IF t030b-bschh NE space.
SELECT SINGLE ltext INTO (g_texth) FROM tbslt WHERE spras = sy-langu AND bschl = t030b-bschh.
ENDIF.
FORMAT COLOR COL_BACKGROUND.
WRITE:/(27) ' '.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:28(2) '|',
29(2) t030b-bschs,
41(20) g_texts,
62(1) '|',
63(2) t030b-bschh,
75(20) g_texth,
97(1) '|'.
ENDIF.
FORMAT COLOR COL_BACKGROUND.
WRITE:/(10) ' '.
FORMAT COLOR COL_KEY INTENSIFIED ON.
WRITE:10(16) 'Post Account:',
28(2) '|',
29(2) 'De',
41(20) 'Text',
62(1) '|',
63(2) 'Cr',
75(20) 'Text',
97(1) '|'.
ENDSELECT.
ENDIF.
AT LINE-SELECTION.
CALL TRANSACTION 'OBYC'.