2007 Jul 17 11:27 AM
Hi Experts ,
Im having some doubt in logic ??
Example : Im having lot of materials in which some materials are started with AD123456 ..
When iam exexuting a Sapscript on the form it is displyaing the Material no as AD123456
mY qUESTIOM IS when i execute the form the material numbers that are started with AD123456
Should display as AD-123456
iT HAS TO iNCLUDE THE '-' HYPHEN bETWEEN THE AD & 123456...
Not Only for this material this logiC belongs to all the materials that are started with AD & nOT FOR OTHERS
Regs,
Murthy
2007 Jul 17 11:37 AM
Hi,
lat the field is F which is containing the value AD123456 . Now i want it
as AD -123456 .
Code :-
DATA : F1 type C .
concatenate F0(2) ' - ' F2(6) into F1.
WRITE : F1.
Output : AD -123456
Reward points if helpful.
Regards.
Srikanta Gope
Hi,
lat the field is F which is containing the value AD123456 . Now i want it
as AD -123456 .
Code :-
DATA : F1 type C .
concatenate F0(2) ' - ' F2(6) into F1.
WRITE : F1.
Output : AD -123456
Reward points if helpful.
Regards.
Srikanta Gope
2007 Jul 17 11:32 AM
Hi,
suppose material is AD123456 and if AD is fix that means 2 positions are fixed then in drver program
str = AD123456
i = strlen ( str )
concatenate str0(2) '-' str2(i) into str1.
And modify script , if it is standard then copy and assign through NACE.
And at printing time instead of str print STR1.
Reward if useful!
2007 Jul 17 11:34 AM
Hi Murthy,
you may use this in your form definition
/: IF &MATNR+0(2)& = 'AD'
&MATNR+0(2)&-&MATNR+2&
/: ELSE
&MATNR&
/: ENDIF
I hope it helps. Best regards,
Alvaro
2007 Jul 17 11:35 AM
Hello,
Assume your material is in wrk_matnr.
<b>Reward all usefull answers. </b>
Cheers,
Rakesh.
data: wrk_len type i.
data: wrk_result1(2) type c.
data: wrk_result 2(8) type c.
data: wrk_result type mara- matnr
if wrk_matnr+0(2) EQ 'AD'.
wrk_len = strlen ( wrk_matnr ).
wrk_result1 = wrk_matnr+0(2).
wrk_result2 = wrk_matnr+2(wrk_len).
concatenate wrk_result1 '-' wrk_result2 into wrk_result.
endif.
<b></b>
2007 Jul 17 11:37 AM
if str(2) = 'AD'.
concatenate str(2) '-' str+2 into str.
endif.^^^
Note that u <b>can</b> concatenate into the same variable as the original directly
2007 Jul 17 11:37 AM
Hi,
lat the field is F which is containing the value AD123456 . Now i want it
as AD -123456 .
Code :-
DATA : F1 type C .
concatenate F0(2) ' - ' F2(6) into F1.
WRITE : F1.
Output : AD -123456
Reward points if helpful.
Regards.
Srikanta Gope
2007 Jul 17 12:22 PM
REPORT ZTRIPS_TEST .
data:
w_matnr like mara-matnr value 'AD123456'.
write w_matnr.
replace first occurrence of 'AD' in w_matnr WITH 'AD-'.
write:/ w_matnr.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |