Application Development 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: 

How to tranfer table Control Entries into an internal table.

Former Member
0 Kudos

Hi freinds

Plz tell me how can i transfter entries made in table control into an inertnal table.

so that I could save all entries of table control into database.

Regards

Rajesh

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

itab is an internal table with screen fields in the structure , ctl_itab is the control associated

CONTROLS: ctl_itab TYPE TABLEVIEW USING SCREEN 0210.

In the PBO

  LOOP AT itab
       WITH CONTROL ctl_itab
       CURSOR ctl_itab-current_line.
* ...
  ENDLOOP.

In the PAI

LOOP AT itab. " screen fields
* Check data
* ...
* Update internal table 
  MODIFY itab " program itab
    INDEX ctl_itab-current_line.
ENDLOOP.

Regards

7 REPLIES 7

andreas_mann3
Active Contributor
0 Kudos

hi,

try sample RSDEMO_TABLE_CONTROL

Message was edited by:

Andreas Mann

Former Member
0 Kudos

Hi,

U must have defined the structure of the table control from either the internal table in the program or database table from dictionary.

Just save this values into interal table with similar structure as that of table control and update the database table.

0 Kudos

how to save values into interal table with similar structure as that of table control. in PAI or PBO.

raymond_giuseppi
Active Contributor
0 Kudos

itab is an internal table with screen fields in the structure , ctl_itab is the control associated

CONTROLS: ctl_itab TYPE TABLEVIEW USING SCREEN 0210.

In the PBO

  LOOP AT itab
       WITH CONTROL ctl_itab
       CURSOR ctl_itab-current_line.
* ...
  ENDLOOP.

In the PAI

LOOP AT itab. " screen fields
* Check data
* ...
* Update internal table 
  MODIFY itab " program itab
    INDEX ctl_itab-current_line.
ENDLOOP.

Regards

0 Kudos

can you plz provide full sample code. your answer is coming to slotuion.

0 Kudos

Screen logic

PROCESS BEFORE OUTPUT.
* Statut 
  MODULE status_0210.
* drop down selections
  MODULE pbo_0210_posid.
* Attributes
  MODULE screen_0210.
* PBO FLOW LOGIC FOR TABLECONTROL 'TASK_210'
* MODULE TASK_210_CHANGE_TC_ATTR.
* MODULE TASK_210_CHANGE_COL_ATTR.
  LOOP AT   ctl_task
       WITH CONTROL task_210
       CURSOR task_210-current_line.

    MODULE task_210_attr.

    MODULE task_210_get_lines.
*   MODULE TASK_210_CHANGE_FIELD_ATTR
  ENDLOOP.

PROCESS AFTER INPUT.
* Exit 
  MODULE USER_COMMAND_0210 AT EXIT-COMMAND.
* action 
  MODULE time_210_user_command.
* MODULE TIME_210_CHANGE_TC_ATTR.
* MODULE TIME_210_CHANGE_COL_ATTR.
* PAI FLOW LOGIC FOR TABLECONTROL 'TASK_210'
  LOOP AT ctl_task.
* Check input
    CHAIN.
*   Control time
      FIELD  ctl_task-begzt MODULE task_210_begzt.
*     Order/op
      FIELD: ctl_task-raufnr, ctl_task-vornr
        MODULE task_210_aufnr_vornr.
*     Project
      FIELD  ctl_task-rproj
        MODULE task_210_posid.
*     global controls
      MODULE task_210_chain.
*   update table
      MODULE task_210_modify.
    ENDCHAIN.
*   Sélect lines
    FIELD  ctl_task-kz
      MODULE task_210_mark ON REQUEST.
  ENDLOOP.
* action  on control task
  MODULE task_210_user_command.
* whbne new record fill missing fields
  MODULE fields_210.
* MODULE TASK_210_CHANGE_TC_ATTR.
* MODULE TASK_210_CHANGE_COL_ATTR.
* Exit of following screen
  MODULE USER_COMMAND_0210.

PROCESS ON VALUE-REQUEST.
* Invite on oper, reduce selection
  FIELD ctl_task-vornr MODULE pai_0210_vornr_f4.

In main program

DATA:   ' ....
        ctl_task TYPE TABLE OF zzfsh_task WITH HEADER LINE,
* DECLARATION OF TABLECONTROL 'TASK_210' ITSELF
CONTROLS: task_210 TYPE TABLEVIEW USING SCREEN 0210.

In PAI modules

* INPUT MODULE FOR TABLECONTROL 'TASK_210': MODIFY TABLE
MODULE task_210_modify INPUT.
  IF ctl_task-raufnr IS INITIAL
  AND ctl_task-vornr IS INITIAL.
    CLEAR :ctl_task-raufpl,
           ctl_task-raplzl.
  ELSE.
    ctl_task-raufpl = afko-aufpl.
    ctl_task-raplzl = afvc-aplzl.
  ENDIF.
  MODIFY ctl_task
    INDEX task_210-current_line.
ENDMODULE.

Regards

0 Kudos

Thanx raymond,

problem solved

Regards

Rajesh