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 problem

Former Member
0 Likes
723

Hi,

Underlying is my code for populating the table control :

CONTROLS: TABLE_CONT TYPE TABLEVIEW USING SCREEN 100.

TABLES : SFLIGHT.

DATA: IT_SFLIGHT TYPE STANDARD

TABLE OF SFLIGHT INITIAL SIZE 0,

WA_SFLIGHT TYPE SFLIGHT.

****************************************************

MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'PF'.

SET TITLEBAR 'Pranshu Table Control'.

ENDMODULE. " STATUS_0100 OUTPUT

****************************************************

MODULE DATA_RETRIEVAL OUTPUT.

SELECT * UP TO 10 ROWS FROM SFLIGHT INTO CORRESPONDING FIELDS OF TABLE IT_SFLIGHT.

ENDMODULE. " data_retrieval OUTPUT

****************************************************

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

MODULE DATA_RETRIEVAL.

loop at it_sflight into wa_sflight with control TABLE_CONT cursor TABLE_CONT-top_line.

endloop.

PROCESS AFTER INPUT.

LOOP AT IT_SFLIGHT.

ENDLOOP.

MODULE USER_COMMAND_0100.

***********************************************************************************************************

But when I run this , I get the empty table in output . Please let me kwno what can be the problem.

5 REPLIES 5
Read only

Former Member
0 Likes
704

Hi,

Follow the steps to update the database table records.

1.TOP INCLUDE code

TABLES: EKKO.

DATA: OK_CODE TYPE SY-UCOMM.

CONTROLS: TC100 TYPE TABLEVIEW USING SCREEN 100.

DATA: IT_EKKO LIKE EKKO OCCURS 0 WITH HEADER LINE.

DATA: CUR TYPE I.

DATA: I_EKKO2 LIKE EKKO OCCURS 0 WITH HEADER LINE.

DATA: V_FNAM TYPE I,V_FVAL(10) TYPE N.

2.Create screen with number(e.g 123) and click on layout tab

Give the table control name as TC100.

SELECT THE FIELDS FROM INTERNAL TABLE (IT_EKKO). DRAG THE TEXT FIELDS INTO THE TABLE CONTROL FOR FIELD HEADINGS.

Create 4 pushbuttons(insert,fetch,delete and exit)

CLICK ON “Element list” TAB AND ENTER THE “OK_CODE”.

CLICK ON FLOWLOGIC TAB.

3.Flowlogic code

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

LOOP AT IT_EKKO CURSOR CUR WITH CONTROL TC100.

ENDLOOP.

*

PROCESS AFTER INPUT.

LOOP AT IT_EKKO.

MODULE MODIFY_ITAB.

ENDLOOP.

MODULE USER_COMMAND_0100.

4.Double click on MODIFY_ITAB and write as

module MODIFY_ITAB input.

APPEND IT_EKKO TO I_EKKO2.

endmodule. " MODIFY_ITAB INPUT

5.Activate PAI and double click on it and write the code as

module USER_COMMAND_0100 input.

CASE OK_CODE.

WHEN 'INS'.

LOOP AT I_EKKO2.

MODIFY EKKO FROM I_EKKO2.

ENDLOOP.

SELECT * FROM EKKO INTO TABLE IT_EKKO.

IF SY-SUBRC = 0.

MESSAGE S003(ZCSMSG).

ENDIF.

WHEN 'FETCH'.

SELECT * FROM EKKO INTO TABLE IT_EKKO UP TO 2000 ROWS.

TC100-LINES = SY-DBCNT.

WHEN 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

endmodule. " USER_COMMAND_0100 INPUT

6.Create Transaction code and execute it.

Click on Fetch button to get the data into table control.

Reward,if useful.

Thanks,

Chandu

Read only

Former Member
0 Likes
704

Hi Pranshu,

I think you are missing updating the table control in PBO.

 
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
MODULE DATA_RETRIEVAL.

loop at it_sflight into wa_sflight with control TABLE_CONT cursor TABLE_CONT-top_line.

move-corresponding wa_sflight to table_cont. "insert this line

endloop.

Reward points if this helps,

Kiran

Read only

Former Member
0 Likes
704

loop at it_sflight into wa_sflight with control TABLE_CONT cursor TABLE_CONT-top_line.

endloop.

instead of this

Try this

loop at it_sflight into sflight with control TABLE_CONT cursor TABLE_CONT-top_line.

endloop.

where as sflight is the name of the field in the screen.

open the table control and put cursor on the table, see the name.

Regards,

Ajay

Read only

Former Member
0 Likes
704

what fields did you put on the table control ? from the internal table it_sflight or from work area wa_sflight ?

i beleive u did it from IT_SFLIGHT , right ?

try this.

loop at it_sflight into wa_sflight with control TABLE_CONT cursor TABLE_CONT-top_line.

endloop.

Read only

0 Likes
704

Hi,

I think Sujamol has figured out the issue. Another way to achieve the same result is to keep your loop the same:

loop at it_sflight into wa_sflight with control TABLE_CONT cursor TABLE_CONT-top_line.

endloop.

BUT put the wa_sflight fields into your table control container in screen painter.

Regards,

Jamie