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

To write code in LSMW.

Former Member
0 Likes
1,351

Hello Gurus,

We have created LSMW, in which when we upload the file, the file which we are uploading contains the entry of MAKTX field in double quotes only, thats why in the MAKTX field we are getting the string with double quotes, which is causing the problem.

So in the field mapping , we want to remove the double quotes for the field in LSMW.

For example : the line is "7"" casting test"".

we want to remove the first and last double quote from the value of MAKTX in lsmw.

Please let me know how we can write the code to remove this double quote from the string for the field MAKTX in LSMW?

Thanks

9 REPLIES 9
Read only

Former Member
0 Likes
1,211

Hi,

while mapping the field maktx in lsmw with structure,you can remove the quote and assign the field

Read only

0 Likes
1,211

hello,

The file contains so many entries and user will not going to remove quotes each time he/she upload the data.

So we have to write some code to remove quotes each time we will process the file.

So how can to write the code for the same in field mapping?

Read only

0 Likes
1,211

Go to the field mapping / conversion rules section and just double click in the mapping for MAKTX. There you can add your code.

Read only

0 Likes
1,211

i had written code in the field mapping , in the coding section of MAKTX field, but it does seem to be working.

i had declare the variables and even put the loop statement there, but its not working.

the code is :-

DATA : string(100) TYPE c,

stringf(100) TYPE c,

len TYPE i,

len2 TYPE i,

len3 TYPE i,

count TYPE i,

count2 TYPE i,

l_string(100) TYPE c.

string = bgr001-maktx.

len = strlen( string ).

DO len TIMES.

IF string+count(1) = '"'.

IF stringf = '"'.

len2 = strlen( l_string ).

len3 = len2 - 1.

IF l_string+len3(len2) NE '"'.

l_stringcount2(1) = stringcount(1).

ENDIF.

ENDIF.

ELSE.

l_stringcount2(1) = stringcount(1).

ENDIF.

stringf = string+count(1).

count = count + 1.

count2 = count2 + 1.

ENDDO.

SHIFT l_string LEFT DELETING LEADING space.

bmmh1-maktx = l_string.

can you please tell me how we can debug it?

or is there something wrong in it ?

Read only

0 Likes
1,211

You want to change

"7"" casting test""

into

7 casting test

?

If you want to debug, just hardcode BREAK-POINT in your code.

Read only

0 Likes
1,211

Yes you are correct , i want to change the way you had written , and i also put the break-point statement as well but still it does not stop at that point.

Is that i m missing something or what else is required?

Read only

0 Likes
1,211

My above code is working correctly now, i can see that in display converted data, double quotes gets deleted.

Thank you all for your help.

Read only

Former Member
0 Likes
1,211

I got the answer to my problem.

Read only

0 Likes
1,211

Tip: get rid of all that coding as you can do it with 1 line: it's just confusing.

replace all occurrences of '"' in string with space.