Skip to Content
author's profile photo Former Member
Former Member

Prob in Table Control

Hi All,

As per the requirement, i have written the program using table control. But when i try to give input values in table control...after giving the input value when i press enter the value is disappearing..Pleae give some help on this.

Regards,

Sweeeeetha

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 08, 2005 at 05:44 AM

    Hi,

    Pls check whether in the PAI part of the flow logic, you are actually appending the table control fields to the internal table for the table control data.

    This should be done in a module written inside the loop. ..endloop. in PAI.

    Thanks & Regards,

    Renjith

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Renjith,

      Thanks for your reply...Please see my code below

      PROCESS BEFORE OUTPUT.

      *&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TC1'

      MODULE TC1_INIT.

      *&SPWIZARD: MODULE TC1_CHANGE_TC_ATTR.

      *&SPWIZARD: MODULE TC1_CHANGE_COL_ATTR.

      LOOP AT G_TC1_ITAB

      INTO G_TC1_WA

      WITH CONTROL TC1

      CURSOR TC1-CURRENT_LINE.

      *&SPWIZARD: MODULE TC1_CHANGE_FIELD_ATTR

      MODULE TC1_MOVE.

      MODULE TC1_GET_LINES.

      ENDLOOP.

      MODULE D20XX_INIT.

      • MODULE STATUS_0100.

      *

      PROCESS AFTER INPUT.

      *&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TC1'

      *BREAK POINT.

      LOOP AT G_TC1_ITAB.

      CHAIN.

      FIELD ZFG_SRNO-ZSRNO.

      MODULE TC1_MODIFY ON CHAIN-REQUEST.

      ENDCHAIN.

      ENDLOOP.

      MODULE TC1_USER_COMMAND.

      MODULE TC1_INIT OUTPUT.

      IF G_TC1_COPIED IS INITIAL.

      *&SPWIZARD: COPY DDIC-TABLE 'ZFG_SRNO'

      *&SPWIZARD: INTO INTERNAL TABLE 'g_TC1_itab'

      SELECT * FROM ZFG_SRNO

      INTO CORRESPONDING FIELDS

      OF TABLE G_TC1_ITAB.

      G_TC1_COPIED = 'X'.

      • REFRESH CONTROL 'TC1' FROM SCREEN '0100'.

      TC1-TOP_LINE = 1.

      ENDIF.

      ENDMODULE.

      *&SPWIZARD: OUTPUT MODULE FOR TC 'TC1'. DO NOT CHANGE THIS LINE!

      *&SPWIZARD: MOVE ITAB TO DYNPRO

      MODULE TC1_MOVE OUTPUT.

      MOVE-CORRESPONDING G_TC1_WA TO ZFG_SRNO.

      MOVE-CORRESPONDING G_TC1_ITAB TO ZFG_SRNO.

      ENDMODULE.

      *&SPWIZARD: OUTPUT MODULE FOR TC 'TC1'. DO NOT CHANGE THIS LINE!

      *&SPWIZARD: GET LINES OF TABLECONTROL

      MODULE TC1_GET_LINES OUTPUT.

      G_TC1_LINES = SY-LOOPC.

      ENDMODULE.

      *&SPWIZARD: INPUT MODULE FOR TC 'TC1'. DO NOT CHANGE THIS LINE!

      *&SPWIZARD: MODIFY TABLE

      MODULE TC1_MODIFY INPUT.

      MOVE-CORRESPONDING ZFG_SRNO TO G_TC1_ITAB.

      MODIFY G_TC1_ITAB INDEX TC1-CURRENT_LINE.

      G_TC1_COPIED = 'X'.

      REFRESH CONTROL 'TC1' FROM SCREEN '8001'.

      MOVE-CORRESPONDING ZFG_SRNO TO G_TC1_WA.

      MODIFY G_TC1_ITAB

      FROM G_TC1_WA

      INDEX TC1-CURRENT_LINE.

      G_TC1_COPIED = 'X'.

      ENDMODULE.

      *&SPWIZARD: INPUT MODULE FOR TC 'TC1'. DO NOT CHANGE THIS LINE!

      *&SPWIZARD: PROCESS USER COMMAND

      MODULE TC1_USER_COMMAND INPUT.

      OK_CODE = SY-UCOMM.

      PERFORM USER_OK_TC USING 'TC1'

      'G_TC1_ITAB'

      'FLAG'

      CHANGING OK_CODE.

      SY-UCOMM = OK_CODE.

      ENDMODULE.

      ----


      • INCLUDE TABLECONTROL_FORMS *

      ----


      &----


      *& Form USER_OK_TC *

      &----


      FORM USER_OK_TC USING P_TC_NAME TYPE DYNFNAM

      P_TABLE_NAME

      P_MARK_NAME

      CHANGING P_OK LIKE SY-UCOMM.

      &SPWIZARD: BEGIN OF LOCAL DATA----


      DATA: L_OK TYPE SY-UCOMM,

      L_OFFSET TYPE I.

      &SPWIZARD: END OF LOCAL DATA----


      *&SPWIZARD: Table control specific operations *

      *&SPWIZARD: evaluate TC name and operations *

      SEARCH P_OK FOR P_TC_NAME.

      IF SY-SUBRC <> 0.

      EXIT.

      ENDIF.

      L_OFFSET = STRLEN( P_TC_NAME ) + 1.

      L_OK = P_OK+L_OFFSET.

      *&SPWIZARD: execute general and TC specific operations *

      CASE L_OK.

      WHEN 'INSR'. "insert row

      PERFORM FCODE_INSERT_ROW USING P_TC_NAME

      P_TABLE_NAME.

      CLEAR P_OK.

      WHEN 'DELE'. "delete row

      PERFORM FCODE_DELETE_ROW USING P_TC_NAME

      P_TABLE_NAME

      P_MARK_NAME.

      CLEAR P_OK.

      WHEN 'P--' OR "top of list

      'P-' OR "previous page

      'P+' OR "next page

      'P++'. "bottom of list

      PERFORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME

      L_OK.

      CLEAR P_OK.

      • WHEN 'L--'. "total left

      • PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME.

      *

      • WHEN 'L-'. "column left

      • PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME.

      *

      • WHEN 'R+'. "column right

      • PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME.

      *

      • WHEN 'R++'. "total right

      • PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME.

      *

      WHEN 'MARK'. "mark all filled lines

      PERFORM FCODE_TC_MARK_LINES USING P_TC_NAME

      P_TABLE_NAME

      P_MARK_NAME .

      CLEAR P_OK.

      WHEN 'DMRK'. "demark all filled lines

      PERFORM FCODE_TC_DEMARK_LINES USING P_TC_NAME

      P_TABLE_NAME

      P_MARK_NAME .

      CLEAR P_OK.

      • WHEN 'SASCEND' OR

      • 'SDESCEND'. "sort column

      • PERFORM FCODE_SORT_TC USING P_TC_NAME

      • l_ok.

      ENDCASE.

      ENDFORM. " USER_OK_TC

      &----


      *& Form FCODE_INSERT_ROW *

      &----


      FORM fcode_insert_row

      USING P_TC_NAME TYPE DYNFNAM

      P_TABLE_NAME .

      &SPWIZARD: BEGIN OF LOCAL DATA----


      DATA L_LINES_NAME LIKE FELD-NAME.

      DATA L_SELLINE LIKE SY-STEPL.

      DATA L_LASTLINE TYPE I.

      DATA L_LINE TYPE I.

      DATA L_TABLE_NAME LIKE FELD-NAME.

      FIELD-SYMBOLS <TC> TYPE CXTAB_CONTROL.

      FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.

      FIELD-SYMBOLS <LINES> TYPE I.

      &SPWIZARD: END OF LOCAL DATA----


      ASSIGN (P_TC_NAME) TO <TC>.

      *&SPWIZARD: get the table, which belongs to the tc *

      CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body

      ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline

      *&SPWIZARD: get looplines of TableControl *

      CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_LINES_NAME.

      ASSIGN (L_LINES_NAME) TO <LINES>.

      *&SPWIZARD: get current line *

      GET CURSOR LINE L_SELLINE.

      IF SY-SUBRC <> 0. " append line to table

      L_SELLINE = <TC>-LINES + 1.

      *&SPWIZARD: set top line *

      IF L_SELLINE > <LINES>.

      <TC>-TOP_LINE = L_SELLINE - <LINES> + 1 .

      ELSE.

      <TC>-TOP_LINE = 1.

      ENDIF.

      ELSE. " insert line into table

      L_SELLINE = <TC>-TOP_LINE + L_SELLINE - 1.

      L_LASTLINE = <TC>-TOP_LINE + <LINES> - 1.

      ENDIF.

      *&SPWIZARD: set new cursor line *

      L_LINE = L_SELLINE - <TC>-TOP_LINE + 1.

      *&SPWIZARD: insert initial line *

      INSERT INITIAL LINE INTO <TABLE> INDEX L_SELLINE.

      <TC>-LINES = <TC>-LINES + 1.

      *&SPWIZARD: set cursor *

      SET CURSOR LINE L_LINE.

      ENDFORM. " FCODE_INSERT_ROW

      &----


      *& Form FCODE_DELETE_ROW *

      &----


      FORM fcode_delete_row

      USING P_TC_NAME TYPE DYNFNAM

      P_TABLE_NAME

      P_MARK_NAME .

      &SPWIZARD: BEGIN OF LOCAL DATA----


      DATA L_TABLE_NAME LIKE FELD-NAME.

      FIELD-SYMBOLS <TC> TYPE cxtab_control.

      FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.

      FIELD-SYMBOLS <WA>.

      FIELD-SYMBOLS <MARK_FIELD>.

      &SPWIZARD: END OF LOCAL DATA----


      ASSIGN (P_TC_NAME) TO <TC>.

      *&SPWIZARD: get the table, which belongs to the tc *

      CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body

      ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline

      *&SPWIZARD: delete marked lines *

      DESCRIBE TABLE <TABLE> LINES <TC>-LINES.

      LOOP AT <TABLE> ASSIGNING <WA>.

      *&SPWIZARD: access to the component 'FLAG' of the table header *

      ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.

      IF <MARK_FIELD> = 'X'.

      DELETE <TABLE> INDEX SYST-TABIX.

      IF SY-SUBRC = 0.

      <TC>-LINES = <TC>-LINES - 1.

      ENDIF.

      ENDIF.

      ENDLOOP.

      ENDFORM. " FCODE_DELETE_ROW

      &----


      *& Form COMPUTE_SCROLLING_IN_TC

      &----


      • text

      ----


      • -->P_TC_NAME name of tablecontrol

      • -->P_OK ok code

      ----


      FORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME

      P_OK.

      &SPWIZARD: BEGIN OF LOCAL DATA----


      DATA L_TC_NEW_TOP_LINE TYPE I.

      DATA L_TC_NAME LIKE FELD-NAME.

      DATA L_TC_LINES_NAME LIKE FELD-NAME.

      DATA L_TC_FIELD_NAME LIKE FELD-NAME.

      FIELD-SYMBOLS <TC> TYPE cxtab_control.

      FIELD-SYMBOLS <LINES> TYPE I.

      &SPWIZARD: END OF LOCAL DATA----


      ASSIGN (P_TC_NAME) TO <TC>.

      *&SPWIZARD: get looplines of TableControl *

      CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_TC_LINES_NAME.

      ASSIGN (L_TC_LINES_NAME) TO <LINES>.

      *&SPWIZARD: is no line filled? *

      IF <TC>-LINES = 0.

      *&SPWIZARD: yes, ... *

      L_TC_NEW_TOP_LINE = 1.

      ELSE.

      *&SPWIZARD: no, ... *

      CALL FUNCTION 'SCROLLING_IN_TABLE'

      EXPORTING

      ENTRY_ACT = <TC>-TOP_LINE

      ENTRY_FROM = 1

      ENTRY_TO = <TC>-LINES

      LAST_PAGE_FULL = 'X'

      LOOPS = <LINES>

      OK_CODE = P_OK

      OVERLAPPING = 'X'

      IMPORTING

      ENTRY_NEW = L_TC_NEW_TOP_LINE

      EXCEPTIONS

      • NO_ENTRY_OR_PAGE_ACT = 01

      • NO_ENTRY_TO = 02

      • NO_OK_CODE_OR_PAGE_GO = 03

      OTHERS = 0.

      ENDIF.

      *&SPWIZARD: get actual tc and column *

      GET CURSOR FIELD L_TC_FIELD_NAME

      AREA L_TC_NAME.

      IF SYST-SUBRC = 0.

      IF L_TC_NAME = P_TC_NAME.

      *&SPWIZARD: et actual column *

      SET CURSOR FIELD L_TC_FIELD_NAME LINE 1.

      ENDIF.

      ENDIF.

      *&SPWIZARD: set the new top line *

      <TC>-TOP_LINE = L_TC_NEW_TOP_LINE.

      ENDFORM. " COMPUTE_SCROLLING_IN_TC

      &----


      *& Form FCODE_TC_MARK_LINES

      &----


      • marks all TableControl lines

      ----


      • -->P_TC_NAME name of tablecontrol

      ----


      FORM FCODE_TC_MARK_LINES USING P_TC_NAME

      P_TABLE_NAME

      P_MARK_NAME.

      &SPWIZARD: EGIN OF LOCAL DATA----


      DATA L_TABLE_NAME LIKE FELD-NAME.

      FIELD-SYMBOLS <TC> TYPE cxtab_control.

      FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.

      FIELD-SYMBOLS <WA>.

      FIELD-SYMBOLS <MARK_FIELD>.

      &SPWIZARD: END OF LOCAL DATA----


      ASSIGN (P_TC_NAME) TO <TC>.

      *&SPWIZARD: get the table, which belongs to the tc *

      CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body

      ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline

      *&SPWIZARD: mark all filled lines *

      LOOP AT <TABLE> ASSIGNING <WA>.

      *&SPWIZARD: access to the component 'FLAG' of the table header *

      ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.

      <MARK_FIELD> = 'X'.

      ENDLOOP.

      ENDFORM. "fcode_tc_mark_lines

      &----


      *& Form FCODE_TC_DEMARK_LINES

      &----


      • demarks all TableControl lines

      ----


      • -->P_TC_NAME name of tablecontrol

      ----


      FORM FCODE_TC_DEMARK_LINES USING P_TC_NAME

      P_TABLE_NAME

      P_MARK_NAME .

      &SPWIZARD: BEGIN OF LOCAL DATA----


      DATA L_TABLE_NAME LIKE FELD-NAME.

      FIELD-SYMBOLS <TC> TYPE cxtab_control.

      FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.

      FIELD-SYMBOLS <WA>.

      FIELD-SYMBOLS <MARK_FIELD>.

      &SPWIZARD: END OF LOCAL DATA----


      ASSIGN (P_TC_NAME) TO <TC>.

      *&SPWIZARD: get the table, which belongs to the tc *

      CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body

      ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline

      *&SPWIZARD: demark all filled lines *

      LOOP AT <TABLE> ASSIGNING <WA>.

      *&SPWIZARD: access to the component 'FLAG' of the table header *

      ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.

      <MARK_FIELD> = SPACE.

      ENDLOOP.

      ENDFORM. "fcode_tc_mark_lines

      Please let me know your suggestion.

  • author's profile photo Former Member
    Former Member
    Posted on Oct 08, 2005 at 06:03 AM

    in PAI

    you must populate the internal table with values from the table control.

    Dont forget to give some check avoid duplicate entries in the internal table.

    Actually in the PBO you should populate this internal table to the table control.

    Regards

    Binoo

    NB:If found useful plz award points

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.