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 controls

Former Member
0 Likes
784

hi friends i created a table control .but its giving syntax error like this .

The field "AGE" is not assigned to a loop. "LOOP ... ENDLOOP" must

appear in "PBO" and "PAI".

please help me.

please look at this code .

tables : zpr_table.

data : begin of itab occurs 0.

include structure zpr_table.

data : end of itab.

data : itab1 like itab.

module USER_COMMAND_0100 input.

TYPE-POOLS:cxtab.

DATA l_lines_name LIKE feld-name.

DATA l_selline LIKE sy-stepl.

DATA l_lastline TYPE i.

DATA l_line TYPE i.

DATA l_table_name LIKE feld-name.

DATA p_tc_name1 TYPE dynfnam.

FIELD-SYMBOLS: <tc> TYPE cxtab_control.

FIELD-SYMBOLS <table> TYPE STANDARD TABLE.

FIELD-SYMBOLS <lines> TYPE i.

loop at itab.

case sy-ucomm.

when 'int'.

set cursor field itab1-age line l_selline.

GET CURSOR LINE l_selline.

IF sy-subrc <> 0. " append line to table

l_selline = <tc>-lines + 1.

IF l_selline > <lines>.

<tc>-top_line = l_selline - <lines> + 1 .

ELSE.

<tc>-top_line = 1.

ENDIF.

ELSE. " insert line into table

l_selline = <tc>-top_line + l_selline - 1.

l_lastline = <tc>-top_line + <lines> - 1.

ENDIF.

l_line = l_selline - <tc>-top_line + 1.

INSERT INITIAL LINE INTO <table> INDEX l_selline.

<tc>-lines = <tc>-lines + 1.

endcase.

endloop.

endmodule. " USER_COMMAND_0100 INPUT

6 REPLIES 6
Read only

Former Member
0 Likes
721

Hi,

please check out the sample program below it might help you to resolve your queries

&----


*& Report Z01_TABCONTROL *

*& *

&----


*& *

*& *

&----


REPORT Z01_TABCONTROL .

TABLES: SFLIGHT.

controls: tab_control type tableview USING screen 100.

DATA: ITAB TYPE TABLE OF SFLIGHT,

WA TYPE SFLIGHT,

CHK(1) VALUE 'X',

OK_CODE TYPE SY-UCOMM.

CALL SCREEN 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'HI'.

  • SET TITLEBAR 'xxx'.

IF CHK = 'X'.

SELECT CARRID CONNID FLDATE PRICE CURRENCY SEATSMAX SEATSOCC FROM

SFLIGHT INTO CORRESPONDING FIELDS OF TABLE ITAB.

CHK = 'N'.

ENDIF.

DESCRIBE TABLE ITAB lines tab_control-lines.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module TRANSFER OUTPUT

&----


  • text

----


MODULE TRANSFER OUTPUT.

MOVE-CORRESPONDING WA TO SFLIGHT.

ENDMODULE. " TRANSFER OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

CASE OK_CODE.

WHEN 'BACK'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module CHANGE INPUT

&----


  • text

----


MODULE CHANGE INPUT.

MODIFY ITAB FROM SFLIGHT INDEX TAB_CONTROL-CURRENT_LINE.

ENDMODULE. " CHANGE INPUT

-


PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

LOOP AT ITAB INTO WA WITH CONTROL TAB_CONTROL.

MODULE TRANSFER.

ENDLOOP.

*

PROCESS AFTER INPUT.

LOOP AT ITAB.

MODULE CHANGE.

ENDLOOP.

MODULE USER_COMMAND_0100.

********please reward points if the information is helpful to you*******

Read only

Former Member
0 Likes
721

Hi,

The table control name we want to put into a loop,both inside the PAI and PBO

ex :

tabdata is the table control name

PROCESS BEFORE OUTPUT.

MODULE STATUS_4003.

Loop with control tabdata.

Module Move-Data-to-Screen.

EndLoop.

PROCESS AFTER INPUT.

Loop with control tabdata.

Module Move-Data-from-Screen.

EndLoop.

Then only it will loop as per the rows of table control....

REWARD IF USEFUL!!!!!!!!!! !! !! !!

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
721

Hi,

You need to call your PAI and PBO modules that operate on the Table control in the flow logic between the LOOP AT and END LOOP over the table control.

Syntax As follows.

LOOP AT itab CURSOR cur [INTO wa]

[CURSOR top_line] [FROM n1] [TO n2]

WITH CONTROL contrl.

...

ENDLOOP.

Example:

PROCESS BEFORE OUTPUT.

MODULE prepare_tab.

LOOP AT spfli_tab INTO spfli WITH CONTROL flight_tab.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP AT spfli_tab.

MODULE modify_tab.

ENDLOOP.

Regards,

Sesh

.

Read only

Former Member
0 Likes
721

Hi,

In the PBO please insert LOOP and ENDLOOP statement.

Thanks and Regards,

Kunjal Patel

Read only

gopi_narendra
Active Contributor
0 Likes
721

the table control should be assigned with a loop endloop in the PBO and PAI

just like this

PROCESS BEFORE OUTPUT.
  LOOP WITH CONTROL tabctrl.
    MODULE read_tc.
  ENDLOOP.
* MODULE STATUS_0100.

PROCESS AFTER INPUT.
  LOOP WITH CONTROL tabctrl.
    MODULE fill_tc.
  ENDLOOP.
* MODULE USER_COMMAND_0100.

For reference see these examples

demo_dynpro_tabcont_loop

demo_dynpro_tabcont_loop_at

and also the tcode : DWDM

Regards

Gopi

Read only

Former Member
0 Likes
721

hi

while using table controls..u should use

loop..endloop stmt both in pbo and pai....

to fetch into and retrieve data from table control

if u dont want any data just write an empty loop..endloop stmt