Skip to Content
0
Former Member
Feb 03, 2005 at 01:44 PM

Table Control Sort doesnt work , plz check my code

40 Views

Hello

Flag is defined thr in TCL1 attribute list(checked) w/selColumn & value is FLAG ,also defined as char in prog

But syntax error is "No component exist with the name FLAg "

Plz correct me .

REPORT ZSD_REP_ORDER_BANK_CHANGE NO STANDARD PAGE HEADING LINE-SIZE 255.

TABLES: VBAK,VBAP,VBRK,ZSD_TABL_ORDBANK,MARA,KONV.

CONTROLS: TCL1 TYPE TABLEVIEW USING SCREEN 0200.

DATA: ITAB LIKE ZSD_TABL_ORDBANK OCCURS 0 WITH HEADER LINE,

WA_ITAB LIKE ZSD_TABL_ORDBANK,

OK_CODE LIKE SY-UCOMM,

SAVE_OK_CODE LIKE SY-UCOMM,

ANSWER TYPE C,

I LIKE SY-LOOPC ,

J LIKE SY-LOOPC,

V_LINES LIKE SY-LOOPC,

LINE_COUNT LIKE SY-LOOPC,

STS TYPE N,

FLAG,

EMGRP LIKE MARA-EXTWG,

QTY LIKE ZSD_TABL_ORDBANK-QTY,

UPRICE LIKE ZSD_TABL_ORDBANK-UPRICE,

TOT LIKE ZSD_TABL_ORDBANK-TOT,

INO LIKE VBAP-POSNR.

FIELD-SYMBOLS:

<FS_ITAB> LIKE LINE OF ITAB,

<FS_TCL1> LIKE LINE OF TCL1-COLS.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.

SELECT-OPTIONS: S_CCODE FOR ZSD_TABL_ORDBANK-CCODE

NO INTERVALS NO-EXTENSION OBLIGATORY,

S_SORG FOR ZSD_TABL_ORDBANK-SORG

NO INTERVALS NO-EXTENSION OBLIGATORY,

S_DCHAN FOR ZSD_TABL_ORDBANK-DISTCHAN,

S_DIV FOR ZSD_TABL_ORDBANK-DIV,

S_MATNO FOR ZSD_TABL_ORDBANK-MATNO,

S_CUSTNO FOR ZSD_TABL_ORDBANK-CUSTNO ,

S_QTNO FOR ZSD_TABL_ORDBANK-QTNO,

S_QTDAT FOR ZSD_TABL_ORDBANK-QTDAT,

S_QTVDAT FOR ZSD_TABL_ORDBANK-QTVALDAT,

S_SONO FOR ZSD_TABL_ORDBANK-SONO.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN.

SELECT * FROM ZSD_TABL_ORDBANK

INTO TABLE ITAB

WHERE CCODE IN S_CCODE

AND SORG IN S_SORG

AND DISTCHAN IN S_DCHAN

AND DIV IN S_DIV

AND MATNO IN S_MATNO

AND CUSTNO IN S_CUSTNO

AND QTNO IN S_QTNO

AND QTDAT IN S_QTDAT

AND QTVALDAT IN S_QTVDAT

AND SONO IN S_SONO .

IF SY-SUBRC EQ 0.

REFRESH ITAB.

CALL SCREEN 0200.

ELSE.

MESSAGE E012(ZQOTBANK) .

ENDIF.

&----


*& Module SET_STATUS OUTPUT

&----


  • text

----


MODULE SET_STATUS OUTPUT.

SET PF-STATUS '0200'.

SET TITLEBAR '0200'.

SELECT * FROM ZSD_TABL_ORDBANK

INTO TABLE ITAB

WHERE CCODE IN S_CCODE

AND SORG IN S_SORG

AND DISTCHAN IN S_DCHAN

AND DIV IN S_DIV

AND MATNO IN S_MATNO

AND CUSTNO IN S_CUSTNO

AND QTNO IN S_QTNO

AND QTDAT IN S_QTDAT

AND QTVALDAT IN S_QTVDAT

AND SONO IN S_SONO .

IF SY-SUBRC EQ 0.

DESCRIBE TABLE ITAB LINES V_LINES.

TCL1-LINES = V_LINES.

ENDIF.

LOOP AT ITAB.

QTY = ITAB-QTY.

UPRICE = ITAB-UPRICE.

TOT = QTY * UPRICE .

ITAB-TOT = TOT .

CLEAR: QTY, UPRICE, TOT.

QTY = ITAB-CGL_QTY.

UPRICE = ITAB-CGL_UPRICE.

TOT = QTY * UPRICE .

ITAB-CGL_TOT = TOT .

CLEAR: QTY, UPRICE, TOT.

QTY = ITAB-BHEL_QTY.

UPRICE = ITAB-BHEL_UPRICE.

TOT = QTY * UPRICE .

