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

Record not shown in table control

Former Member
0 Likes
3,422

Hi experts,

I am working on the module pool program with a screen 0100. There is a table control called TABL_MATR in screen 0100.

There is no error while compiling the program. But no record shown when a record added into the table control.

I do not want to use the headerline in the program, because I intented to do it in OO way.

Record shown if I do like this:


DATA: ITAB_TRAY  TYPE STANDARD TABLE OF LS_TRAY WITH HEADER LINE.

In PBO


loop at itab_tray  " record show in the table control

whereas record not shown if do like this:


DATA: ITAB_TRAY  TYPE STANDARD TABLE OF LS_TRAY.

In PBO


loop at itab_tray into wa_tray  " no record show in the table control

Can someone guide me how to do it in the right way?

Please help.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,380

Hello,

How can you move the value from structure it internal table. there is only two way to move the value to internal table. one is append and modify.

but you are using MOVE-CORRESPONDING wa_tray TO itab_tray.

http://i566.photobucket.com/albums/ss106/wkw510/pic4.jpg

i think this wrong statement. earlier it will work becasue it have the header

here you can modify or append the values.

i think it will solve your problem...

-


Ravi

Hi experts,

I am working on the module pool program with a screen 0100. There is a table control called TABL_MATR in screen 0100.

There is no error while compiling the program. But no record shown when a record added into the table control.

I do not want to use the headerline in the program, because I intented to do it in OO way.

Record shown if I do like this:


DATA: ITAB_TRAY  TYPE STANDARD TABLE OF LS_TRAY WITH HEADER LINE.

In PBO


loop at itab_tray  " record show in the table control

whereas record not shown if do like this:


DATA: ITAB_TRAY  TYPE STANDARD TABLE OF LS_TRAY.

In PBO


loop at itab_tray into wa_tray  " no record show in the table control

Can someone guide me how to do it in the right way?

Please help.

Thanks in advance.

33 REPLIES 33
Read only

Former Member
0 Likes
3,380

Hi Wong,

We have to move the workarea items into the table workarea explicitly.

for example.



LOOP AT   GT_ITAB
       INTO WA_ITAB
      WITH CONTROL T_CTRL
      CURSOR T_CTRL-CURRENT_LINE.
    MODULE T_CTRL_MOVE.      " check the module
  ENDLOOP.


MODULE T_CTRL_MOVE OUTPUT.
MOVE-CORRESPONDING WA_ITAB TO ZPRK_MODULE .
ENDMODULE. 

Regards

Kumar M

Edited by: Kumar M on May 20, 2009 9:30 AM

Read only

0 Likes
3,380

Hi Kumar,

Can you explain to me what is MODULE T_CTRL_MOVE and ZPRK_MODULE?

Without this, I couldnt imagine what I should do.

Read only

Former Member
0 Likes
3,380

Hi.

Item ID of table control of Dynpro 0100 = Item ID of internal table?

*Dynpro 0100 layout

"----


ZZTBL01-FDL01 "<===

ZZTBL01-FDL02 "<===

"----


*PBO

loop at itab_tray into wa_tray " no record show in the table control

with control TC_DATA cursor TC_DATA-CURRENT_LINE.

module set_fld.

endllop.

module set_fld output.

ZZTBL01-FDL01 = wa_tray-FDL01. "<===

ZZTBL01-FDL02 = wa_tray-FDL02. "<===

endmodule.

Read only

Former Member
0 Likes
3,380

Hello,

If the name of the table control is itab_tray, you have to create the internal table with header line.

Read only

0 Likes
3,380

Hi Sowmya Arni,

Thanks for your reply. Because I want to do it in OO way. As you know ABAP objects are not supported with headerline. Thats the reason I use workarea.

Read only

Former Member
0 Likes
3,380

Hi Wong,

While creating Table control we will refer the fields of that table control from a database table .



LOOP AT   GT_ITAB
       INTO WA_ITAB
      WITH CONTROL T_CTRL
      CURSOR T_CTRL-CURRENT_LINE.
    MODULE T_CTRL_MOVE.      " check the module
  ENDLOOP.

In the above code i am looping the data into the table control. here module T_CTRL_MOVE is a module written in the PBO of the screen.

below is the code written in that module.



MODULE T_CTRL_MOVE OUTPUT.
MOVE-CORRESPONDING WA_ITAB TO ZPRK_MODULE .
ENDMODULE.

in the above code i am moving the work area data to the table control fields.

Regards

Kumar M

Read only

0 Likes
3,380

Hi Kumar,

Really appreciate your prompt reply.

I am sorry that I cannot reply you on time.

