‎2007 Mar 19 5:52 AM
hi,
friends,
SCREEN PAINTER-
SE51-FIELDS
1) KUNNR,NAME,LAND1
BUTTONS- DISPLAY & EXIT.
AFTER CREATING THIS
I WROTE CODING LIKE THIS
PROCESS BEFORE OUTPUT.
LOOP AT ITAB CURSOR K1.
MODULE STATUS_0100.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP .
MODULE USER_COMMAND_0100.
ENDLOOP.
REPORT YSCREEN .
TABLES : KNA1.
DATA : BEGIN OF ITAB OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
LAND1 LIKE KNA1-LAND1,
NAME1 LIKE KNA1-NAME1,
END OF ITAB.
DATA : K1 TYPE I.
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'DISP'.
SELECT KUNNR LAND1 NAME1 FROM KNA1 INTO ITAB.
APPEND ITAB.
ENDSELECT.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
MOVE-CORRESPONDING ITAB TO KNA1.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
ERROR : LOOP CANNOT BE ASSIGNED TO ANY FIELD.
1) CAN U EXPLAIN THE PAI & PBO IN THIS PROGRAM.
2) EXACT POSITION OF THE LOOP IN THE PROGRAM.
3) WHY I USED THE CURSOR K1 IN THIS PROGRAM.
4) WHAT IS THE O/P ?
5) IF I ENTER THE KUNNR THEN AFTER PRESSING DISPLAY THEN OTHER FILEDS WILL APPEAR.IS IT SO?
‎2007 Mar 19 6:03 AM
1)first of all write the MODULE STATUS_0100 and usercommand modules before and after the loop respectively for pbo and pai . loop end loop is used while filling a data from an internal table to a table control to display the fields. so plz use loop endloop only wth table control . as u have to fill ur table control with each line of internal table that is y we use it . in ur case ur looping to internal table to a particular cursor position .
2)position of loop
pbo
MODULE STATUS_0100.
LOOP AT ITAB CURSOR K1.
endloop .
pai
LOOP .
ENDLOOP.
MODULE USER_COMMAND_0100.
for rest of ur questions please be clear with the scenario ur workin in for displaying the data ie ru using a table control or somethin else to display data in
‎2007 Mar 19 5:55 AM
Hi,
When you are using the TABLE CONTROL on your screen you have to write LOOP ENDLOOP statements, because a table control you will populate multiple records. that is a must.
but where as you are using just fields, so no need of writin the loop endloop in PAI and PBO.
PROCESS BEFORE OUTPUT.
<b>LOOP AT ITAB CURSOR K1.</b>
MODULE STATUS_0100.
<b>ENDLOOP.</b>
PROCESS AFTER INPUT.
<b>LOOP .</b>
MODULE USER_COMMAND_0100.
<b>ENDLOOP.</b>
remove the highlighted ones
reward if useful.
regards,
Anji
‎2007 Mar 19 5:57 AM
As u told i removed the statements but even though i am not getting the result if i display the name & land1 is not displaying.
‎2007 Mar 19 6:02 AM
Hi,
Why you need internal table for KNA! fields, one KUNNR will have one Name only.So just take a structure, remove that occurs 0 from internal table.
Declare the same fields on the screen ie. structure fields. it will display the Name field on screen.
Regards,
Anji
‎2007 Mar 19 6:03 AM
1)first of all write the MODULE STATUS_0100 and usercommand modules before and after the loop respectively for pbo and pai . loop end loop is used while filling a data from an internal table to a table control to display the fields. so plz use loop endloop only wth table control . as u have to fill ur table control with each line of internal table that is y we use it . in ur case ur looping to internal table to a particular cursor position .
2)position of loop
pbo
MODULE STATUS_0100.
LOOP AT ITAB CURSOR K1.
endloop .
pai
LOOP .
ENDLOOP.
MODULE USER_COMMAND_0100.
for rest of ur questions please be clear with the scenario ur workin in for displaying the data ie ru using a table control or somethin else to display data in
‎2007 Mar 19 6:09 AM
i gave same u told in pai & pbo
but i am getting error.
loop cannot be assigned to any field.
‎2007 Mar 19 6:13 AM
o/p
i am getting after removing the loop.
customer- text box.
country- text box.
name- text box.
buttons
display exit.
after entering customer i am pressing display button so that i can get other fields i.e. country name autom.
is this proceducer is right or wrong.