2006 Sep 13 10:30 AM
Hi all,
I have a problem which is to be solved urgently.
Please help me out.
I am using hashed table (which i should), and i am in the loop. for some records i have to modify the records in the table. but while i am calling modify it is going to dump.
the code is like this.
LOOP AT t_bsisbsas.
READ TABLE t_bsidbsad6
WITH KEY bukrs = t_bsisbsas-bukrs
gjahr = t_bsisbsas-gjahr
belnr = t_bsisbsas-belnr.
IF sy-subrc EQ 0.
t_bsisbsas-kunnr = t_bsidbsad6-kunnr.
t_bsisbsas-maber = t_bsidbsad6-maber.
MODIFY t_bsisbsas TRANSPORTING maber kunnr.
CLEAR t_bsisbsas.
ELSE.
READ TABLE t_bsidbsad_ob6
WITH KEY bukrs = t_bsisbsas-bukrs
gjahr = t_bsisbsas-gjahr
belnr = t_bsisbsas-belnr.
IF sy-subrc EQ 0.
t_bsisbsas-kunnr = t_bsidbsad_ob6-kunnr.
t_bsisbsas-maber = t_bsidbsad_ob6-maber.
MODIFY t_bsisbsas TRANSPORTING maber kunnr.
CLEAR t_bsisbsas.
ENDIF.
ENDIF.
ENDLOOP.
Thanks in advance,
Umesh Vaidya
2006 Sep 13 10:34 AM
change the modify statement like this and try
MODIFY <b>table</b> t_bsisbsas TRANSPORTING maber kunnr.or
Hi umesh,
1. Minor mistake
2. The problem is with tabix,
which gets modified with the latest value,
when READ is done.
3. so do like this.
4.
<b>DATA : TABIX LIKE SY-TABIX.</b>
LOOP AT t_bsisbsas.
TABIX = SY-TABIX.
******
MODIFY t_bsisbsas <b>INDEX TABIX.</b>
******
MODIFY t_bsisbsas <b>INDEX TABIX.</b>
ENDLOOP.
regards,
amit m.
2006 Sep 13 10:31 AM
1)READ TABLE t_bsidbsad6
WITH <b>table</b> KEY bukrs = t_bsisbsas-bukrs
<b>note.---</b>
HASHED table will not differ in anyway id doing any operations on the table as compared to a standard table. The difference lies in when you have a READ statement the system internally uses a HASH key which will improve the performance.
use like thta..
ex...
read table i_droplist
with table key gpart = p_gpart
vkont = p_vkont.
2006 Sep 13 10:34 AM
Thanks Kishan,
i want to modify the record for which i am in a loop.
please look at code , where i have put "modify".
I am getting dump at there.
Thanks
Umesh Vaidya
2006 Sep 13 10:34 AM
change the modify statement like this and try
MODIFY <b>table</b> t_bsisbsas TRANSPORTING maber kunnr.or
2006 Sep 13 10:34 AM
Hello Umesh,
When u r modifying an hashed table u should not use key tables in the transportation addition.
<b>You may not use a key field as a TRANSPORTING field with HASHED or SORTED tables.</b>
If useful reward.
Vasanth
2006 Sep 13 10:36 AM
LOOP AT t_bsisbsas.
READ TABLE t_bsidbsad6
WITH table KEY bukrs = t_bsisbsas-bukrs
gjahr = t_bsisbsas-gjahr
belnr = t_bsisbsas-belnr.
IF sy-subrc EQ 0.
t_bsisbsas-kunnr = t_bsidbsad6-kunnr.
t_bsisbsas-maber = t_bsidbsad6-maber.
MODIFY table t_bsisbsas TRANSPORTING maber kunnr.
CLEAR t_bsisbsas.
ELSE.
READ TABLE t_bsidbsad_ob6
WITH table KEY bukrs = t_bsisbsas-bukrs
gjahr = t_bsisbsas-gjahr
belnr = t_bsisbsas-belnr.
IF sy-subrc EQ 0.
t_bsisbsas-kunnr = t_bsidbsad_ob6-kunnr.
t_bsisbsas-maber = t_bsidbsad_ob6-maber.
MODIFY table t_bsisbsas TRANSPORTING maber kunnr.
CLEAR t_bsisbsas.
ENDIF.
ENDIF.
ENDLOOP.
2006 Sep 13 10:35 AM
or
you have to use where condition
MODIFY itab TRANSPORTING f1 ... fn WHERE cond.
2006 Sep 13 10:36 AM
Hi Umesh,
try this:
LOOP AT t_bsisbsas.
<b>idx = sy-tabix.</b>
READ TABLE t_bsidbsad6
WITH KEY bukrs = t_bsisbsas-bukrs
gjahr = t_bsisbsas-gjahr
belnr = t_bsisbsas-belnr.
IF sy-subrc EQ 0.
t_bsisbsas-kunnr = t_bsidbsad6-kunnr.
t_bsisbsas-maber = t_bsidbsad6-maber.
<b>MODIFY t_bsisbsas TRANSPORTING maber kunnr index idx.</b>
CLEAR t_bsisbsas.
ELSE.
READ TABLE t_bsidbsad_ob6
WITH KEY bukrs = t_bsisbsas-bukrs
gjahr = t_bsisbsas-gjahr
belnr = t_bsisbsas-belnr.
IF sy-subrc EQ 0.
t_bsisbsas-kunnr = t_bsidbsad_ob6-kunnr.
t_bsisbsas-maber = t_bsidbsad_ob6-maber.
<b>MODIFY t_bsisbsas TRANSPORTING maber kunnr index idx.</b>
CLEAR t_bsisbsas.
ENDIF.
ENDIF.
ENDLOOP.
Regards, Dieter
2006 Sep 13 10:43 AM
Thanks,
but i am using hashed table as i mentioned.
i got the solution.
I have to use
"modify table <tab_name> from <wa> transporting f1,..fn"
Thanks for the answer
Umesh
2006 Sep 13 10:37 AM
hi,
chnage ur code like this.
LOOP AT t_bsisbsas.
READ TABLE t_bsidbsad6
WITH <b>TABLE</b> KEY bukrs = t_bsisbsas-bukrs
gjahr = t_bsisbsas-gjahr
belnr = t_bsisbsas-belnr.
IF sy-subrc EQ 0.
t_bsisbsas-kunnr = t_bsidbsad6-kunnr.
t_bsisbsas-maber = t_bsidbsad6-maber.
ELSE.
READ TABLE t_bsidbsad_ob6
WITH <b>TABLE</b> KEY bukrs = t_bsisbsas-bukrs
gjahr = t_bsisbsas-gjahr
belnr = t_bsisbsas-belnr.
IF sy-subrc EQ 0.
t_bsisbsas-kunnr = t_bsidbsad_ob6-kunnr.
t_bsisbsas-maber = t_bsidbsad_ob6-maber.
ENDIF.
ENDIF.
MODIFY t_bsisbsas TRANSPORTING maber kunnr.
CLEAR t_bsisbsas.
ENDLOOP.
rgds
anver
2006 Sep 13 10:40 AM
Hi umesh,
1. Minor mistake
2. The problem is with tabix,
which gets modified with the latest value,
when READ is done.
3. so do like this.
4.
<b>DATA : TABIX LIKE SY-TABIX.</b>
LOOP AT t_bsisbsas.
TABIX = SY-TABIX.
******
MODIFY t_bsisbsas <b>INDEX TABIX.</b>
******
MODIFY t_bsisbsas <b>INDEX TABIX.</b>
ENDLOOP.
regards,
amit m.
2006 Sep 13 10:46 AM
Thanks Amit for your answer.
But I am using hashed table, where you cant use explicit/implicit index mechanism.
I got the answer from chandrashekar jagarlamudi.
i have to use
"modify table <tab_name> from <wa> transporting f1,...fn."
Thanks
Umesh Vaidya
2006 Sep 13 10:40 AM
Hi,
LOOP AT t_bsisbsas.
READ TABLE t_bsidbsad6
WITH KEY bukrs = t_bsisbsas-bukrs
gjahr = t_bsisbsas-gjahr
belnr = t_bsisbsas-belnr.
IF sy-subrc EQ 0.
t_bsisbsas-kunnr = t_bsidbsad6-kunnr.
t_bsisbsas-maber = t_bsidbsad6-maber.
<b>MODIFY t_bsisbsas .</b>CLEAR t_bsisbsas.
ELSE.
READ TABLE t_bsidbsad_ob6
WITH KEY bukrs = t_bsisbsas-bukrs
gjahr = t_bsisbsas-gjahr
belnr = t_bsisbsas-belnr.
IF sy-subrc EQ 0.
t_bsisbsas-kunnr = t_bsidbsad_ob6-kunnr.
t_bsisbsas-maber = t_bsidbsad_ob6-maber.
<b>MODIFY t_bsisbsas .</b>
CLEAR t_bsisbsas.
ENDIF.
ENDIF.
ENDLOOP.
use modify itab index sy-tabix.
Regards
amole
2006 Sep 13 10:49 AM
Thanks Amole for your answer.
But I am using hashed table, where you cant use explicit/implicit index mechanism.
I got the answer from chandrashekar jagarlamudi.
i have to use
"modify table <tab_name> from <wa> transporting f1,...fn."
Thanks
Umesh Vaidya
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |