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
418

Hi all,

im working on dialouge programming im having the data in a internal table i need to display the data into table control as soon as the screen is displyed,how to do it,plz help with some code.im points are awarded.

4 REPLIES 4
Read only

venkata_ramisetti
Active Contributor
0 Likes
404

Hi,

The demo transaction BIBS contains examples for all module pool programs.

After entering transaction BIBS, go to menu path and you choose diffrent types of table control examples.

YOu need to write code in the PBO, if you want to display the details when screen is displayed.

Thanks,

Ramakrishna

Read only

Former Member
0 Likes
404

Hi Babita,

Here is the sample code for Table Control. Check the code written for PBO event in order to populate the table control:

----


  • INCLUDE ZTable_control_TOP

----


PROGRAM ZTable_control.

TABLES: SFLIGHT.

<....Other declarations....>

DATA: INT_FLIGHTS LIKE SFLIGHT OCCURS 1 WITH HEADER LINE.

DATA: LINE_COUNT TYPE I.

CONTROLS: FLIGHTS TYPE TABLEVIEW USING SCREEN 200.

----


  • Screen 200: Flow Logic

&----


  • PBO event

PROCESS BEFORE OUTPUT.

LOOP AT INT_FLIGHTS WITH CONTROL FLIGHTS

CURSOR FLIGHTS-CURRENT_LINE.

MODULE DISPLAY_FLIGHTS.

ENDLOOP.

  • PAI event

PROCESS AFTER INPUT.

LOOP AT INT_FLIGHTS.

MODULE SET_LINE_COUNT.

ENDLOOP.

MODULE USER_COMMAND_0200.

&----


*& Module DISPLAY_FLIGHTS OUTPUT

&----


MODULE DISPLAY_FLIGHTS OUTPUT.

SFLIGHT-FLDATE = INT_FLIGHTS-FLDATE.

SFLIGHT-PRICE = INT_FLIGHTS-PRICE.

SFLIGHT-CURRENCY = INT_FLIGHTS-CURRENCY.

SFLIGHT-PLANETYPE = INT_FLIGHTS-PLANETYPE.

SFLIGHT-SEATSMAX = INT_FLIGHTS-SEATSMAX.

SFLIGHT-SEATSOCC = INT_FLIGHTS-SEATSOCC.

ENDMODULE.

&----


*& Module SET_LINE_COUNT INPUT

&----


MODULE SET_LINE_COUNT INPUT.

LINE-COUNT = SY-LOOPC.

ENDMODULE

&----


*& Module USER_COMMAND_0200 INPUT

&----


MODULE USER_COMMAND_0200 INPUT.

CASE OK_CODE.

WHEN 'CANC'...

WHEN 'EXIT'...

WHEN 'BACK'...

WHEN 'NEW'...

WHEN 'P--'.

CLEAR OK_CODE.

PERFORM PAGING USING 'P--'.

WHEN 'P-'.

CLEAR OK_CODE.

PERFORM PAGING USING 'P-'.

WHEN 'P+'.

CLEAR OK_CODE.

PERFORM PAGING USING 'P+'.

WHEN 'P++'.

CLEAR OK_CODE.

PERFORM PAGING USING 'P++'.

ENDCASE.

ENDMODULE.

&----


*& Form PAGING

&----


FORM PAGING USING CODE.

DATA: I TYPE I,

J TYPE I.

CASE Sy-UCOMM.

WHEN 'P--'.

FLIGHTS-TOP_LINE = 1.

WHEN 'P-'.

FLIGHTS-TOP_LINE = FLIGHTS-TOP_LINE - LINE_COUNT.

IF FLIGHTS-TOP_LINE LE 0.

FLIGHTS-TOP_LINE = 1. ENDIF.

WHEN 'P+'.

I = FLIGHTS-TOP_LINE + LINE_COUNT.

J = FLIGHTS-LINES - LINE_COUNT + 1.

IF J LE 0.

J = 1.

ENDIF.

IF I LE J.

FLIGHTS-TOP_LINE = I.

ELSE.

FLIGHTS-TOP_LINE = J.

ENDIF.

WHEN 'P++'.

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

IF FLIGHTS-TOP_LINE LE 0.

FLIGHTS-TOP_LINE = 1.

ENDIF.

ENDCASE.

ENDFORM.

Hope it helps.

Regards,

Neeraj

Read only

abdul_hakim
Active Contributor
0 Likes
404

Hi,

This is quite simple.

Go thru the transaction ABAPDOCU.

There are lots of examples available for almost all the topics.

Regards,

Abdul Hakim

Read only

0 Likes
404

All you need to do is put a module in the PBO of the screen.

Then in the ABAP code, you can do something like this.

MODULE GET_DATA.

if itab[] is initial.

select * into table itab from ztable.

endif.

refresh control itabcon from screen '0100'.

ENDMODULE.

Regards,

Rich Heilman