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: 

Screen Exit - Table Control

Former Member
0 Kudos

I am trying to create a table control on screen SAPLXM06 (Screen exit for PO Header using exit MM06E005). I have a few issues. The first is that I can't use the table wizzard because, when it gets to the end, it says that it can't modify program SAPLXM06. So, I tried manually creating a table only I am not sure what I am missing.

I have a table control, called HAULTTABLE, on the screen. Then I have the following:

PROCESS BEFORE OUTPUT.
* MODULE STATUS_0101.
 loop AT IT_HAULTTABLE into wa_haulttable with control HAULTTABLE.

 endloop.
   module pbo.
*
PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0101.
   loop at it_haulttable..
     module pai.
   endloop.

This passes the syntax check. However, when I go to ME23n and click on the "Customer Data" tab, I get an ABAP dump with the following:

CONTROL variable not found

The CONTROL "HAULTTABLE" was searched for but not found.

These is either an inconsistency between the screen and the program or

an incorrect ABAP statement (for example, REFRESH CONTROL .. FROM SCREEN

with incorrect control name).

What did I miss/what am I doing wrong?

Regards,

Davis

1 ACCEPTED SOLUTION

Former Member
0 Kudos

OK, one more part to this question. How do I get data into the table in the PBO routine? All of the posts I have seen on SDN simply has something like the following:

 loop AT IT_HAULTTABLE with control HAULTTABLE.

 endloop.

I tried that and nothing (I do have IT_HAULTTABLE FILLED) was put on the screen. How do I fill the screen with existing data (like you would have in ME22n/ME23n)?

Regards,

Davis

12 REPLIES 12

Former Member
0 Kudos

Hi

Where have u defined HAULTTABLE?

U should have a defination like this:

CONTROLS HAULTTABLE TYPE TABLEVIEW USING SCREEN <screen number>.

Max

0 Kudos

OK, thanks. I saw that in the documentation but I thougth maybe it was already defined being that I had it on the screen. I'll try that and get back to the thread with points.

Davis

0 Kudos

Hi

Only if u use WIZARD in order to create a table control all definitions are done automatically, but if u need to create the table control by yourself, u need to define all variables too.

Max

Former Member
0 Kudos

OK, one more part to this question. How do I get data into the table in the PBO routine? All of the posts I have seen on SDN simply has something like the following:

 loop AT IT_HAULTTABLE with control HAULTTABLE.

 endloop.

I tried that and nothing (I do have IT_HAULTTABLE FILLED) was put on the screen. How do I fill the screen with existing data (like you would have in ME22n/ME23n)?

Regards,

Davis

0 Kudos

Hi

It depends on how you have designed the input/output fields of table control: which structure or fields have u used to design it?

If you have directly used the internal table IT_HAULTTABLE, the screen should be filled automatically while looping IT_HAULTTABLE in the PBO, so the LOOP should be enaught:

loop AT IT_HAULTTABLE with control HAULTTABLE.
 
 endloop.

If you have use a different structure, u need to create a module in order to transfer the value from IT_HAULTTABLE to the input/output structure:

loop AT IT_HAULTTABLE with control HAULTTABLE.
   MODULE SHOW_IT_HAULTTABLE.
 endloop.

MODULE SHOW_IT_HAULTTABLE.
 <structure-field1> = IT_HAULTTABLE-field1.
 <structure-field2> = IT_HAULTTABLE-field2.
 <structure-field3> = IT_HAULTTABLE-field3.
 ..................
ENDMODULE.

U need to considere to manage the data from screen to internal table if the user can change the data in the table control. So u need to insert a module to transfer the data from screen to internal table into the loop of PAI

PROCESS PAI.
 loop AT IT_HAULTTABLE.
   MODULE MODIFY_IT_HAULTTABLE.
 endloop.

MODULE MODIFY_IT_HAULTTABLE.
  IT_HAULTTABLE-field1 = <structure-field1>.
  IT_HAULTTABLE-field2 = <structure-field2>.
  IT_HAULTTABLE-field3 = <structure-field3>.
 ..................
  MODIFY IT_HAULTTABLE INDEX HAULTTABLE-CURRENT_LINE.
ENDMODULE.

Max

0 Kudos

Oh, great, thanks! I was using a DB table as the structure. I wasn't sure how to fill the data of that structure. Your example helped and I am now getting the data to come in.

I believe this will solve all of my issues!

Thanks again,

Davis.

0 Kudos

OK, Max, I think this is the last issue with it.

I fill the table and all is good. However, how can I allow the user to add another line to this table? The empty lines are grayed out so the user can't enter data into them. I have ensured that the table is set for input/output both.

Regards,

Davis

0 Kudos

Try this way


  describe table i_temp lines lin.
  tabcntl-lines = lin + 10.  " By default it will add 10 extra lines in editable mode
  loop at i_temp with control tabcntl.
    ...
    ...
    ...
  endloop.

0 Kudos

Thanks, a®s, I was just hoping that there was another way. I guess this is the only way to do it?

Regards,

Davis

0 Kudos

I could not find any other way

Here is the SAP documentation says

Controls the scroll bar of the table control. At LOOP without internal table, LINES has the initial value zero and must be set in the program so that the scroll bar can be used. At LOOP AT itab the system sets this component to the number of rows of the internal table, whenever the table control is processed for the first time. The initialization event of a table control is not determined uniquely. If the corresponding internal table is not fully created at this event, then the LINES variable receives an incorrect value. If LINES in the LOOP loop is smaller as the number of rows of the internal table, then the table control contains blank rows at the end.

Therefore you should always set the LINES component explicitly in the ABAP program, including at LOOP AT itab. In this way you have full control over the dimensions of the vertical scroll bar and so can control the number of rows that are ready for input. Initialization should usually occur at PBO directly before the LOOP statement for the table control.

http://help.sap.com/saphelp_nw04s/helpdata/en/9f/dbac9f35c111d1829f0000e829fbfe/frameset.htm

0 Kudos

Well thanks for confirming that there isn't another way. I was hoping that the documentation was simply wrong, as it is in many instances. Say, have you used this user exit? If so, is there a way to make the height of the customer data tab larger? It will hardly fit two table lines as is.

Davis

0 Kudos

I have not worked on this.

But looks like its a subscreen , so you cannot do much screen alignment here.

Still you want much larger screen, may place a button inside the subscreen and while press the button call a custom screen.