May I know what is ZPRK_MODULE ?

In ZXX_TOP:


DATA: ITAB_TRAY  TYPE STANDARD TABLE OF LS_TRAY,
          WA_TRAY    LIKE LINE OF ITAB_TRAY.

In PBO


  loop at itab_tray into wa_tray
    with control tabl_matr
    cursor tabl_matr-current_line.

    module fill_table_control.

  endloop.

module fill_table_control output.
  MOVE-CORRESPONDING wa_tray TO itab_tray.
endmodule.

In Screen 0100 Table Control.


No.                       Material                Batch
-----                    ------------            ----------
ITAB_TRAY-TRAYNO          ITAB_TRAY-MATNR         ITAB_TRAY-CHARG

I tried to compile the program, but I got this error.


"ITAB_TRAY" is not a structure or internal table with header line.

Please help.

Thanks.

Read only

Former Member
0 Likes
3,380

Check the field name in table control at screen may be you gave the ITAB_TRAY. You should not give the internal table name there. In the above method you want to give the WA_TRAY not ITAB_TRAY.

-


Ravi

Read only

0 Likes
3,380

Hi Ravi,

Thanks for your reply. My table control is TABL_MATR.

I have changed the


MOVE-CORRESPONDING wa_tray TO TABL_MATR.

Compiled successfully and without any error. However, when I tried to update data, nothing show in the table control.

But when in debug mode, I can see data exists in internal table.

Anyone knows why?

Please help.

Read only

0 Likes
3,380

No..No..Don't Give the table control name in MOVE statement. Let us try this way.

1. May be you are wrongly refresh the internal table in some where in PBO or PAI.

2. Or you miss some code. check are you passing the value for number of lines for table control.

In PBO, outside the table control loop. you want to assign the number of lines.

DESCRIBE TABLE <Your internal table name> LINES V_FILL.

TABL_MATR-LINES = V_FILL.

I hope now it will work. Don't forget ....change the MOVE-CORRESPONDING code.

MOVE-CORRESPONDING wa_tray TO <your internal table name>.

-


Ravi

Read only

0 Likes
3,380

Hi Ravi,

Thanks again for the reply.

I have changed the code to new code as shown below.

However I am getting the previous compile error message.


"ITAB_TRAY" is not a structure or internal Table with header line.

As I mentioned earlier, I need to do it OO way.

New OO concept is strictly not allowed head line and replace with workarea.

How should I overcome this problem here? Please help.

In ZXX_TOP.


TYPES: ls_tray TYPE ZXX_TRAY.

DATA: itab_tray TYPE STANDARD TABLE OF ls_tray,
          wa_tray LIKE LINE OF itab_tray.

IN PBO.


LOOP AT itab_tray INTO wa_tray
    WITH CONTROL tabl_matr     "table control name
    CURSOR tabl_matr-current-line.

    MODULE fill_table_control.
ENDLOOP.

DESCRIBE TABLE itab_tray LINES v_fill.         "defined v_fill as TYPE i
TABL_MATR-LINES = v_fill.

In PBO Modules


module fill_table_control output.
   MOVE-CORRESPONDING wa_tray TO itab_tray.
endmodule.

Read only

0 Likes
3,380

hi,

just check this way if it works.... In the PBO module remove the cursor addition in the loop statement

LOOP AT itab_tray INTO wa_tray
    WITH CONTROL tabl_matr.     "table control name

    MODULE fill_table_control.
ENDLOOP.

Regards,

Siddarth

Read only

0 Likes
3,380

Hi Siddharth,

Thanks for your reply. A very good try, but it is not working. There is still no data display in the table control.

Read only

0 Likes
3,380

Please could you check the following steps and compare with your code.

1. In screen flow logic

PROCESS BEFORE OUTPUT.

MODULE STATUS_8000.

LOOP AT ITAB_TRAY INTO WA_TRAY

WITH CONTROL TABL_MATR

CURSOR TABL_MATR-CURRENT-LINE.

MODULE FILL_TABLE_CONTROL.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP ITAB_TRAY INTO WA_TRAY.

ENDLOOP.

2. In Module

MODULE STATUS_8000 OUTPUT.

SET PF-STATUS 'PF-xxxx'.

SET TITLEBAR 'xxxx'.

DESCRIBE TABLE ITAB_TRAY LINES LINES.

CONTROL-LINES = LINES.

ENDMODULE.

MODULE FILL_TABLE_CONTROL OUTPUT.

MOVE-CORRESPONDING WA_TRAY TO ITAB_TRAY.

ENDMODULE.

3. In Screen design.

Each screen fields in table control. should be a start with the stucture name WA_TRAY not ITAB_TRAY.

example

WA_TRAY-FLD1, WA_TRAY-FLD2....

Dont give the following way.....ITAB_TRAY-FLD1, ITAB_TRAY-FLD2.....

I hope now it will work.

-


Ravi

Read only

0 Likes
3,380

Hi Ravi,

I did what exactly you told me. However, I get this error message while compiling the program.


"ITAB_TRAY" is not a structure or internal table with header line.

Please help again.

Read only

0 Likes
3,380

Please could you send me the full code...and also send me the structure of ITAB_TRAY.

Read only

0 Likes
3,380

Hi Ravi,

I tried to copy the relevant code into here:

In PBO


process before output.
  module status_0100.

  loop at itab_tray into wa_tray
    with control tabl_matr
    cursor tabl_matr-current_line.

    module fill_table_control.

  endloop.

In PAI


  loop at itab_tray INTO wa_tray.

  endloop.

* Exit Commands
  module exit at exit-command.

*  MODULE EXIT_COMMAND_0100 AT EXIT-COMMAND.
  module user_command_0100.

In ZXX_TOP


TYPES: LS_TRAY   TYPE ZXX_TRAY.
CONTROLS: TABL_MATR TYPE TABLEVIEW USING SCREEN 0100.

DATA: ITAB_TRAY  TYPE STANDARD TABLE OF LS_TRAY," WITH HEADER LINE,
WA_TRAY    LIKE LINE OF ITAB_TRAY.

Just for your information, when I double clicked on error message


"ITAB_TRAY" is not a structure or internal table with header line.

the cursor is pointing at


module fill_table_control output.
  MOVE-CORRESPONDING wa_tray TO itab_tray.
endmodule.

Read only

0 Likes
3,380

Oops!!!

I asked the structure of the ITAB_TRAY. I hope it is refereeing the structure ZXX_TRAY.

Can you send me the structure of ZXX_TRAY? What are the fields available in the structure?

-


Ravi

Read only

0 Likes
3,380

Hi Ravi,

I hope I didnt bother you again.

The structure for LS_TRAY is very simple.

TRAYNO --> Z_NUMC

MATNR -->MFRGR

CHARG --> CHAR3

Read only

0 Likes
3,380

Hi,

Try this way,

TYPES: ls_tray TYPE ZXX_TRAY.

DATA: itab_tray TYPE TABLE OF ls_tray,

wa_tray type ls_tray.

Read only

0 Likes
3,380

Hi,

Try this way,

DATA: ITAB_TRAY TYPE TABLE OF LS_TRAY,

WA_TRAY type ls_tray.

Read only

Former Member
0 Likes
3,380

May be a following problem.

In your table control if you have the selection field, Could you check what is the field name you gave?

Can you see the w/SelColumn from the following attached screen. I hope you gave the ITAB_TRAY name there.

[http://www.sapdev.co.uk/dialog/tabcontrol/Table%20Control_files/image024.jpg]

if not work...then please share the screen shot of following <<email address removed>>

1. Screen shot for Layout of screen. Ex: See the above link

2. Screen shot for Flow logic

3. Screen shot for all Modules..PBO and PAI.

4. Screen shot for Structure of LS_TRAY.

My ultimte aim is to fix your issue. Thats end. Please don't mistake me.

Thank you,

-


Ravi.

Edited by: RavivarmanP on May 25, 2009 6:01 PM

Edited by: Matt on May 25, 2009 4:08 PM

Read only

0 Likes
3,380

This message was moderated.

Read only

matt
Active Contributor
0 Likes
3,380

Don't post your email address. Maintain your business card instead.

matt

Read only

0 Likes
3,380

Hi administrators,

I am sorry that I had posted the email address.

Please remove this message if I am not allowed to post a link to view the image.

Hi Ravi,

Please see the image files: -

1)http://i566.photobucket.com/albums/ss106/wkw510/PIC1.jpg

2)http://i566.photobucket.com/albums/ss106/wkw510/PIC2.jpg

3)http://i566.photobucket.com/albums/ss106/wkw510/pic3.jpg

4)http://i566.photobucket.com/albums/ss106/wkw510/pic4.jpg

5)http://i566.photobucket.com/albums/ss106/wkw510/pic5.jpg

Read only

0 Likes
3,380

Hi,

Please share the following thinks.

1. Screen shot for Layout of screen with table control properties . Ex: See the following link..please view the screen shot...same screen format requierd.

Hello please click the following link.

http://www.sapdev.co.uk/dialog/tabcontrol/Table%20Control_files/image024.jpg

2. share the screenshot for Element list.

