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

dialog programming, data being washed out in TAB Control

Former Member
0 Likes
1,174

Hi,

i am working on dialog programming , in which i am using Table Control for user input (data is not coming from database table) . everything is going well till assignment of data to internal table but when

control goes to PBO by any means like pressing ENTER etc. then data being washed out.

PROCESS BEFORE OUTPUT.

MODULE TC_CONTROL.

LOOP AT it_data

INTO wa_data

WITH CONTROL tc_control

CURSOR tc_control-current_line.

MODULE tc_control_get_lines.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP AT IT_DATA.

CHAIN.

FIELD WA_DATA-FREPS_N.

FIELD wa_data-TOEPS_N.

FIELD wa_data-PRCH_A.

FIELD wa_data-SRVC_AMT .

FIELD wa_data-ACCNT_C.

FIELD wa_data-AMT_D.

FIELD wa_data-NARR_X.

FIELD wa_data-CRPRD_N.

MODULE tc_control_modify ON CHAIN-REQUEST.

ENDCHAIN.

ENDLOOP.

*Abap program

MODULE TC_CONTROL OUTPUT.

DESCRIBE TABLE it_data LINES tc_control-lines.

ENDMODULE. " TC_CONTROL OUTPUT

CONTROLS: TC_CONTROL TYPE TABLEVIEW USING SCREEN 1000,

TC_CONTROL1 TYPE TABLEVIEW USING SCREEN 1000.

DATA: G_TC_CONTROLS_LINES LIKE SY-LOOPC,

G_TC_CONTROLS_LINES1 LIKE SY-LOOPC.

&----


*& Module tc_control_get_lines OUTPUT

&----


  • text

----


MODULE tc_control_get_lines OUTPUT.

g_tc_controls_lines = sy-loopc.

move-corresponding it_data to wa_data.

ENDMODULE. " tc_control_get_lines OUTPUT

MODULE tc_control_modify INPUT.

move-corresponding wa_data to it_data.

MODIFY it_data

FROM wa_data

INDEX tc_control-current_line.

append it_data.

clear it_data.

ENDMODULE. " tc_control_modify INPUT

Please suggest me any clue.

Thanks in advance

vijay dwivedi

Hi,

i am working on dialog programming , in which i am using Table Control for user input (data is not coming from database table) . everything is going well till assignment of data to internal table but when

control goes to PBO by any means like pressing ENTER etc. then data being washed out.

PROCESS BEFORE OUTPUT.

MODULE TC_CONTROL.

LOOP AT it_data

INTO wa_data

WITH CONTROL tc_control

CURSOR tc_control-current_line.

MODULE tc_control_get_lines.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP AT IT_DATA.

CHAIN.

FIELD WA_DATA-FREPS_N.

FIELD wa_data-TOEPS_N.

FIELD wa_data-PRCH_A.

FIELD wa_data-SRVC_AMT .

FIELD wa_data-ACCNT_C.

FIELD wa_data-AMT_D.

FIELD wa_data-NARR_X.

FIELD wa_data-CRPRD_N.

MODULE tc_control_modify ON CHAIN-REQUEST.

ENDCHAIN.

ENDLOOP.

*Abap program

MODULE TC_CONTROL OUTPUT.

DESCRIBE TABLE it_data LINES tc_control-lines.

ENDMODULE. " TC_CONTROL OUTPUT

CONTROLS: TC_CONTROL TYPE TABLEVIEW USING SCREEN 1000,

TC_CONTROL1 TYPE TABLEVIEW USING SCREEN 1000.

DATA: G_TC_CONTROLS_LINES LIKE SY-LOOPC,

G_TC_CONTROLS_LINES1 LIKE SY-LOOPC.

&----


*& Module tc_control_get_lines OUTPUT

&----


  • text

----


MODULE tc_control_get_lines OUTPUT.

g_tc_controls_lines = sy-loopc.

move-corresponding it_data to wa_data.

ENDMODULE. " tc_control_get_lines OUTPUT

MODULE tc_control_modify INPUT.

move-corresponding wa_data to it_data.

MODIFY it_data

FROM wa_data

INDEX tc_control-current_line.

append it_data.

clear it_data.

ENDMODULE. " tc_control_modify INPUT

Please suggest me any clue.

Thanks in advance

vijay dwivedi

9 REPLIES 9
Read only

Former Member
0 Likes
1,145

Hi,

Your code part.

MODULE tc_control_get_lines OUTPUT.

g_tc_controls_lines = sy-loopc.

move-corresponding it_data to wa_data.

ENDMODULE. " tc_control_get_lines OUTPUT

Why you have move-corresponding it_data to wa_data ????

