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

help need

Former Member
0 Likes
765

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
741

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.

6 REPLIES 6
Read only

Former Member
0 Likes
742

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.

Read only

Former Member
0 Likes
741

Hello Srivali,

<b>Use MODIFY I_MARA FROM WA_MARA.</b>

If useful reward.

Vasanth

Read only

Former Member
0 Likes
741

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

Read only

Former Member
0 Likes
741

U are appending the record.Instead of that use Modify statment.

Regards

Read only

Former Member
0 Likes
741

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

Read only

Former Member
0 Likes
741

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