Skip to Content
0
Former Member
Jun 04, 2007 at 07:13 AM

OTHER TABLE FIELD

16 Views

Hi all

i am compiling the below code am getting evrything fine but am not able to get the G/L account description from the table SKAT.The other firlds that am accessing from BSEG table are getting through.Please help

with regards

vijay

REPORT ZGLACCT4.

TYPE-POOLS:SLIS.

TABLES:SKB1,BSEG,SKAT.

DATA:x like SKAT-SAKNR.

DATA:IT_SKB1 TYPE STANDARD TABLE OF SKB1 WITH HEADER LINE.

*DATA:IT_BSEG TYPE STANDARD TABLE OF BSEG WITH HEADER LINE.

*DATA:IT_SKAT TYPE STANDARD TABLE OF SKAT WITH HEADER LINE.

DATA: FIELDCATALOG TYPE SLIS_T_fieldcat_alv with header line,

gd_tab_group type slis_t_sp_group_alv,

gd_layout type slis_layout_alv,

gd_repid like sy-repid.

DATA:BEGIN OF IT_BSEG OCCURS 0,

BUKRS like BSEG-BUKRS,

BELNR like BSEG-BELNR,

GJAHR like BSEG-GJAHR,

BUZEI LIKE BSEG-BUZEI,

SAKNR1 LIKE BSEG-SAKNR,

HKONT like BSEG-HKONT,

  • TXT50 like SKAT-TXT50,

  • MCOD1 LIKE SKAT-MCOD1,

END OF IT_BSEG.

DATA:BEGIN OF IT_SKAT OCCURS 0,

MCOD1 LIKE SKAT-MCOD1,

TXT50 LIKE SKAT-TXT50,

SAKNR LIKE SKAT-SAKNR,

END OF IT_SKAT.

DATA:BEGIN OF IT_FINAL OCCURS 0,

BUKRS like BSEG-BUKRS,

BELNR like BSEG-BELNR,

GJAHR like BSEG-GJAHR,

BUZEI LIKE BSEG-BUZEI,

HKONT like BSEG-HKONT,

  • MCOD1 like SKAT-MCOD1,

TXT50 LIKE SKAT-TXT50,

END OF IT_FINAL.

SELECTION-SCREEN:BEGIN OF BLOCK B1.

*PARAMETERS:CODE TYPE BSEG-BUKRS.

PARAMETERS:CODE TYPE SKB1-BUKRS.

SELECT-OPTIONS:ACCOUNT FOR SKB1-SAKNR.

*SELECT-OPTIONS:ACCOUNT FOR BSEG-HKONT.

SELECT-OPTIONS:YEAR FOR BSEG-GJAHR.

SELECTION-SCREEN:END OF BLOCK B1.

*DATA SAKNRA_1 LIKE LINE OF SAKNRA.

AT SELECTION-SCREEN ON CODE.

IF CODE IS INITIAL.

MESSAGE 'Please enter a value ' TYPE 'E'.

ENDIF.

AUTHORITY-CHECK OBJECT 'S_CODE'

ID 'BUKRS' FIELD CODE

ID 'ACTVT' FIELD '03'.

IF SY-SUBRC = 4.

MESSAGE 'No authorization for CODE' TYPE 'E'.

ENDIF.

AT SELECTION-SCREEN.

IF ACCOUNT is INITIAL.

MESSAGE 'Please enter values' TYPE 'W'.

ENDIF.

*ELSEIF sy-subrc eq 0.

START-OF-SELECTION.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = ACCOUNT

IMPORTING

OUTPUT = ACCOUNT.

SELECT BUKRS BELNR GJAHR BUZEI HKONT FROM BSEG

INTO TABLE IT_FINAL

WHERE HKONT NOT IN ACCOUNT AND BUKRS = CODE.

SELECT TXT50 FROM SKAT INTO TABLE

IT_SKAT WHERE SPRAS EQ 'EN' AND SAKNR EQ IT_BSEG-HKONT.

  • WHERE SAKNR EQ IT_BSEG-SAKNR .

*FOR ALL ENTRIES IN IT_BSEG

END-OF-SELECTION.

*WRITE:/ IT_SKAT-MCOD1.

LOOP AT IT_BSEG .

IF SY-SUBRC = 0.

READ TABLE IT_SKAT WITH KEY SAKNR = IT_BSEG-SAKNR1.

if sy-SUBRC = 0.

IT_FINAL-BUKRS = IT_BSEG-BUKRS.

IT_FINAL-BELNR = IT_BSEG-BELNR.

IT_FINAL-GJAHR = IT_BSEG-GJAHR.

IT_FINAL-BUZEI = IT_BSEG-BUZEI.

IT_FINAL-HKONT = IT_BSEG-HKONT.

  • IT_FINAL-TXT50 = IT_SKAT-TXT50.

endif.

endif.

ENDLOOP.

  • LOOP AT IT_SKAT.

  • IF SY-SUBRC = 0.

  • IT_SKAT-TXT50.

  • endif.

  • ENDLOOP.

perform build_fieldcatalog.

*perform build_layout.

perform display_alv_report.

*PERFORM top-of-page.

FORM build_fieldcatalog.

fieldcatalog-FIELDNAME = 'BUKRS'.

fieldcatalog-seltext_m = 'CODE '.

fieldcatalog-col_pos = 0.

fieldcatalog-outputlen = 6.

fieldcatalog-tabname = 'it_final'.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-FIELDNAME = 'BELNR'.

fieldcatalog-seltext_m = 'DOCUMENT NUMBER'.

fieldcatalog-tabname = 'it_final'.

fieldcatalog-col_pos = 1.

fieldcatalog-outputlen = 18.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-FIELDNAME = 'GJAHR'.

fieldcatalog-seltext_m = 'YEAR'.

fieldcatalog-tabname = 'it_final'.

fieldcatalog-col_pos = 2.

fieldcatalog-outputlen = 5.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-FIELDNAME = 'BUZEI'.

fieldcatalog-seltext_m = 'LINE ITEM'.

fieldcatalog-tabname = 'it_final'.

fieldcatalog-col_pos = 3.

fieldcatalog-outputlen = 9.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-FIELDNAME = 'HKONT'.

fieldcatalog-seltext_m = 'G/L ACCOUNT'.

fieldcatalog-tabname = 'IT_FINAL'.

fieldcatalog-col_pos = 4.

fieldcatalog-outputlen = 12.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

fieldcatalog-FIELDNAME = 'TXT50'.

fieldcatalog-seltext_m = 'G/L ACCOUNT DESCRIPTION'.

fieldcatalog-tabname = 'IT_skat'.

fieldcatalog-col_pos = 5.

fieldcatalog-outputlen = 50.

APPEND fieldcatalog TO fieldcatalog.

CLEAR fieldcatalog.

ENDFORM.

*form build_layout.

  • gd_layout-no_input = 'X'.

  • gd_layout-colwidth_optimize = 'X'.

  • gd_layout-totals_text = 'Totals'(500).

  • ENDFORM.

form display_alv_report.

gd_repid = sy-repid.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = gd_repid

i_callback_top_of_page = 'TOP-OF-PAGE'

is_layout = gd_layout

it_fieldcat = FIELDCATALOG[]

I_SAVE = 'X'

TABLES

t_outtab = it_final

EXCEPTIONS

program_error = 1

OTHERS = 2.

ENDFORM.