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

Loop problem

Former Member
0 Likes
597

I am doing table control but I have error. Here are my codes:

report ZHERA_TABLE_CONTROL.

CONTROLS flights TYPE TABLEVIEW USING SCREEN 3000.

DATA: ok_code TYPE sy-ucomm,

save_ok TYPE sy-ucomm.

DATA: itab TYPE TABLE OF ZHERA,

fill TYPE i.

TABLES demo_conn.

DATA: lines TYPE i,

limit TYPE i.

SELECT * FROM ZHERA INTO CORRESPONDING FIELDS OF TABLE itab.

DATA wa_hera like line of itab.

CALL SCREEN 3000.

MODULE status_3000 OUTPUT.

SET PF-STATUS 'SCREEN_3000'.

DESCRIBE TABLE itab LINES fill.

flights-lines = fill.

ENDMODULE.

MODULE fill_table_control OUTPUT.

READ TABLE itab INTO demo_conn INDEX flights-current_line.

ENDMODULE.

MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE read_table_control INPUT.

lines = sy-loopc.

MODIFY itab FROM demo_conn INDEX flights-current_line.

ENDMODULE.

MODULE user_command_3000 INPUT.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'NEXT_LINE'.

flights-top_line = flights-top_line + 1.

limit = fill - lines + 1.

IF flights-top_line > limit.

flights-top_line = limit.

ENDIF.

WHEN 'PREV_LINE'.

flights-top_line = flights-top_line - 1.

IF flights-top_line < 0.

flights-top_line = 0.

ENDIF.

WHEN 'NEXT_PAGE'.

flights-top_line = flights-top_line + lines.

limit = fill - lines + 1.

IF flights-top_line > limit.

flights-top_line = limit.

ENDIF.

WHEN 'PREV_PAGE'.

flights-top_line = flights-top_line - lines.

IF flights-top_line < 0.

flights-top_line = 0.

ENDIF.

WHEN 'LAST_PAGE'.

flights-top_line = fill - lines + 1.

WHEN 'FIRST_PAGE'.

flights-top_line = 0.

ENDCASE.

ENDMODULE.

Screen 3000 codes:

PROCESS BEFORE OUTPUT.

MODULE status_3000.

LOOP AT itab into wa_hera with control FLIGHTS.

MODULE fill_table_control.

ENDLOOP.

PROCESS AFTER INPUT.

MODULE cancel AT EXIT-COMMAND.

LOOP AT ZHERA.

MODULE read_table_control.

ENDLOOP.

MODULE user_command_3000.

Can anyone tell me what is my problem? I keep getting the "LOOP" cannot be assigned to any field at the sentence 'LOOP AT itab into wa_hera with control FLIGHTS.'

1 REPLY 1
Read only

Former Member
0 Likes
363

Hi,

there is no append statement in ur code.

u need to append the data into internal table.

write the module_append in PAI.

module_append.

append wa_tab into fs_tab.

plzz reward points if useful.