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 issue

former_member659396
Participant
0 Likes
1,328

Dear friends

I am having an issue with table control,when i enter data in table conrol and press enter data dos not remain there means table control fields does not show any data after pressing enter...

what shall i do to keep my entered data in table control as it is.

regards

Rohan

11 REPLIES 11
Read only

tarangini_katta
Active Contributor
0 Likes
1,273

Hi,

After displaing the screen.

After ur entering data pass ur data to the ur table control fields they ur data wont't be clear after the user command.

Thanks

Read only

0 Likes
1,273

Hi thanks for the reply

can you please give me one example...i am not clear

Read only

0 Likes
1,273

in flow logic..

in PAI.

loop at itab.

module append.

endloop.

in driver program....

module append.

append itab.

endmodule.

Read only

0 Likes
1,273

Stil Its not working

i am sending coding please see whether its correct or not

Flow Logic

PROCESS BEFORE OUTPUT.

Loop at Itab

WITH CONTROL tab

CURSOR Ztab-CURRENT_LINE.

endloop.

MODULE STATUS_1000.

*

PROCESS AFTER INPUT.

MODULE USER_COMMAND_1000.

loop at itab.

module append.

endloop.

Coding

PROGRAM ZRB_TABLECONT.

tables: mara.

TYPES:begin of st,

matnr type mara-matnr,

ersda type mara-ersda,

ernam type mara-ernam,

laeda type mara-laeda,

aenam type mara-aenam,

end of st.

data:itab type table of st,

wa TYPE st.

&----


*& Module STATUS_1000 OUTPUT

&----


  • text

----


MODULE STATUS_1000 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

ENDMODULE. " STATUS_1000 OUTPUT

&----


*& Module USER_COMMAND_1000 INPUT

&----


  • text

----


MODULE USER_COMMAND_1000 INPUT.

mara-matnr = wa-matnr.

mara-ersda = wa-ersda.

mara-ernam = wa-ernam.

mara-laeda = wa-laeda.

mara-aenam = mara-aenam.

stop.

*append wa to itab.

modify itab from wa.

ENDMODULE.

module append.

mara-matnr = wa-matnr.

mara-ersda = wa-ersda.

mara-ernam = wa-ernam.

mara-laeda = wa-laeda.

mara-aenam = mara-aenam.

stop.

*append wa to itab.

modify itab from wa.

endmodule. " USER_COMMAND_1000 INP

Read only

tarangini_katta
Active Contributor
0 Likes
1,273

Hi,

In PAI.

PROCESS AFTER INPUT

MODULE mod AT EXIT-COMMAND.

LOOP AT itab_table or LOOP "depending on whether we are using AT int_table

MODULE modify_int_table.

ENDLOOP.

MODULE user_command.

In the MODULE call modify_int_table we can use

MODIFY int_table FROM workarea INDEX tab_con-CURRENT_LINE

or we can use

int_table-field_name = screen_field_name.

I hope this will helpful to you.

Thanks,

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,273

Hi,

What you are doing is when you hit ENTER then a user command is executed, PBO is executed and then table control is cleared.

So, you need to read the internal table in the PBO of the screen.

Use this code, its working:-

it_zekpo is my internal table w/o header line,

wa_zekpo is work area.

Name of input/output fields on screen are:-

wa_zekpo-field1,

wa_zekpo-field2, and so on...

At screen flow-logic


PROCESS BEFORE OUTPUT.
*  MODULE status_8003.
 
  LOOP WITH CONTROL po_tb.
    MODULE read_data.
  ENDLOOP.
 
PROCESS AFTER INPUT.
*  MODULE user_command_8003.
 
  LOOP WITH CONTROL po_tb.
    MODULE insert_data.
  ENDLOOP.
 
  MODULE save_data.

In PBO,


*&---------------------------------------------------------------------*
*&      Module  READ_DATA  OUTPUT
*&---------------------------------------------------------------------*
MODULE read_data OUTPUT.
  READ TABLE it_zekpo INTO wa_zekpo INDEX po_tb-current_line. "po_tab is table control name
ENDMODULE.                 " READ_DATA  OUTPUT

In PAI,


*&---------------------------------------------------------------------*
*&      Module  INSERT_DATA  INPUT
*&---------------------------------------------------------------------*
MODULE INSERT_DATA INPUT.
  APPEND WA_ZEKPO TO IT_ZEKPO.
ENDMODULE.                 " INSERT_DATA  INPUT
 
*&---------------------------------------------------------------------*
*&      Module  SAVE_DATA  INPUT
*&---------------------------------------------------------------------*
MODULE SAVE_DATA INPUT.
  DATA : A LIKE SY-DBCNT.
  OK_CODE = SY-UCOMM.
  CASE OK_CODE.
    WHEN 'SAVE'.
      MODIFY ZEKPO FROM TABLE IT_ZEKPO. "update db table from internal table
      A = SY-DBCNT.
      IF SY-SUBRC = 0.
        MESSAGE S008 WITH A. "success message with no of records modified
      ENDIF.
  ENDCASE.
ENDMODULE.                 " SAVE_DATA  INPUT

Use this code, it will solve your problem.

