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

display table in screen painter

Former Member
0 Likes
2,136

hello,

i have a screen with some drop dowm list boxes - proj_name, orig_name, proj_type...

their values are retrieved from a database table zdemo... the primary key of the table is proj_no..

what i want to do is, when i select any value from the list, like i select a proj_name from list box,

and press the display button, then i want all the proj_no's whose name is the value of the field

proj_name. i have defined proj_name as range and also retrieved the data to be displayed in an

internal table itab using select query, but how do i display the output on the screen...

plz help me out...

thank you..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,091

Hi

You could use a table control and display the data retrieved in the internal table into the table control.

Process Before Output.
module chkitab.
loop at itab with control tab1.
module display_data.
endloop.

Process After Input.
module load_itab.
loop at itab.
endloop.

Code:

module checkitab.
if v_flag ne 1.
   clear itab.
   refresh itab[].
endif.

module load_itab.
* load data from table into itab based on selection from list box.
v_flag = 1.  "set a flag after loading ur itab.

module display_data.
   move itab to dbtable.          "display the data in your table control

Declaration:

DATA: itab type table of dbtable.       "ur db table
CONTROLS tab1 type tableview using screen 1001.  "ur screen no

Here tab1 is the name of your table control. Ensure that the cols are the ones from your db table and use the db table name in display_data module.

Hope this helps

Regards,

Jayanthi.K

hello,

i have a screen with some drop dowm list boxes - proj_name, orig_name, proj_type...

their values are retrieved from a database table zdemo... the primary key of the table is proj_no..

what i want to do is, when i select any value from the list, like i select a proj_name from list box,

and press the display button, then i want all the proj_no's whose name is the value of the field

proj_name. i have defined proj_name as range and also retrieved the data to be displayed in an

internal table itab using select query, but how do i display the output on the screen...

plz help me out...

thank you..

2 REPLIES 2
Read only

Former Member
0 Likes
1,092

Hi

You could use a table control and display the data retrieved in the internal table into the table control.

Process Before Output.
module chkitab.
loop at itab with control tab1.
module display_data.
endloop.

Process After Input.
module load_itab.
loop at itab.
endloop.

Code:

module checkitab.
if v_flag ne 1.
   clear itab.
   refresh itab[].
endif.

module load_itab.
* load data from table into itab based on selection from list box.
v_flag = 1.  "set a flag after loading ur itab.

module display_data.
   move itab to dbtable.          "display the data in your table control

Declaration:

DATA: itab type table of dbtable.       "ur db table
CONTROLS tab1 type tableview using screen 1001.  "ur screen no

Here tab1 is the name of your table control. Ensure that the cols are the ones from your db table and use the db table name in display_data module.

Hope this helps

Regards,

Jayanthi.K

Read only

Former Member
0 Likes
1,091

Hi,

First design ur screen how u want. Then write the code in flow logic :

Flow logic:

PROCESS BEFORE OUTPUT.

LOOP AT ITAB WITH CONTROL TAB_CTRL CURSOR TAB_CTRL-CURRENT_LINE.

MODULE STATUS_0100.

ENDLOOP.

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0100.

LOOP AT ITAB.

ENDLOOP.

Then write the code in Abap editor.In attributes select type as Module pool.

TABLES: VBAK, VBAP.

DATA: OKCODE TYPE SY-UCOMM.

DATA: BEGIN OF ITAB OCCURS 0,

VBELN TYPE VBAP-VBELN,

POSNR TYPE VBAP-POSNR,

MATNR TYPE VBAP-MATNR,

MATKL TYPE VBAP-MATKL,

ARKTX TYPE VBAP-ARKTX,

END OF ITAB.

CONTROLS: TAB_CTRL TYPE TABLEVIEW USING SCREEN '100'.

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

CASE OKCODE.

WHEN 'DISP'.

SELECT VBELN

POSNR

MATNR

MATKL

ARKTX FROM VBAP INTO table ITAB

WHERE VBELN = VBAK-VBELN.

APPEND ITAB.

  • ENDSELECT.

WHEN 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

Regards,

sathish