Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Clearing a Table control

Former Member
0 Likes
1,775

Hi

Can anyone tell me how to clear the table control.

I have cleared the internal table .

But it is not getting cleared.

Cheers

Christina

1 ACCEPTED SOLUTION
Read only

former_member195383
Active Contributor
0 Likes
1,735

hi..

if u are getting data to the table controll from the internal table ....then the table controll will reflect the contents of the internal table only....if after clearing in PAI u are again filling it in PBO. then same data will come..check for that....

use REFRESH : itab[]. in PBO..that will clear the tablecontroll..

9 REPLIES 9
Read only

GauthamV
Active Contributor
0 Likes
1,735

hi,

check program RSDEMO02. (rsdemo zero 2)

Read only

former_member195383
Active Contributor
0 Likes
1,736

hi..

if u are getting data to the table controll from the internal table ....then the table controll will reflect the contents of the internal table only....if after clearing in PAI u are again filling it in PBO. then same data will come..check for that....

use REFRESH : itab[]. in PBO..that will clear the tablecontroll..

Read only

Former Member
0 Likes
1,735

Hi ,

check weather that table control fields taken from

Program or Dictionary.

it shold be taken from Program.

clear and Refresh the internal table.

Award if usefull.

-Prabhu

Read only

0 Likes
1,735

Hi

No i tried a lot using clear and refreshing the internal table.But i could not clear the table control.

It is been overwritten..

Can u pls help me in this.

Cheers

Christina

Read only

0 Likes
1,735

HI..

In the PBO go to the last module..get in to that module...just before the endmodule..write the statement

refresh : itab[].

in the PAI also go to the last module..get in to that module...just before the endmodule..write the above statement.

the abv will definitely clear the table controll if itab is the table which u are using in Table control.

Read only

0 Likes
1,735

Hi

Sorry i tried..but it is not working.

Actually my reuirement is based on the selection, values must change in table control.

So for first selection for eg 'A', if there r 4 line items it should display 4 line items in the table control.

Now if i change the selection say for ex 'B' whcih has only one line item, it should dispaly only one item in the table control.

Since Table is not cleared , it is displaying all the four items.

Cheers

Christina

Read only

Former Member
0 Likes
1,735

Hi Chri,

You need to pass or update the empty values to table control then you can clear the table control screen.

may be it will work check it once... if field I down like this ....

Reward Points if useful

Raghunath.S

9986076729

Read only

0 Likes
1,735

Hi

No i tried a lot using ur method.But i could not clear the table control.

It is been overwritten..

Can u pls help me in this.

Cheers

Christina

Read only

Former Member
0 Likes
1,735

REPORT ZFI_CF_PLANING

NO STANDARD PAGE HEADING

MESSAGE-ID Z00.

&----


*& TABLE DECLARATIONS

&----


TABLES: ZFI_CF_PLANING,ZFI_CF_TABMAIN.

&----


*& DATA DECLARATIONS

&----


DATA: PAYDATE TYPE ZFI_CF_PLANING-CALDATE.

data : t_cvalue type zfi_cf_planing-cvalue,

t_cperiod type zfi_cf_planing-cperiod,

t_cyear type zfi_cf_planing-calyear,

*RES, "To Store Response Code of Dialog Box

V_MODE(4), "To Store sy-ucomm

V_buper TYPE T009B-POPER,

v_gjahr TYPE T009B-BDATJ,

V_Dbuper TYPE T009B-POPER,

v_Dgjahr TYPE T009B-BDATJ,

V_QTY_VALUE TYPE ZFI_CF_PLANING-INVALUE,

V_RAT_VALUE TYPE ZFI_CF_PLANING-INVALUE,

V_TOT_VALUE TYPE ZFI_CF_PLANING-INVALUE,

V_MAT_CONS TYPE ZFI_CF_PLANING-INVALUE,

V_CHECK TYPE ZFI_CF_PLANING-INVALUE,

V_code TYPE ZFI_CF_PLANING-code,

R_buper TYPE T009B-POPER,

R_gjahr TYPE T009B-BDATJ,

V_ACCNO TYPE ZFI_CF_TABMAIN-ACCNO,

V_ACCNO1 TYPE ZFI_CF_TABMAIN-ACCNO,

PDATUM TYPE D.

*--Table Control Declaration

CONTROLS MAIN TYPE TABLEVIEW USING SCREEN 100.

&----


*& INTERNAL TABLE DECLARATIONS

&----


data : it_final type standard table of ZFI_CF_PLANING initial size 0

with header line.

*data : it_final2 type standard table of ZFI_CF_PLANING initial size 0

*with header line.

DATA : IT_CHECK LIKE ZFI_CF_PLANING OCCURS 1 WITH HEADER LINE.

&----


*& START-OF-SELECTION

&----


START-OF-SELECTION.

SELECT *

INTO CORRESPONDING FIELDS OF TABLE IT_FINAL

FROM mara

up to 100 rows.

*--Calling the Screen

CALL SCREEN 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • Setting the Toolbar and Titlebar

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'MENU'.

SET TITLEBAR 'TITLE'.

IF V_MODE = 'COPY'.

SELECT *

