Application Development 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: 

"Loop cannot be assigned to any field." What does that mean?

Former Member
0 Kudos

Hi, I want to create a Table Control.

This is my code for nów:



PROGRAM ZCONTROLART.
TABLES ZARTIKEL.
CONTROLS ARTIKELTABELLE TYPE TABLEVIEW USING SCREEN 1010.
TYPES: BEGIN OF ARTIKELBEARBEITUNG,
ARTIKEL_NR TYPE ZARTIKEL-ARTIKEL_NR,
ARTIKEL_TYP TYPEW ZARTIKEL-ARTIKEL_TYP,
BEZEICHNUNG TYPE ZARTIKEL-BEZEICHNUNG,
END OF ARTIKELBEARBEITUNG.

DATA: ITS TYPE TABLE OF ARTIKELBEARBEITUNG,
WA TYPE ARTIKELBEARBEITUNG,
itartikel TYPE ZARTIKEL,
waartikel TYPE ZARTIKEL,
okcode LIKE SY-UCOMM.
CALL CREEN 1010.

MODULE V1 INPUT.
CASE OKCODE.
WHEN 'SAVE'.
WA-ARTIKEL_NR = ZARTIKEL-ARTIKEL_NR.
WA-ARTIKEL_TYP = ZARTIKEL-ARTIKEL_TYP.
WA-BEZEICHNIUNG = ZARTIKEL-BEZEICHNUNG.
MOVE-CORRESPONDING WA TO WAARTIKEL.

INSERT INTO ZARTIKEL VALUES WAARTIKEL.

WHEN 'DELETE'.
WA-ARTIKEL_NR = ZARTIKEL-ARTIKEL_NR.
WA-ARTIKEL_TYP = ZARTIKEL-ARTIKEL_TYP.
WA-BEZEICHNIUNG = ZARTIKEL-BEZEICHNUNG.
MOVE-CORRESPONDING TO WAARTIKEL.
DELETE ZARTIKEL FROM WAARTIKEL.

WHEN 'MODIFY'.
WA-ARTIKEL_NR = ZARTIKEL-ARTIKEL_NR.
WA-ARTIKEL_TYP = ZARTIKEL-ARTIKEL_TYP.
WA-BEZEICHNIUNG = ZARTIKEL-BEZEICHNUNG.
MOVE-CORREDPONDING WA TO WAARTIKEL.
MODIFY ZARTIKEL FROM WAARTIKEL.
ENDCASE.
ENDMODULE.

MODULE EXIT INPUT.
IF OKCODE = 'EXIT'.
LEAVE PROGRAM.
ENDIF.
ENDMODULE.

In screen-painter (layout) I got the program field from table wa.

In flow-logic I have the code:


PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL ARTIKELNUMMER.

ENDLOOP

PROCESS AFTER INPUT.
MODULE EXIT.
LOOP WITH CONTROL ARTIKELNUMMER.
MODULE V1.

ENDLOOP.

Now I got a failure, when I want to activate the Dynpro.

Its called:

Syntax error in screen.

Program - ZWORKTOP

SCREEN - 1010

Position - Flow logic

LOOP cannot be assigned to any field.

Has anyone of you an idea, so as the other times , what this message mean and how I can fix the problem??

Is there a faulse code in my flow logic??

I hope you can help me so great, as you did the other times...

Bye

Buergman

1 ACCEPTED SOLUTION

Former Member
0 Kudos

I understand this is old post but I also faced same issue. My solution might be helpful to someone.

Resolution - I missed to create table control in layout and once that was created, I was able to activate screen.

8 REPLIES 8

Former Member
0 Kudos

Hi ,


PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL ARTIKELTABELLE.       <<<You should be looping at table control here
 
ENDLOOP
 
PROCESS AFTER INPUT.
MODULE EXIT.
LOOP WITH CONTROL ARTIKELTABELLE.
MODULE V1.
 
ENDLOOP.

Himanshu

0 Kudos

see,

it would be much easier for you to do this using wizard of table control.

that will create the routines for you.

and any ways, as suggested above,

you have to loop in a table, right?

so you need to loop at the table you defined as :

LOOP WITH CONTROL ARTIKELTABELLE.

0 Kudos

So, I have changed my code:

Now, tab is my table control and itab is my internal table.



REPORT ZCONTROLTEST.
CONTROLS tab TYPE TABLEVIEW USING SCREEN 1010.

TABLES ZARTIKEL.

DATA: ok_code TYPE sy-ucomm,
save_ik TYPE sy-ucomm.

CALL: screen 1010.
MODULE get_t_ctrl_lines OUTPUT.
SELECT * from ZARTIKEL INTO TABLE itab.
ENDMODULE.

and in flow logic:



PROCESS BEFORE OUTPUT.
MODULE status_1010.
LOOP AT itab WITH CONTROL itab CURSOR t_ctrl-current_line.
ENDLOOP.

PROCESS AFTER INPUT.
MODULE user_command_1010.

Now, loop my internal table, but it doesn't work as well, too. The

same error:

"LOOP" cannot be assigned to any field.

Have you got an idea, what I did wrong now??

Bye

Buergman

0 Kudos

Hi,

I think you will have to write the loop logic below shown below inside a module instead of writing it in PAI.

LOOP AT itab WITH CONTROL itab CURSOR t_ctrl-current_line.
ENDLOOP.

Try create another module in PAI and put your code there.

KR Jaideep,

0 Kudos

Hi,

U should use loop statement in PAI section also.

Ex: Loop at itab.

Endloop.

And also, u can use

Loop at itab with control atrikelnumber.

endloop.

0 Kudos

Hi, I was testing it and also I was testing some other things, but

nothing of it worked.

I'm desperate....

0 Kudos

Its better to cross check your program with the demo programs

DEMO_DYNPRO_TABLE_CONTROL_1

DEMO_DYNPRO_TABLE_CONTROL_2

Former Member
0 Kudos

I understand this is old post but I also faced same issue. My solution might be helpful to someone.

Resolution - I missed to create table control in layout and once that was created, I was able to activate screen.