Thanks & Regards,

Tarun Gambhir

Edited by: Tarun Gambhir on Jan 12, 2009 3:29 PM

Read only

Former Member
0 Likes
1,273

Hello Pramod.

try this code.



**TOP INCLUDE.

CONTROLS: tab_clc TYPE TABLEVIEW USING SCREEN '9002'.       " creating a table view for control

TYPES: BEGIN OF t_itab,                " creating structure for TABLE CONTROL table
       iwerk TYPE t352r-iwerk,       "PLANNING PLANT NUMBER
       revnr TYPE t352r-revnr,       "REVISION NUMBER  AND FOR REVISION POSITION
       revtx TYPE t352r-revtx,        " REVISION NUMBER'S DESCRIPTION.
       revab TYPE t352r-revab,        " REVISION COMPLETED (CHECK BOX).
       revbd TYPE t352r-revbd,         " REVISION START DATE.
       revbz TYPE t352r-revbz,         " REVISION START TIME.
       reved TYPE t352r-reved,         " REVISION END DATE.
       revez TYPE t352r-revez,         " REVISION END TIME.
       flag(1) ,
       END OF t_itab.                        "END OF ITAB


DATA: it_revision  TYPE STANDARD TABLE OF t_itab,  " INTERNAL TABLE FOR DISPLAYING DATA
      wa_rev TYPE t_itab.                       "WORK AREA FOR DISPLAYING DATA INTO TABLE CONTROL



MODULE getdata OUTPUT.

  "USE TO SELECT RECORD FROM DATA BASE TABLE TO REVISION.

  DATA: h_line TYPE i.  " FOR horizontal ARROW

  IF v_chk EQ ' ' OR v_flag = 1.

    • & ...............

**& "SELECT QUERY FOR POPULATING RECORD INTO T352R.

**&..................


       SELECT iwerk revnr revtx revab INTO TABLE it_revision FROM t352r ORDER BY revnr ASCENDING.
       v_flag = 0.
  ENDIF.
  v_chk = 'X'.   "FOR CHECK BOX.

SORT it_revision by revnr Ascending.

  DESCRIBE TABLE it_revision LINES h_line.
  tab_clc-lines = h_line + 5.


ENDMODULE.                 " GETDATA  OUTPUT


----


***INCLUDE MZ_PM_REV_PASSDATAO01 .

----


&----


*& Module PASSDATA OUTPUT

&----


  • text: This module is working for dispaying the discription and check box in

  • input mode if plant id and revision number is given.and the rest of the field

  • in which there is no revision number and plant id that field will get open for out put only.

----



MODULE PASSDATA OUTPUT.

  READ TABLE it_REVISION INTO WA_REV INDEX TAB_CLC-CURRENT_LINE.

ENDMODULE.     

MODULE user_command_9002 INPUT.

*&--------------------------
*  Modifying internal table with table control current line.
*&---------------------------
 

MODIFY it_revision INDEX tab_clc-current_line FROM wa_rev.

ENDMODULE. " USER_COMMAND_9002 INPUT

Hope this code will complete your requirment.

Thanks.

Arun Kayal.

Read only

Former Member
0 Likes
1,273

Hi ,

Do the following things in your PBO and PAI event of screen .

PROCESS BEFORE OUTPUT.

module call_screen .

Module LINES .

LOOP AT IT_CIVIL WITH CONTROL TCVLAB CURSOR

TCVLAB-CURRENT_LINE .

ENDLOOP .

PROCESS AFTER INPUT.

chain .

field IT_CIVIL-CIVILIND .

field IT_CIVIL-NAME_TEXT1 .

field IT_CIVIL-SUBCONT1 .

field IT_CIVIL-NAME_TEXT2 .

field IT_CIVIL-SUNCONT2 .

module modify_civil_DATA .

endchain .

*****************************************************

modules :

IN PBO

MODULE LINE OUTPUT .

DESCRIBE IT_CIVIL LINES LIN .

TCvLAB-LINES = LIN .

ENDMODULE .

IN PAI :

MODULE MODIFY_CIVIL_DATA INPUT.

clear : wa_civ .

move-corresponding it_civil to wa_civ .

read table it_civil index 1 .

if sy-subrc = 0 .

modify it_civil index 1 from wa_civ .

else .

append it_civil .

clear : it_civil .

endif .

******************************

YOUR PROB WILL SOLVED .

PLEASE REWARDS IF SATISFIED .

REGARD'S

NILESH JAIN

Read only

tarangini_katta
Active Contributor
0 Likes
1,273

Hi,

I think where ur doing mistake is u need to pass the screen field value to the wa and then append it to itab and then modify the itab.

but u r passing wa value to the screen field.

Just check once.

Thanks,

Read only

tarangini_katta
Active Contributor
0 Likes
1,273

Hi,

I think where ur doing mistake is u need to pass the screen field value to the wa and then append it to itab and then modify the itab.

but u r passing wa value to the screen field.

just look at the below link it will give u some idea.

http://sap.niraj.tripod.com/id29.html

Just check once.

Thanks,

Read only

former_member659396
Participant
0 Likes
1,273

THANKS