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

Problem is okcode.

Former Member
0 Likes
963

Hi,

I have developed a mod-pool prg with pop-up

tab control .. i am entreing in mod-pool first then in

in pop-up tab control..

my requirement is to save at last after entering in TC.

when i press save ..data in mod-pool is saveed..

But the data in Table-cont is not been ablae to save..

This is multiple-line item mood-pool.

How can i save both data at once..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
915

ABAPER,

see this logic:

report ztest  message-id sabapdocu.
 
data: begin of itab occurs 10,
        mark,
        col1 type i,
        col2 type i,
      end of itab.
 
 
data ok_code type sy-ucomm.
data ok_save type sy-ucomm.
data tab_lines type i.
data step_lines type i.
data offset type i.
 
controls table type tableview using screen 100.
 
call screen 100.
 
module init output.
  set pf-status 'BASIC'.
endmodule.
 
module fill_itab output.
  describe table itab lines tab_lines.
  if tab_lines = 0.
    do 40 times.
      itab-col1 = sy-index.
      itab-col2 = sy-index ** 2.
      append itab.
    enddo.
    describe table itab lines tab_lines.
    table-lines = tab_lines.
  endif.
endmodule.
 
module transp_itab output.
  read table itab index table-current_line.
endmodule.
 
module lines output.
  step_lines = sy-loopc.
endmodule.
 
module exit input.
  leave program.
endmodule.
 
module check_pai input.
  ok_save = ok_code. clear ok_code.
  message s888 with 'TOP_LINE: ' table-top_line
                    ', LINES: '  step_lines.
endmodule.
 
module check_table input.
  case ok_save.
    when 'MARK'.
      if itab-mark = 'X'.
        message i888 with 'Zeile' table-current_line 'markiert'.
      endif.
    when 'SETM'.
      modify itab index table-current_line.
  endcase.
 
endmodule.
 
module check_all input.
  case ok_save.
    when 'ALLM'.
      loop at itab.
        if itab-mark = 'X'.
          message i888 with 'Zeile' sy-tabix 'markiert'.
        endif.
      endloop.
    when 'DELE'.
      loop at itab.
        if itab-mark = 'X'.
          itab-mark = ' '.
          modify itab.
        endif.
      endloop.
  endcase.
endmodule.
 
module scroll input.
  case ok_save.
    when 'PGDO'.
      offset = table-lines - step_lines.
      if table-top_line lt offset.
        table-top_line = table-top_line + step_lines.
      endif.
    when 'PGUP'.
      offset = step_lines.
      if table-top_line gt offset.
        table-top_line = table-top_line - step_lines.
      else.
        table-top_line = 1.
      endif.
    when 'PGLA'.
      table-top_line = table-lines - step_lines + 1.
    when 'PGTO'.
      table-top_line = 1.
  endcase.
endmodule.



And flow logic of screen will be like this:



process before output.
  module  init.
  module fill_itab.
  loop with control table.
    module transp_itab.
    module lines.
  endloop.
 
process after input.
  module exit at exit-command.
  module check_pai.
  loop with control table.
    module check_table.
  endloop.
  module check_all.
  module scroll.

7 REPLIES 7
Read only

Former Member
0 Likes
916

ABAPER,

see this logic:

report ztest  message-id sabapdocu.
 
data: begin of itab occurs 10,
        mark,
        col1 type i,
        col2 type i,
      end of itab.
 
 
data ok_code type sy-ucomm.
data ok_save type sy-ucomm.
data tab_lines type i.
data step_lines type i.
data offset type i.
 
controls table type tableview using screen 100.
 
call screen 100.
 
module init output.
  set pf-status 'BASIC'.
endmodule.
 
module fill_itab output.
  describe table itab lines tab_lines.
  if tab_lines = 0.
    do 40 times.
      itab-col1 = sy-index.
      itab-col2 = sy-index ** 2.
      append itab.
    enddo.
    describe table itab lines tab_lines.
    table-lines = tab_lines.
  endif.
endmodule.
 
module transp_itab output.
  read table itab index table-current_line.
endmodule.
 
module lines output.
  step_lines = sy-loopc.
endmodule.
 
module exit input.
  leave program.
endmodule.
 
module check_pai input.
  ok_save = ok_code. clear ok_code.
  message s888 with 'TOP_LINE: ' table-top_line
                    ', LINES: '  step_lines.
endmodule.
 
module check_table input.
  case ok_save.
    when 'MARK'.
      if itab-mark = 'X'.
        message i888 with 'Zeile' table-current_line 'markiert'.
      endif.
    when 'SETM'.
      modify itab index table-current_line.
  endcase.
 
endmodule.
 
module check_all input.
  case ok_save.
    when 'ALLM'.
      loop at itab.
        if itab-mark = 'X'.
          message i888 with 'Zeile' sy-tabix 'markiert'.
        endif.
      endloop.
    when 'DELE'.
      loop at itab.
        if itab-mark = 'X'.
          itab-mark = ' '.
          modify itab.
        endif.
      endloop.
  endcase.
endmodule.
 
module scroll input.
  case ok_save.
    when 'PGDO'.
      offset = table-lines - step_lines.
      if table-top_line lt offset.
        table-top_line = table-top_line + step_lines.
      endif.
    when 'PGUP'.
      offset = step_lines.
      if table-top_line gt offset.
        table-top_line = table-top_line - step_lines.
      else.
        table-top_line = 1.
      endif.
    when 'PGLA'.
      table-top_line = table-lines - step_lines + 1.
    when 'PGTO'.
      table-top_line = 1.
  endcase.
endmodule.



And flow logic of screen will be like this:



process before output.
  module  init.
  module fill_itab.
  loop with control table.
    module transp_itab.
    module lines.
  endloop.
 
process after input.
  module exit at exit-command.
  module check_pai.
  loop with control table.
    module check_table.
  endloop.
  module check_all.
  module scroll.

Read only

Former Member
0 Likes
915

Hi,

Is it possible to triger two function code at once...

Read only

0 Likes
915

try giving the same function code name two both the buttons...so same one will be triggered wen u will press any of the buttons...Later u can put validations inside the module pool program as per ur requirement

Read only

Former Member
0 Likes
915

Abaper786,

When you are entering the values in table control automatically the internal table is also filled at the same time(You are created the table control for this internal table). Just do one this update the database table with the internal table values when your function code is Save then automatically the values are saved.

See this

if sy-ucomm eq 'SAVE'.
  loop at itab into fs_itab.
    updata dtab from fs_itab ( If you want to insert new entries you can write insert statement here)
  endloop.
endif.

Regards,

Mahi.

Read only

Former Member
0 Likes
915

Hi,

I have use same function code for both

save in include of mod-pool & in inculde of pop-up

table control .but the function code of pop-up tc is not

been able to triger...

can any one help..

Read only

Former Member
0 Likes
915

Hi,

in side the PAI , you have used

loop at itab.

endloop.

right?

inside the loop and endloop ,you have fill the internal table content which are all of input field(dynamically filled by user) use module fill_itab.

in that module write codings like:

module fill_itab.

itab-field1 = screen-field1.(screen field name in the table control )

itab-field2 = screen-field2.(screen field name in the table control )

modify itab.

endmodule

Read only

Former Member
0 Likes
915

Hi

Thanx for ur reply..