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

Screen Painter and tables

Former Member
0 Likes
835

I have created a Table Control in a Screen Painter and I need help to fill it.

I assign to the Table Control a field of an internal table but when I try to activate it i receive the followin error:

The field "XXXX-XXXX" is not assigned to a LOOP. "LOOP...ENDLOOP" must apper in PBO and PAI

Can u help me?

Thanx in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
758

Hi Jose,

Refer the below code for clarification.

Regards,

Raj

&----


*& Module pool ZTESTRAJ_TABLECONTROL *

*& *

&----


*& *

*& *

&----


PROGRAM ztestraj_tablecontrol .

TABLES mara.

CONTROLS : tc1 TYPE TABLEVIEW USING SCREEN 100.

TYPES : BEGIN OF t_mara,

matnr TYPE mara-matnr,

mtart TYPE mara-mtart,

mbrsh TYPE mara-mbrsh,

meins TYPE mara-meins,

lsel TYPE c,

END OF t_mara.

DATA : it_mara TYPE STANDARD TABLE OF t_mara WITH HEADER LINE,

it_mara1 TYPE STANDARD TABLE OF t_mara WITH HEADER LINE,

cols LIKE LINE OF tc1-cols.

DATA : v_lines TYPE i,

lsel,

v_fill TYPE i,

v_limit TYPE i.

DATA : fg_set TYPE c VALUE ''.

DATA : ok_code TYPE sy-ucomm,

save_ok TYPE sy-ucomm.

CONSTANTS : c_mtart(4) TYPE c VALUE 'FERT'.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0100 OUTPUT.

SET PF-STATUS 'SCREEN_100'.

SET TITLEBAR 'RAJ'.

IF fg_set = ''.

SELECT matnr

mtart

mbrsh

meins

FROM mara

INTO TABLE it_mara

WHERE mtart = c_mtart.

DESCRIBE TABLE it_mara LINES v_fill.

v_lines = v_fill.

fg_set = 'X'.

ENDIF.

IF fg_set = 'X'.

EXIT.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module fill_table_control OUTPUT

&----


  • text

----


MODULE fill_table_control OUTPUT.

READ TABLE it_mara INTO it_mara1 INDEX tc1-current_line.

ENDMODULE. " fill_table_control OUTPUT

&----


*& Module cancel INPUT

&----


  • text

----


MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE. " cancel INPUT

&----


*& Module read_table_control INPUT

&----


  • text

----


MODULE read_table_control INPUT.

v_lines = sy-loopc .

it_mara1-lsel = lsel.

MODIFY it_mara FROM it_mara1 INDEX tc1-current_line.

ENDMODULE. " read_table_control INPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE user_command_0100 INPUT.

ok_code = sy-ucomm.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'NEXT_LINE'.

tc1-top_line = tc1-top_line + 1.

v_limit = v_fill - v_lines + 1.

IF tc1-top_line > v_limit.

tc1-top_line = v_limit.

ENDIF.

WHEN 'PREV_LINE'.

tc1-top_line = tc1-top_line - 1.

IF tc1-top_line < 0.

tc1-top_line = 0.

ENDIF.

WHEN 'NEXT_PAGE'.

tc1-top_line = tc1-top_line + v_lines.

v_limit = v_fill - v_lines + 1.

IF tc1-top_line > v_limit.

tc1-top_line = v_limit.

ENDIF.

WHEN 'PREV_PAGE'.

tc1-top_line = tc1-top_line - v_lines.

IF tc1-top_line < 0.

tc1-top_line = 0.

ENDIF.

WHEN 'LAST_PAGE'.

tc1-top_line = v_fill - v_lines + 1.

WHEN 'FIRST_PAGE'.

tc1-top_line = 0.

WHEN 'DELETE'.

READ TABLE tc1-cols INTO cols

WITH KEY screen-input = '1'.

IF sy-subrc = 0.

LOOP AT it_mara INTO it_mara1 WHERE lsel = 'X'.

DELETE it_mara.

fg_set = 'X'.

ENDLOOP.

ELSE.

fg_set = ''.

ENDIF.

WHEN 'INSERT'.

LOOP AT it_mara INTO it_mara1 WHERE lsel = 'X'.

INSERT INITIAL LINE INTO it_mara INDEX sy-tabix.

ENDLOOP.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

WHEN 'EXIT'.

LEAVE TO SCREEN 0.

WHEN 'JADOO'.

READ TABLE tc1-cols INTO cols

WITH KEY selected = 'X'.

IF sy-subrc = 0.

cols-invisible = '1'.

MODIFY tc1-cols FROM cols INDEX sy-tabix.

ENDIF.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

I have created a Table Control in a Screen Painter and I need help to fill it.

I assign to the Table Control a field of an internal table but when I try to activate it i receive the followin error:

The field "XXXX-XXXX" is not assigned to a LOOP. "LOOP...ENDLOOP" must apper in PBO and PAI

Can u help me?

Thanx in advance

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
758

Did you use the table control wizard to help you create the table control? If so, it should have done this work for you.

<i>

