‎2006 Sep 13 11:13 AM
hi friends,
Could u please help me how to do this
LOOP AT i_mara INTO wa_mara..
IF sy-subrc = 0.
TRANSLATE wa_mara-matnr USING '- '.
CONDENSE wa_mara-matnr no-gaps.
append wa_mara to i_mara.
the above statement in i_mara internal table it Contains data like this
i_mara
100-200
300-400
400-500
when it moves the Translate statement it remove the '-'
ex:100 200
then condence is removing the gaps '100200'
after that i need to display '100200' replace of '100-200'
but it displaying
100-200
300-400
400-500
100200
finally i need output like this
100200
300400
400500
Could u please help me how to di this
Regards
srilavi
‎2006 Sep 13 11:24 AM
Hi srilvi,
Try following code
LOOP AT i_mara INTO wa_mara.
IF sy-subrc = 0.
TRANSLATE wa_mara-matnr USING '- '.
CONDENSE wa_mara-matnr no-gaps.
modify i_mara from wa_mara index sy-tabix.
endif.
endloop.
‎2006 Sep 13 11:24 AM
Hi srilvi,
Try following code
LOOP AT i_mara INTO wa_mara.
IF sy-subrc = 0.
TRANSLATE wa_mara-matnr USING '- '.
CONDENSE wa_mara-matnr no-gaps.
modify i_mara from wa_mara index sy-tabix.
endif.
endloop.
‎2006 Sep 13 11:24 AM
Hello Srivali,
<b>Use MODIFY I_MARA FROM WA_MARA.</b>
If useful reward.
Vasanth
‎2006 Sep 13 11:25 AM
HI,
instead of append use modify .
LOOP AT i_mara INTO wa_mara..
IF sy-subrc = 0.
TRANSLATE wa_mara-matnr USING '- '.
CONDENSE wa_mara-matnr no-gaps.
<b>move wa_mara to i_mara.
modify i_mara.</b>
endif.
endloop.
Regrads,
Amole
‎2006 Sep 13 11:27 AM
U are appending the record.Instead of that use Modify statment.
Regards
‎2006 Sep 13 11:27 AM
you should use MODIFY
LOOP AT i_mara INTO wa_mara..
IF sy-subrc = 0.
TRANSLATE wa_mara-matnr USING '- '.
CONDENSE wa_mara-matnr no-gaps.
<b>append wa_mara to i_mara. <-- IS WRONG
MODIFY I_MARA FROM WA_MARA TRANSPORTING MATNR.</b>
ENDLOOP.
You are doing the changes only at work area of that internal table(WA_MARA).if you want these changes to be reflected at I_MARA entries,you should modify the records from the work area WA_MARA.
the problem with your code is you are APPENDING a record.instead use MODIFY.
Message was edited by: Srikanth Kidambi
‎2006 Sep 13 11:32 AM
Try as the below code
loop at itab.
replace '-' in itab-field with ''.
modify itab.
endloop.
There is no gap between the two cotes.
Thanks
Thirumal