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 do

Former Member
0 Kudos
131

HI Experts

I have a doubt, can we display the complex internal table (fields from many tables) in to table control. For example internal table as follows. if so how to do.

DATA : BEGIN OF itab OCCURS 0,

TDDAT LIKE VBEP-TDDAT,

DWERK LIKE AFPO-DWERK,

WEMNG LIKE AFPO-WEMNG,

PSMNG LIKE AFPO-PSMNG,

KUNNR LIKE VBAK-KUNNR,

PLNBEZ LIKE AFKO-PLNBEZ,

STLBEZ LIKE AFKO-STLBEZ,

END OF ITAB.

Thanks in advance.

Regards

Rajaram

4 REPLIES 4

Former Member
0 Kudos
75

well your itab is neither complex nor will a table control have any problems in displaying it.

complex itabs are containing other itabs or stuff like that.

another hint: try NOT to make use of headerlines, they are obsolete.

0 Kudos
75

Hi,

Create your table control using the Wizard option in the Screen painter Se51.

There you have an option to select Internal table from Program when constructing the Table control.

Regards,

Sesh

Former Member
0 Kudos
75

Hi raja ram,

use this code............

1.......

Data declaration...............

&----


& Include MZSAN_TABCTRLTOP Module poo

*& *

&----


PROGRAM SAPMZSAN_TABCTRL.

TABLES: ZSANPLAYER.

CONTROLS: TABCTRL TYPE TABLEVIEW USING SCREEN '0100'.

DATA: OK_CODE LIKE SY-UCOMM.

DATA: BEGIN OF ITAB OCCURS 0,

COL1(10),COL2(10),COL3(34),

END OF ITAB.

2----


PBO.......................

----


***INCLUDE MZSAN_TABCTRL_STATUS_0100O01 .

----


&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

DO 5 TIMES.

ITAB-COL1 = 'SANKET'.

ITAB-COL2 = 'SETHI'.

ITAB-COL3 = '120-A,NEW GANDHI NAGAR, GHAZIABAD'.

APPEND ITAB.

ENDDO.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module MODIFY_ITAB INPUT

&----


  • text FOR MODIFY THE VALUES IN TABLES FIELD

----


MODULE MODIFY_ITAB INPUT.

MODIFY ITAB FROM ITAB INDEX TABCTRL-CURRENT_LINE.

ENDMODULE. " MODIFY_ITAB INPUT

3----


Screen.................

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

LOOP AT ITAB WITH CONTROL TABCTRL.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP AT ITAB.

MODULE MODIFY_ITAB.

ENDLOOP.

MODULE USER_COMMAND_0100.

4----


PAI......................

----


***INCLUDE MZSAN_TABCTRL_STATUS_0100O01 .

----


&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

DO 5 TIMES.

ITAB-COL1 = 'SANKET'.

ITAB-COL2 = 'SETHI'.

ITAB-COL3 = '120-A,NEW GANDHI NAGAR, GHAZIABAD'.

APPEND ITAB.

ENDDO.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module MODIFY_ITAB INPUT

&----


  • text FOR MODIFY THE VALUES IN TABLES FIELD

----


MODULE MODIFY_ITAB INPUT.

MODIFY ITAB FROM ITAB INDEX TABCTRL-CURRENT_LINE.

ENDMODULE. " MODIFY_ITAB INPUT

Draw a table control in screen painter and give the name of the nodes of the controls header col1 like itab-col1 .... so on.

If useful reward me with points.

Thanks.

Sanket.

former_member200338
Active Contributor
0 Kudos
75

Hi Rajaram,

you can display the contents in table control.

pls check the following code..

Regards,

Niyaz

while creating the table control, declare ctrl elements as workarea-fieldname.

in your case, itab-tddat, itab-dwerk and so on...

since you have to select the field type manually, the best way is, while creating the table ctrl elements, instead of itab-tddat, give it as tddat and press enter. you will get a dialog box stating that whther you want to take the details from the dictionary. press yes for all the dialog box you get. then remove the check box from dictionary and give the ctrl element name as itab-tddat.

in PBO do the following.

loop at itab with control tc_material.

endloop.

in PAI, do the following

loop.

endloop.