I assign to the Table Control a field of an internal table but when I try to activate it i receive the followin error:

</i>

I don't think that you want to do that. You should be assiging the entire ITAB to the table control, not just a field.

First create your internal table in the ABAP program, save and activate, now go to the screen and use the table contol wizard. It will ask you for the name of the control, use the internal table name with CON added to it. It will ask you for the internal table of wa, enter the internal table name, follow the rest of the wizard as you see fit. Now everything should be generated for you.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
759

Hi Jose,

Refer the below code for clarification.

Regards,

Raj

&----


*& Module pool ZTESTRAJ_TABLECONTROL *

*& *

&----


*& *

*& *

&----


PROGRAM ztestraj_tablecontrol .

TABLES mara.

CONTROLS : tc1 TYPE TABLEVIEW USING SCREEN 100.

TYPES : BEGIN OF t_mara,

matnr TYPE mara-matnr,

mtart TYPE mara-mtart,

mbrsh TYPE mara-mbrsh,

meins TYPE mara-meins,

lsel TYPE c,

END OF t_mara.

DATA : it_mara TYPE STANDARD TABLE OF t_mara WITH HEADER LINE,

it_mara1 TYPE STANDARD TABLE OF t_mara WITH HEADER LINE,

cols LIKE LINE OF tc1-cols.

DATA : v_lines TYPE i,

lsel,

v_fill TYPE i,

v_limit TYPE i.

DATA : fg_set TYPE c VALUE ''.

DATA : ok_code TYPE sy-ucomm,

save_ok TYPE sy-ucomm.

CONSTANTS : c_mtart(4) TYPE c VALUE 'FERT'.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0100 OUTPUT.

SET PF-STATUS 'SCREEN_100'.

SET TITLEBAR 'RAJ'.

IF fg_set = ''.

SELECT matnr

mtart

mbrsh

meins

FROM mara

INTO TABLE it_mara

WHERE mtart = c_mtart.

DESCRIBE TABLE it_mara LINES v_fill.

v_lines = v_fill.

fg_set = 'X'.

ENDIF.

IF fg_set = 'X'.

EXIT.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module fill_table_control OUTPUT

&----


  • text

----


MODULE fill_table_control OUTPUT.

READ TABLE it_mara INTO it_mara1 INDEX tc1-current_line.

ENDMODULE. " fill_table_control OUTPUT

&----


*& Module cancel INPUT

&----


  • text

----


MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE. " cancel INPUT

&----


*& Module read_table_control INPUT

&----


  • text

----


MODULE read_table_control INPUT.

v_lines = sy-loopc .

it_mara1-lsel = lsel.

MODIFY it_mara FROM it_mara1 INDEX tc1-current_line.

ENDMODULE. " read_table_control INPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE user_command_0100 INPUT.

ok_code = sy-ucomm.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'NEXT_LINE'.

tc1-top_line = tc1-top_line + 1.

v_limit = v_fill - v_lines + 1.

IF tc1-top_line > v_limit.

tc1-top_line = v_limit.

ENDIF.

WHEN 'PREV_LINE'.

tc1-top_line = tc1-top_line - 1.

IF tc1-top_line < 0.

tc1-top_line = 0.

ENDIF.

WHEN 'NEXT_PAGE'.

tc1-top_line = tc1-top_line + v_lines.

v_limit = v_fill - v_lines + 1.

IF tc1-top_line > v_limit.

tc1-top_line = v_limit.

ENDIF.

WHEN 'PREV_PAGE'.

tc1-top_line = tc1-top_line - v_lines.

IF tc1-top_line < 0.

tc1-top_line = 0.

ENDIF.

WHEN 'LAST_PAGE'.

tc1-top_line = v_fill - v_lines + 1.

WHEN 'FIRST_PAGE'.

tc1-top_line = 0.

WHEN 'DELETE'.

READ TABLE tc1-cols INTO cols

WITH KEY screen-input = '1'.

IF sy-subrc = 0.

LOOP AT it_mara INTO it_mara1 WHERE lsel = 'X'.

DELETE it_mara.

fg_set = 'X'.

ENDLOOP.

ELSE.

fg_set = ''.

ENDIF.

WHEN 'INSERT'.

LOOP AT it_mara INTO it_mara1 WHERE lsel = 'X'.

INSERT INITIAL LINE INTO it_mara INDEX sy-tabix.

ENDLOOP.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

WHEN 'EXIT'.

LEAVE TO SCREEN 0.

WHEN 'JADOO'.

READ TABLE tc1-cols INTO cols

WITH KEY selected = 'X'.

IF sy-subrc = 0.

cols-invisible = '1'.

MODIFY tc1-cols FROM cols INDEX sy-tabix.

ENDIF.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

Read only

Former Member
0 Likes
758

Hi

When working with table controls, you should necessarily have a loop endloop in PAI too.

PROCESS BEFORE OUTPUT.

module status_xxx.

LOOP AT itab WITH CONTROL tc_yourtcname

cursor tc_yourtcname-top_line.

MODULE xxx.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP AT itab.

........

ENDLOOP.

- Kalpana