Application Development 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: 

Sample pgm for moving data from table control to internal table

Former Member
0 Kudos

Hi Experts,

I am newbi to ABAP. I don't have good material for Table control . Appreciate if you direct me to some good source of knowledge on Table control.

The problem at hand : I am trying to move info/data from table control (in screen painter/ input and output mode ) to ITAB but couldn't . Sample pgm if possible.

<b>Modify ITAB index TC-Current_Line .</b>

The above statement is not inserting new lines to ITAB . Help me!

Thanks for your time

5 REPLIES 5

Former Member
0 Kudos

in the screen coding..code shud be

PROCESS AFTER INPUT.

LOOP WITH CONTROL TAB_CTRL.

MODULE MODIFY_MOD.

ENDLOOP.

MODULE MODIFY_TTAB.

The modules will have

MODULE MODIFY_MOD INPUT.

MODIFY IT_EKPO FROM WA_EKPO INDEX TAB_CTRL-CURRENT_LINE.

ENDMODULE. " MODIFY_MOD INPUT

MODULE MODIFY_TTAB INPUT.

CASE OK_CODE_0101.

WHEN 'MODI'.

MODIFY Z9EKPO_PRASH FROM TABLE IT_EKPO.

CALL SCREEN 0100.

ENDCASE.

ENDMODULE. " MODIFY_TTAB INPUT

Hope dis helps..

Reward if it does

Former Member
0 Kudos

hi,

do like this...

<b>PROCESS AFTER INPUT.</b>

*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TAB1'

LOOP AT itab_det.

CHAIN.

  • FIELD itab_det-comp_code.

FIELD itab_det-bill_no.

FIELD itab_det-bill_date.

FIELD itab_det-vend_cust_code.

FIELD itab_det-bill_amt.

MODULE <b>tab1_modify</b> ON CHAIN-REQUEST.

ENDCHAIN.

FIELD itab_det-mark

MODULE tab1_mark ON REQUEST.

ENDLOOP.

<b>MODULE tab1_modify INPUT.</b>

APPEND itab_det.

<b>ENDMODULE. "TAB1_MODIFY INPUT</b>

Former Member
0 Kudos

try this out it may help u

loop at itabline.

zg8_ekpo-ebeln = zg8_ekko-ebeln.

zg8_ekpo-ebelp = itabline-ebelp.

zg8_ekpo-matnr = itabline-matnr.

zg8_ekpo-menge = itabline-menge.

zg8_ekpo-meins = itabline-meins.

zg8_ekpo-netpr = itabline-netpr.

zg8_ekpo-waers = itabline-waers.

*Update the entries into item table

modify zg8_ekpo.

endloop.

loop at itabschedule.

zg8_eket-ebeln = zg8_ekko-ebeln.

zg8_eket-ebelp = itabschedule-ebelp.

zg8_eket-etenr = itabschedule-etenr.

zg8_eket-menge = itabschedule-menge.

zg8_eket-eindt = itabschedule-eindt.

*update the entries into schedule table

modify zg8_eket.

endloop.

here itabline and itabschedule are my table controls and zg8_ekko etc are my ddic tables.

reward if u found it useful

Former Member
0 Kudos

In General modify does

INSERT(If new primary key) or UPDATE(if already exisitng primary key)

on a DB- table.

But Modify on Internal TAB can just update and cannot insert. So In this case when we modify the ITAB the sy-subrc is set to 4 . In that case execute an APPEND or INSERT to ITAB(within an IF block) . Thus the current record from Table control is copied to ITAB.