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

ABAP Screen: Implicit transferring fields / LOOP AT TC

Weiskopf
Participant
0 Likes
1,165

Hello experts,

I developed a table control in the following way:

process before output.
  module status_0110.

  loop with control tc_liqivp_items.
    module item_get.
    module screen_modify.
  endloop.

process after input.
  loop with control tc_liqivp_items.
    chain.
      field: gs_liqivp_items-umzeichart,
             gs_liqivp_items-endpa
             module endpa_check on chain-request.
    endchain.

    chain.
      field: gs_liqivp_items-umzeichart,
             gs_liqivp_items-umz_fenster,
             gs_liqivp_items-endpa
             module item_modify on chain-request.
    endchain.
  endloop.

The control is defined as following:

controls: tc_liqivp_items  type tableview using screen 110.

The screen 110 is defined as subscreen.

I use the classical table control (using loop at TCu2026); in PAI the fields will be transferred implicitly from the table control to the assigned structure gs_liqivp_items.

Within the table control loop, however in structure not all fields are filled correctly (some fields comes from the last line of the internal table).

E.g.:
10	Testline1 3.25 CHF	red 	blue
20	Testline1 4.25 CHF	green 	blue
30	Testline1 6.10 CHF	white 	blue
40	Testline1 6.50 CHF	yellow	blue

If I change the value in line 1 from 3.25 to 4.25 CHF also the fields red and blue will be overwritten by the last line. The result is:

10	Testline1 4.25 CHF	yellow	blue
20	Testline1 4.25 CHF	green 	blue
30	Testline1 6.10 CHF	white 	blue
40	Testline1 6.50 CHF	yellow	blue

Only the price field is set as input field.

Do you have any idea for this issue?

Thanks for your support!

Regards,

Kurt

1 ACCEPTED SOLUTION
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,117

Do one thimg you can read your internal table with line nu,ber before appending or modifying the record..please put a debigger and check..please paste the code of where it changes value

Nabheet

5 REPLIES 5
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,118

Do one thimg you can read your internal table with line nu,ber before appending or modifying the record..please put a debigger and check..please paste the code of where it changes value

Nabheet

Read only

Former Member
0 Likes
1,117

Hi,

In PAI  " Flow logic

process after input.
  loop with control tc_liqivp_items.
    chain.
      field: gs_liqivp_items-umzeichart,
             gs_liqivp_items-endpa
             module endpa_check on chain-request.
    endchain.
 
    chain.
      field: gs_liqivp_items-umzeichart,
             gs_liqivp_items-umz_fenster,
             gs_liqivp_items-endpa
             module item_modify on chain-request.
    endchain.
    module move_to_progam.  " Add this in your program
  endloop.

In program  " To Transfer the data of each row of Table control to Internal Table of the Program

MODULE MOVE_TO_PROGAM INPUT. " replace the following variables/Internal Tables with the ones you declared
  DESCRIBE TABLE itab LINES tc-lines.
  if  tc-lines < tc-current_line.
    append gs_liqivp_items to  itab.
  else.
    modify itab from gs_liqivp_items INDEX tc-current_line.
  endif.
ENDMODULE.

Hope this would serve your purpose

Cheerz

Ramchander Rao.K

Read only

surajarafath
Contributor
0 Likes
1,117

I think You have used

module item_get.

in PBO, you might have SQL statements there,

so everytime you enter some thing in the input field (price).

This module item_get is executed and your internal table might be refresehed. I think...

Read only

0 Likes
1,117

Hello,

thank you for your answer:-)

The problem is not the transfer from control to internal table. The problem is the filling of structure gs_liqivp_items.

Curiously, by debugging the flow logic the gs_liqivp_items contains u201Coldu201D values from the prior PBO; within control loop not all fields will be set in structure gs_liqivp_items.

Thanks for your feedback!

Kurt

Read only

0 Likes
1,117

Hi,

Use "corresponding fields of " when you move data from wa like

move corresponding fields of wa to structute_name.

Regards,

Ravi Seela.