So totaly 2 screenshot now requiered. I hope now you are clear what i am expecting.

If yo not done this think i can't help on this.

thanks

Ravi

Read only

0 Likes
3,380

Devendra also said same point...that is same story i am also try to say..please check in the filed name in screen. and check in W/ SelColumn or Delete all the table control in the screen design and do it as a new....

-


Ravi

Edited by: RavivarmanP on May 26, 2009 12:42 AM

Read only

Former Member
0 Likes
3,380

Hi,

For OO, you can not use table with header line. So you have to use separate work area.

In your case, declare table and work area as follows:

DATA: ITAB_TRAY TYPE STANDARD TABLE OF LS_TRAY,

WA_TRAY TYPE LS_TRAY.

In your table control, you might be using fields from ITAB_TRAY.

Go to screen 0100 layout and delete fields of table control which you are using from ITAB_TRAY.

It should actually refer to work area which hold data during LOOP AT statement.

So change them as folows:

ITAB_TRAY-TRAYNO => WA_TRAY-TRAYNO

ITAB_TRAY-MATNR => WA_TRAY-MATNR

ITAB_TRAY-CHARG => WA_TRAY-CHARG.

In PBO

loop at itab_tray into wa_tray

with control tabl_matr

cursor tabl_matr-current_line.

  • No need to write anything here.

endloop.

Regards,

Devendra

Read only

Former Member
0 Likes
3,381

Hello,

How can you move the value from structure it internal table. there is only two way to move the value to internal table. one is append and modify.

but you are using MOVE-CORRESPONDING wa_tray TO itab_tray.

http://i566.photobucket.com/albums/ss106/wkw510/pic4.jpg

i think this wrong statement. earlier it will work becasue it have the header

here you can modify or append the values.

i think it will solve your problem...

-


Ravi

Read only

0 Likes
3,380

Hi all,

I have added the below images.

1) http://i566.photobucket.com/albums/ss106/wkw510/pic6.jpg

2) http://i566.photobucket.com/albums/ss106/wkw510/pic7.jpg

3) http://i566.photobucket.com/albums/ss106/wkw510/pic8.jpg

I have also followed what Devendra's suggested, however the same error message I get:


"ITAB_TRAY" is not a structure or internal table with header line.

As such I have changed the statement


module fill_table_control output.
  MOVE-CORRESPONDING wa_tray TO itab_tray.
endmodule.

to


module fill_table_control output.
  APPEND wa_tray TO itab_tray.
endmodule.

After changed, compiled no error.

But, when I started to use the program I got another error which closed the whole SAP screen.

Therefore I tried to change the TABLE CONTROL setting to

4) http://i566.photobucket.com/albums/ss106/wkw510/pic10.jpg

Now, everything is okay but I only get the latest record shows in the TABLE CONTROL. The record I inserted display more than one time, and filled all the table control.

5) http://i566.photobucket.com/albums/ss106/wkw510/pic11.jpg

I am wondering should we include

MOVE-CORRESPONDING wa_tray TO itab_tray.

or

APPEND wa_tray TO itab_tray.

According from Devendra, the PBO should only has this code


  loop at itab_tray into wa_tray
    with control tabl_matr
    cursor tabl_matr-current_line.

*    module fill_table_control.   "shoule we exclude this?
  endloop.

If I exclude the above code, the table control only show one record, regardless how many records are inserted.

Something is not right here, but just cant find it out.

Please help.

Read only

0 Likes
3,380

Good now you understand what i expect to change. you are in correct path.

now change the following code instead of APPEND wa_tray TO itab_tray.

in TOP

DATA: wa_tray1 LIKE LINE OF itab_tray

in flow logic at PBO

LOOP AT itab_tray INTO wa_tray1

WITH CONTROL tabl_matr "table control name

CURSOR tabl_matr-current-line.

MODULE fill_table_control.

ENDLOOP.

in PAI

LOOP AT itab_tray INTO wa_tray1

ENDLOOP.

in Module

module fill_table_control output.

MOVE-CORRESPONDING wa_tray1 TO wa_tray.

endmodule.

now you will get correct data.

Read only

0 Likes
3,380

Hi,

As per my last post, it is not necessary to put anything in LOOP AT...ENDLOOP in PBO.

I have used such code and it works perfectly. Please check that your table ITAB_TRAY is filled with records properly before it goes to LOOP AT ...ENDLOOP.

You can check it in debug mode.

Regards,

Devendra

Read only

0 Likes
3,380

Hi Ravi,

Devendra is right, now the program works perfectly.

Thanks to everyone, especially both of you, Ravi and Devendra.