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

table control problem

Former Member
0 Likes
1,587

Hi Friends,

Iam doing table control programming, where iam populating the internal tbale entries to table control.

it working table control is populting the internal table entries, in those table table control entries am

select one entry it shoild copy screen .

i am unable copy to screen from table control, in my problem the cusrsor is not going user command module in PAI..

My screen code:

PROCESS BEFORE OUTPUT.

MODULE status_0500.

LOOP AT icustomer WITH CONTROL tctrl_custlist

CURSOR tctrl_custlist-current_line.

MODULE fill_table_control.

ENDLOOP.

PROCESS AFTER INPUT.

MODULE exit AT EXIT-COMMAND.

LOOP AT icustomer.

MODULE read_table_control.

ENDLOOP.

MODULE user_command_0500.

Pls help

Thanks

Jagadeesh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
894

Hi,

Are you trying to copy the entire screen in the Table Control? Can you explain the requirement a bit more clearly.

Thanks,

Samantak.

6 REPLIES 6
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
894

Hi,

Can you please explain your requirement in detail.

Regards,

Tarun

Read only

Former Member
0 Likes
895

Hi,

Are you trying to copy the entire screen in the Table Control? Can you explain the requirement a bit more clearly.

Thanks,

Samantak.

Read only

0 Likes
894

Hi,

Let me explain my requirement in more detail.

I have screen 200 in which there is one screen field End_customer.

I have another screen 500 in which i have a table control, in table control i am able to see the populated

entries from internal table, now when i select a particular entry in the table control, the same should come be populated in screen 200 in field End_customer. for this i have a push button in table control,

after selecting an entry in table control and pressing the push button, I am not getting the value to field End_customer in screen 200. It is giving an error saying that 'Invalid field format(screen error).

Read only

0 Likes
894

Hi,

Invalid field format error occurs because of type mismatch problem. Try making the TYPE of END_CUSTOMER as 'C' or 'N'.

Hope this helps.

Regards,

Deepthi.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
894

Hi,

Say you have screen 8001 with screen field sc_ebeln that acts as a parameter to fetch records from database table into table control on screen 8002 and you also have a screen field sc_ebelp for line item.

Now when data is displayed in table control based on the parameter value of ebeln and you select a row and click BACK button to move to previous screen, then display the selected corresponding value of field ebelp in the previous screen field.

Use this code, to use the selection column in the table control, and fetch values.

Take selection column name in the table control attributes as wa_ekpo-flag

TOP Module


program  sapmz_tabctrl message-id zmsg.
 
CONTROLS : po_tab TYPE TABLEVIEW USING SCREEN '8002'. "table control
 
TYPES : BEGIN OF t_ekpo,
          ebeln TYPE ekpo-ebeln,
          ebelp TYPE ekpo-ebelp,
          matnr TYPE ekpo-matnr,
          werks TYPE ekpo-werks,
          menge TYPE ekpo-menge,
          netpr TYPE ekpo-netpr,
          flag(1), "flag for selection column in table control
        END OF t_ekpo.
 
"check the select column for the table in attributes and name it as wa_ekpo-flag
 
DATA : it_ekpo TYPE STANDARD TABLE OF t_ekpo, "internal table
       wa_ekpo TYPE t_ekpo. "work area

At screen flow logic


PROCESS BEFORE OUTPUT.
  MODULE status_8002.
 
  LOOP WITH CONTROL po_tab. "po_tab is the name of table control on screen
    MODULE pass_data. "pass data from internal table into table control on screen
  ENDLOOP.
 
PROCESS AFTER INPUT.
  MODULE user_command_8002.
 
  LOOP WITH CONTROL po_tab. "po_tab is the name of table control on screen
    MODULE modify_data. "modify data into the internal table from table control
  ENDLOOP.

PBO Module


MODULE status_8002 OUTPUT.
  SET PF-STATUS 'ZTG_SELTB'.
  DATA : line_count TYPE i.
 
  DESCRIBE TABLE it_ekpo
  LINES line_count.
  po_tab-lines = line_count + 5.
ENDMODULE.                 " STATUS_8002  OUTPUT
 
MODULE pass_data OUTPUT.
  READ TABLE it_ekpo into wa_ekpo INDEX po_tab-current_line.
ENDMODULE.                 " PASS_DATA  OUTPUT

PAI Module


MODULE USER_COMMAND_8002 INPUT.
  OK_CODE = SY-UCOMM.
  CASE OK_CODE.
    WHEN 'BACK'.
      READ TABLE IT_EKPO INTO WA_EKPO WITH KEY FLAG = 'X'.
      if sy-subrc eq 0.
        wa_ekpo-ebelp = sc_ebelp. "assign value to screen field
      endif.
      LEAVE TO SCREEN 8001.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_8002  INPUT
 
MODULE MODIFY_DATA INPUT.
  MODIFY IT_EKPO INDEX PO_TAB-CURRENT_LINE FROM WA_EKPO.
ENDMODULE.                 " MODIFY_DATA  INPUT

Hope this solves your problem.

Thanks & Regards

Tarun Gambhir

Read only

Former Member
0 Likes
894

Hi,

if you need a single field value from table control then try this...

In PAI..

case ok_code.
when 'GET'.
      GET CURSOR FIELD fname VALUE value.
      MOVE : value TO mara-matnr.   ----->  here mara-matnr is the field in screen 200.
      CALL SCREEN 200.
endcase.

here you need to place the cursor on that perticular field.

Edited by: Sathish Reddy on Feb 6, 2009 3:32 PM