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

modifications on table control

Former Member
0 Likes
748

Hi All,

Please any one help me onthis topic.

In table control i have a column t_item-Serial Number(t_item is internal table ).

I need to chage or modify the Serial Numbers by overtyping the existing Serial Number.when i press enter the modified serial number has to be updated in the data base table and in the table conrol .

I already posted this topic in SDN forum and i received 4 Replies but i did't understand that.

Can any one send me the coding with explanation.

Thanaks in Advance.

Thanks&Regards.

Ramu.

6 REPLIES 6
Read only

dani_mn
Active Contributor
0 Likes
701

HI,

Put a loop endloop statement in your PAI, and add a module for modification in table control.

"IN PAI FLOW LOGIC"

 loop at itab.
    chain.
      field  itab-bpsg.
      field  itab-bpsc.
      field  itab-bpsd.
      field  itab-total.
      field  itab-filled.
      field  itab-vacant.
      field  itab-s.

      module zbpsgtable_modify on chain-request.
    endchain.

"IN MODULE POOL PROGRAM"

module zbpsgtable_modify input.

modify itab

index ztablecontrol-current_line.

endmodule.

for modification in database table. use

MODIFY database_table FROM table itab.

Regards,

Read only

Former Member
0 Likes
701

Hi

In the LOOP/ENDLOOP of PAI process you should insert a module to update your internal table, in this way you can store the modification:

PROCESS PAI

LOOP...

MODULE MODIFY_T_ITEM.

ENDLOOP.

MODULE MODIFY_T_ITEM.

  • You need this code only if the output fields have

  • different name from fields of T_ITEM

T_ITEM-SERIAL_NUMBER = <OUTPUT FIELD>.

  • This code is always necessary

MODIFY T_ITEM INDEX <TABLE CONTROL>-CURRENT_LINE.

ENDMODULE.

In user-coomad you have to insert the code to update the database.

MODULE USER_COMMAND.

CASE OK_CODE.

WHEN '...'.

UPDATE <TABLE> FROM TABLE T_ITEM.

ENDCASE.

ENDMODULE.

Max

Read only

anversha_s
Active Contributor
0 Likes
701

hi,

kindly chk this sample code. will hlp u alot.

PROCESS BEFORE OUTPUT.

MODULE status_9010.

LOOP WITH CONTROL tab_control.

MODULE move_data_to_table.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP WITH CONTROL tab_control.

MODULE move_data_from_table.

ENDLOOP.

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

&----


*& Module move_data_to_table OUTPUT

&----


  • This is to move the data from the internal table to the table control

----


MODULE move_data_to_table OUTPUT.

  • This is to move the data from the internal table to the table control

zmpets_mode-modecode,zmpets_range-rangeid,zmpets_servfacto-factor are column name of table control

READ TABLE int_factor INDEX tab_control-current_line.

IF sy-subrc = 0.

zmpets_mode-modecode = int_factor-modecode.

zmpets_range-rangeid = int_factor-rangeid.

zmpets_servfacto-factor = int_factor-factor.

ENDIF.

ENDMODULE. " move_data_to_table OUTPUT

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

&----


*& Module move_data_from_table INPUT

&----


  • Date is moved from the table control to the Internal Table

----


MODULE move_data_from_table INPUT.

  • To move the data from the table control to internal table 'INT_FACTOR'.

int_factor-modecode = zmpets_mode-modecode.

int_factor-rangeid = zmpets_range-rangeid.

int_factor-factor = zmpets_servfacto-factor.

*here if the data is there, it will modify

MODIFY int_factor INDEX tab_control-current_line.

IF sy-subrc NE 0. "data not exixting in table control . ie new data, then append it

APPEND int_factor.

CLEAR int_factor.

ENDIF.

ENDMODULE. " move_data_from_table INPUT

for any clarifiaction pls mail me.

pls reward points, if this helped u.

regards,

anversha.

anversha.shahul@wipro.com

Read only

Former Member
0 Likes
701

hi,

Its very simple.

suppose your have screen 100 with table control


in pai
  loop at IT_CONF.
    chain.
      field X_CONF-EBTYP.
      field X_CONF-EINDT.
      field X_CONF-LPEIN.
      field X_CONF-UZEIT.
      field X_CONF-ERDAT.
      field X_CONF-MENGE.
      field X_CONF-XBLNR.
      module TC_CONF_modify on chain-request. "this will take the new value(say serial no) that you have update in the table control

    endchain.
  endloop.
 module user_command_100." this module captures sy-ucomm

in PBO. " the updated value in it_conf_new will get displayed in the tableControl
  loop at   IT_CONF_new
       into X_CONF
       with control TC_CONF
       cursor TC_CONF-current_line.
    module TC_CONF_get_lines.
   endloop.

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

in program

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

 module TC_CONF_modify."this module will modify your internal table with the new value from the table control.
  it_conf_new[] = it_conf[]. 
    modify it_conf_new
      from x_conf
      index tc_conf-current_line.
endmodule.
module user_command_100.
 case sy-ucomm.
  when ' '. "on hitting enter the sy-ucomm value is space
"    update the database table with the new values using the table it_conf_new by calling some FM.
   exit.
 endcase.
endmodule.
module tc_conf_get_lines output.
  g_tc_conf_lines = sy-loopc.
endmodule.

Regards,

Richa

Read only

0 Likes
701

Hi Richa,

I need some clarifications.

Where I need to write the chain and endchain in flow logic or ABAP EDITOR.

loop at IT_CONF.( This is internal table related to table control)

chain.

field X_CONF-EBTYP.( But I did't get this one)

field X_CONF-EINDT.

field X_CONF-LPEIN.

field X_CONF-UZEIT.

field X_CONF-ERDAT.

field X_CONF-MENGE.

field X_CONF-XBLNR.

endchain.

Can u Please Elaborate this.

Thanks&Regards.

Ramu.

Read only

0 Likes
701

Hi

CHAIN/ENDCHAIN is a statament only for flow logic of the dynpro:

PROCESS PAI.

loop at IT_CONF.

*( This is internal table related to table control)

chain.

field X_CONF-EBTYP.( But I did't get this one)

field X_CONF-EINDT.

field X_CONF-LPEIN.

field X_CONF-UZEIT.

field X_CONF-ERDAT.

field X_CONF-MENGE.

field X_CONF-XBLNR.

endchain.

MODULE MODIFY_IT_CONF.

ENDLOOP.

MODULE MODIFY_IT_CONF.

IT_CONF-EBTYP = X_CONF-EBTYP.

IT_CONF-EINDT = X_CONF-EINDT.

IT_CONF-LPEIN = X_CONF-LPEIN.

IT_CONF-UZEIT = X_CONF-UZEIT.

IT_CONF-ERDAT = X_CONF-ERDAT.

IT_CONF-MENGE = X_CONF-MENGE.

IT_CONF-XBLNR = X_CONF-XBLNR.

MODIFY IT_CONF INDEX <TABLE CONTROL>-CURRENT_LINE.

ENDMODULE.

Max