Please check that part.

Regards,

Smart Varghese

Read only

Former Member
0 Likes
1,145

Hi

Please delete this line .

*-----

append it_data.

clear it_data.

*-----

MODULE tc_control_modify INPUT.

move-corresponding wa_data to it_data.

MODIFY it_data

FROM wa_data

INDEX tc_control-current_line.

append it_data. "<---

clear it_data. "<---

ENDMODULE. " tc_control_modify INPUT

Read only

Former Member
0 Likes
1,145

Hi,

Define the internal table and work area as global data declarations.

Check whether the field names of table control in the screen painter is same as the one you have mapped in PBO (WA_DATA).

Read only

Former Member
0 Likes
1,145

Hi,

Try repopulating the data in the PBO as well. I am sure your internal table would have values once it reaches the PBO.

Edited by: Nitwick on May 28, 2009 9:20 AM

Read only

Former Member
0 Likes
1,145

Hi,

Please remove this line.

g_tc_controls_lines = sy-loopc

Aswarth

Read only

Former Member
0 Likes
1,145

Hi,

U put the condition at PBO ...

For example: if not it[] is initail.

******check*********

endif.

Regards,

Naveen M.

Read only

Former Member
0 Likes
1,145

Hi ,

I have made some changes to your code , check this --

MODULE tc_control_modify INPUT.
move-corresponding wa_data to it_data.
MODIFY it_data
*FROM wa_data " Commented
INDEX SY-STEPL.  " SY-STEPL
*append it_data. ommented
clear it_data.

Regards

Pinaki

Read only

0 Likes
1,145

Hi,

probelm is not here because here our purpose is to store the data in internal table only.

i am facing the problem when data is going back to screen in PBO, there also data in internal exist but when i try to assign it to screen field structure then data is being overlap and loop is running as many times as i have the rows in my table control. so when i input 2 rows entry in my table control.

then loop run by 3 times each time data is going into wa_itab but it washed in next loop pass.

and finally i get the clean sweap.

MODULE tc_control_modify INPUT.

move-corresponding wa_data to it_data.

MODIFY it_data

*FROM wa_data " Commented

INDEX SY-STEPL. " SY-STEPL

*append it_data. ommented

clear it_data.

Regards

vijay

Read only

0 Likes
1,145

Hi ,

I have understood the problem.

In your ABAP code replace all the occurrrences of wa_data with the structurename.

Use the TABLES keyword to declare the structure .That structure will be same as

reference table of the table control .

Here the structure is SPFLI.

Check the bellow code , it will resolve the issue.

ABAP code - -

program  zsdn.
tables spfli.  " Declare the structure
data : it_data like table of spfli with header line,
*wa_data TYPE spfli,  " commented
w_i type i.
*CONTROLS TC_CONTROL TYPE TABLEVIEW USING SCREEN 100.

controls: tc_control type tableview using screen 1000,
tc_control1 type tableview using screen 1000.

data: g_tc_controls_lines like sy-loopc,
g_tc_controls_lines1 like sy-loopc.


module tc_control output.
  describe table it_data lines tc_control-lines.

endmodule. " TC_CONTROL OUTPUT


module tc_control_get_lines output.

  g_tc_controls_lines = sy-loopc.

  move-corresponding it_data to spfli.


endmodule. " tc_control_get_lines OUTPUT



module tc_control_modify input.
  move-corresponding spfli to it_data.
  modify it_data
  from spfli
  index tc_control-current_line.
  append it_data.
  clear it_data.


endmodule. " tc_control_modify INPUT

module status_0100 output.
  set pf-status 'STAT'.
*  SET TITLEBAR 'xxx'.

endmodule.                 " STATUS_0100  OUTPUT

module user_command_0100 input.
  case sy-ucomm.
    when 'BACK' or 'EXIT' or 'CANCEL'.
      leave to screen 0.
  endcase.

endmodule.                 " USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*&      Module  POPLATE_TABLE  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module poplate_table output.
  if it_data is initial.
    select * from spfli into table it_data.
  endif.
endmodule.                 " POPLATE_TABLE  OUTPUT

Screen code (Scr no 1000) - -

PROCESS BEFORE OUTPUT.
  MODULE status_0100.
  MODULE poplate_table.

  MODULE tc_control.
  LOOP AT it_data WITH CONTROL tc_control CURSOR w_i.
    MODULE tc_control_get_lines.
  ENDLOOP.
*
PROCESS AFTER INPUT.
  MODULE user_command_0100.


  LOOP AT it_data.

    MODULE tc_control_modify ON CHAIN-REQUEST.
*    ENDCHAIN.
  ENDLOOP.

Regards

Pinaki