ITAB-BHEL_TOT = TOT .

CLEAR: QTY, UPRICE, TOT.

QTY = ITAB-ALSTOM_QTY.

UPRICE = ITAB-ALSTOM_UPRICE.

TOT = QTY * UPRICE .

ITAB-ALSTOM_TOT = TOT .

CLEAR: QTY, UPRICE, TOT.

QTY = ITAB-SIEMENS_QTY.

UPRICE = ITAB-SIEMENS_UPRICE.

TOT = QTY * UPRICE .

ITAB-SIEMENS_TOT = TOT .

CLEAR: QTY, UPRICE, TOT.

QTY = ITAB-TELK_QTY.

UPRICE = ITAB-TELK_UPRICE.

TOT = QTY * UPRICE .

ITAB-TELK_TOT = TOT .

CLEAR: QTY, UPRICE, TOT.

QTY = ITAB-OTH_QTY.

UPRICE = ITAB-OTH_UPRICE.

TOT = QTY * UPRICE .

ITAB-OTH_TOT = TOT .

CLEAR: QTY, UPRICE, TOT.

MODIFY ITAB.

ENDLOOP.

ENDMODULE. " SET_STATUS OUTPUT

&----


*& Module SET_LINE_COUNT INPUT

&----


  • text

----


MODULE SET_LINE_COUNT OUTPUT.

LINE_COUNT = SY-LOOPC.

ENDMODULE. " SET_LINE_COUNT INPUT

&----


*& Module SCROLL INPUT

&----


  • text

----


MODULE SCROLL_SORT INPUT.

SAVE_OK_CODE = OK_CODE.

CLEAR OK_CODE.

CASE SAVE_OK_CODE.

WHEN 'P--'.

TCL1-TOP_LINE = 1.

WHEN 'P-'.

TCL1-TOP_LINE = TCL1-TOP_LINE - LINE_COUNT.

IF TCL1-TOP_LINE LE 0.

TCL1-TOP_LINE = 1.

ENDIF.

WHEN 'P+'.

I = TCL1-TOP_LINE + LINE_COUNT.

J = TCL1-LINES - LINE_COUNT + 1.

IF J LE 0.

J = 1.

ENDIF.

IF I LE J.

TCL1-TOP_LINE = I.

ELSE.

TCL1-TOP_LINE = J.

ENDIF.

WHEN 'P++'.

TCL1-TOP_LINE = TCL1-LINES - LINE_COUNT + 1.

IF TCL1-TOP_LINE LE 0.

TCL1-TOP_LINE = 1.

ENDIF.

WHEN 'SORTUP'.

READ TABLE TCL1-COLS ASSIGNING <FS_TCL1> WITH KEY FLAG = 'X'.

IF SY-SUBRC = 0.

SORT ITAB ASCENDING BY (<FS_TCL1>-screen-name+5).

ENDIF.

WHEN 'SORTDN'.

READ TABLE TCL1-COLS ASSIGNING <FS_TCL1> WITH KEY FLAG = 'X'.

IF SY-SUBRC = 0.

SORT ITAB DESCENDING BY (<FS_TCL1>-screen-name+5).

ENDIF.

ENDCASE.

ENDMODULE. " USER_COMMAND INPUT

&----


*& Module UPDATE_MOD INPUT

&----


  • text

----


MODULE UPDATE_MOD INPUT.

CASE OK_CODE.

WHEN 'SAVE'.

UPDATE ZSD_TABL_ORDBANK FROM ITAB .

STS = SY-SUBRC .

IF STS NE 0.

MESSAGE E003(ZQOTBANK) .

ENDIF.

ENDCASE.

ENDMODULE. " UPDATE_MOD INPUT

&----


*& Module EXIT_COMAND INPUT

&----


  • text

----


MODULE EXIT_COMAND INPUT.

CASE OK_CODE.

WHEN 'BACK'.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

TITLEBAR = 'Order Bank Entry'

TEXT_QUESTION = 'Do you want to Go BacK ?'

TEXT_BUTTON_1 = 'Yes'

TEXT_BUTTON_2 = 'No'

DEFAULT_BUTTON = '2'

IMPORTING

ANSWER = ANSWER.

IF ANSWER = '1'.

LEAVE TO SCREEN 0.

ELSE.

ENDIF.

WHEN '%EX'.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

TITLEBAR = 'Order Bank Entry'

TEXT_QUESTION = 'Do you want to Exit ?'

TEXT_BUTTON_1 = 'Yes'

TEXT_BUTTON_2 = 'No'

DEFAULT_BUTTON = '2'

IMPORTING

ANSWER = ANSWER.

IF ANSWER = '1'.

LEAVE TO SCREEN 0.

ELSE.

ENDIF.

ENDCASE.

ENDMODULE. " EXIT_COMAND INPUT

Tnx advance