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

Table Control

Former Member
0 Likes
397

Hi All.

Can anyone please tell me how can I update my z table using table controls.

My Z table will have 4 fields. My program will fetch & display 3 fields from std tables. The user will input the 4th field. How I can do this??

Regards

Sathar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
364

Hi,

Please check this sample code for table control.

SAVE_OK = OK_CODE.

CLEAR OK_CODE.

CASE SAVE_OK.

...

WHEN 'INSERT'.

READ TABLE TC-COLS INTO COL WITH KEY SCREEN-INPUT = '1'.

IF SY-SUBRC = 0.

LOOP AT I_BINLOC INTO ZMBINLOC WHERE ZMARK = 'X'.

CLEAR ZMBINLOC.

INSERT ZMBINLOC INTO I_BINLOC INDEX SY-TABIX.

ENDLOOP.

DESCRIBE TABLE I_BINLOC LINES TC-LINES.

ENDIF.

WHEN 'SAVE'.

SORT I_BINLOC ASCENDING BY WERKS LGORT ZBINLOC.

DELETE ADJACENT DUPLICATES FROM I_BINLOC.

IF NOT I_DELETE[] IS INITIAL.

DELETE ZMBINLOC FROM TABLE I_DELETE.

ENDIF.

MODIFY ZMBINLOC FROM TABLE I_BINLOC.

IF SY-SUBRC = 0.

MESSAGE S899(BD) WITH TEXT-002.

ENDIF.

WHEN OTHERS.

ENDCASE.

...

Also please demo program RSDEMO02.

check these links.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/abap-code-sam...

http://sap.niraj.tripod.com/id29.html

http://help.sap.com/saphelp_sm32/helpdata/en/9f/dbac9f35c111d1829f0000e829fbfe/frameset.htm

Regards

KUmar

3 REPLIES 3
Read only

learnsap
Active Participant
0 Likes
364

Hi,

Create an internal table with four fields and on the screen create table control with reference table from program and give the internal table name to it...

In the PBO of the screen update the internal table with the data fetched for the three fields from data base table and capture the input from the fourth field from user in PAI of the screen and update the data base.

Regards,

Ramesh

Read only

Former Member
0 Likes
364

Hi,

Refer to the folowing link:

http://www.esnips.com/doc/48bd95e8-facc-4932-b923-465ba59bad24/Table-Control.pdf

Hope this helps.

Reward if helpful.

Regards,

Sipra

Read only

Former Member
0 Likes
365

Hi,

Please check this sample code for table control.

SAVE_OK = OK_CODE.

CLEAR OK_CODE.

CASE SAVE_OK.

...

WHEN 'INSERT'.

READ TABLE TC-COLS INTO COL WITH KEY SCREEN-INPUT = '1'.

IF SY-SUBRC = 0.

LOOP AT I_BINLOC INTO ZMBINLOC WHERE ZMARK = 'X'.

CLEAR ZMBINLOC.

INSERT ZMBINLOC INTO I_BINLOC INDEX SY-TABIX.

ENDLOOP.

DESCRIBE TABLE I_BINLOC LINES TC-LINES.

ENDIF.

WHEN 'SAVE'.

SORT I_BINLOC ASCENDING BY WERKS LGORT ZBINLOC.

DELETE ADJACENT DUPLICATES FROM I_BINLOC.

IF NOT I_DELETE[] IS INITIAL.

DELETE ZMBINLOC FROM TABLE I_DELETE.

ENDIF.

MODIFY ZMBINLOC FROM TABLE I_BINLOC.

IF SY-SUBRC = 0.

MESSAGE S899(BD) WITH TEXT-002.

ENDIF.

WHEN OTHERS.

ENDCASE.

...

Also please demo program RSDEMO02.

check these links.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/abap-code-sam...

http://sap.niraj.tripod.com/id29.html

http://help.sap.com/saphelp_sm32/helpdata/en/9f/dbac9f35c111d1829f0000e829fbfe/frameset.htm

Regards

KUmar