FROM ZFI_CF_PLANING

INTO TABLE IT_FINAL

where pyear = V_GJAHR

and pperiod = V_BUPER

and accno = zfi_cf_PLANING-accno.

SORT IT_FINAL BY BUOM DESCENDING.

DATA : V_DES TYPE ZFI_CF_TABMAIN-DESCRIP2.

SELECT SINGLE

DESCRIP2

FROM ZFI_CF_TABMAIN

INTO V_DES

WHERE CODE = 'EXSALE'

AND ACCNO = ZFI_CF_planing-ACCNO

or CODE = 'LSALE'.

IF SY-SUBRC = 0.

ZFI_CF_TABMAIN-DESCRIP2 = V_DES.

endif.

ENDIF.

IF V_MODE = 'CLEA'.

REFRESH IT_FINAL.

CLEAR : V_MODE.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • Moving the modified records into other internal table

  • and displaying the those in ALV POPUP GRID

----


MODULE USER_COMMAND_0100 INPUT.

*BREAK-POINT.

CASE SY-UCOMM.

WHEN 'EXIT' or 'CANC' OR 'BACK'.

LEAVE PROGRAM.

WHEN 'COPY'.

V_MODE = SY-UCOMM.

V_ACCNO1 = ZFI_CF_PLANING-ACCNO.

V_Dbuper = ZFI_CF_PLANING-PPERIOD.

v_Dgjahr = ZFI_CF_PLANING-PYEAR.

CLEAR SY-UCOMM.

WHEN 'PROC'.

V_MODE = SY-UCOMM.

V_ACCNO1 = ZFI_CF_PLANING-ACCNO.

V_Dbuper = ZFI_CF_PLANING-PPERIOD.

v_Dgjahr = ZFI_CF_PLANING-PYEAR.

CLEAR SY-UCOMM.

WHEN 'CLEA'.

V_MODE = SY-UCOMM.

CLEAR SY-UCOMM.

ENDCASE.

*

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module SAVE_REC INPUT

&----


  • Modifiying the current record of table control

----


MODULE SAVE_REC INPUT.

MOVE-CORRESPONDING ZFI_CF_PLANING TO IT_FINAL.

MODIFY IT_FINAL INDEX MAIN-CURRENT_LINE.

IF SY-SUBRC <> 0.

APPEND IT_FINAL.

ENDIF.

IF V_MODE = 'PROC'.

IF ZFI_CF_PLANING-CODE <> '' .

data : v_code1 type ZFI_CF_tabmain-code.

SELECT SINgLE CODE

FROM ZFI_CF_CATMAster

INTO V_CODE1

WHERE CODE = ZFI_CF_PLANING-CODE.

IF SY-SUBRC <> 0.

MESSAGE I001(YMSG) WITH 'Invalid code'.

ENDIF.

ENDIF.

ENDIF.

ENDMODULE. " SAVE_REC INPUT

&----


*& Module DISPLAY OUTPUT

&----


  • text

----


module DISPLAY output.

MOVE-CORRESPONDING IT_FINAL TO ZFI_CF_PLANING.

endmodule. " DISPLAY OUTPUT

&----


*& Module COPY OUTPUT

&----


  • text

----


module COPY output.

CLEAR IT_FINAL.

READ TABLE IT_FINAL INDEX 1.

MOVE-CORRESPONDING IT_FINAL TO ZFI_CF_PLANING.

IF V_MODE = 'PROC'.

ZFI_CF_PLANING-ACCNO = V_ACCNO1.

ZFI_CF_PLANING-PPERIOD = V_DBUPER.

ZFI_CF_PLANING-PYEAR = V_DGJAHR.

SELECT SINGLE DESCRIP2

FROM ZFI_CF_TABMAIN

INTO ZFI_CF_TABMAIN-DESCRIP2

WHERE ACCNO = ZFI_CF_PLANING-ACCNO.

CLEAR : V_MODE.

ENDIF.

IF V_MODE = 'COPY'.

ZFI_CF_PLANING-ACCNO = V_ACCNO1.

ZFI_CF_PLANING-PPERIOD = V_DBUPER.

ZFI_CF_PLANING-PYEAR = V_DGJAHR.

CLEAR : V_MODE.

ENDIF.

endmodule. " COPY OUTPUT

-


flow logic code in screen level

*PROCESS BEFORE OUTPUT.

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

LOOP AT IT_FINAL WITH CONTROL MAIN CURSOR MAIN-TOP_LINE.

MODULE DISPLAY.

ENDLOOP.

MODULE COPY.

*PROCESS AFTER INPUT.

PROCESS AFTER INPUT.

MODULE QUIT AT EXIT-COMMAND.

FIELD ZFI_CF_planing-ACCNO MODULE VALIDATE_ACCNO.

FIELD ZFI_CF_PLANING-PYEAR MODULE VALIDATE_PYEAR.

FIELD ZFI_CF_PLANING-PPERIOD MODULE VALIDATE_PPERIOD.

MODULE USER_COMMAND_0100.

LOOP AT IT_FINAL.

MODULE SAVE_REC.

ENDLOOP.

MODULE CALCULATE.

*MODULE CHANGE_SCREEN2.