‎2010 Jan 15 7:49 PM
Hello,
how is it possible to set a variable of type P empty in SAP?
I have tried allready:
variable = ''.
But the output for my variable will be 0, I just need it to show nothing!
Thanks
Anne
‎2010 Jan 15 7:54 PM
Your question seems pretty basic. Are you asking about how to write it so that no-zero appear??
Rob
‎2010 Jan 15 7:54 PM
Your question seems pretty basic. Are you asking about how to write it so that no-zero appear??
Rob
‎2010 Jan 15 7:55 PM
Yes, correct, I just want nothing to appear, no zeros, just blank. How can I do that?
Thanks
Anne
‎2010 Jan 15 7:56 PM
‎2010 Jan 15 8:02 PM
Hi Rob,
so this is your first response:
"Your question seems pretty basic. Are you asking about how to write it so that no-zero appear??"
I don't really see what I can do, so can you please help me out here?
Thanks
Anne
‎2010 Jan 15 8:12 PM
Press F1 on WRITE and then look at the formatting options.
Rob
‎2010 Jan 15 8:14 PM
‎2010 Jan 15 8:17 PM
F1 will solve a very high percentage of the questions asked here; searching the forums or using Google will get most of the rest.
Glad to help
Rob
‎2010 Jan 15 8:34 PM
Hi Rob,
I am sorry, but it doesn't seem to work for me, I used
write MIXEDPACKS-PACKS1 NO-ZERO.
I debugged it but it is still showing zero in debugging as well as in the output.
Thanks
Anne
‎2010 Jan 15 8:39 PM
‎2010 Jan 15 8:42 PM
*data declaration for #packs
DATA: BEGIN OF MIXEDPACKS,
PACKS1 TYPE P DECIMALS 0,
PACKS2 TYPE P DECIMALS 0,
DATA: END OF MIXEDPACKS.
‎2010 Jan 15 8:51 PM
DATA: BEGIN OF mixedpacks,
packs1 TYPE p DECIMALS 0,
packs2 TYPE p DECIMALS 0.
DATA: END OF mixedpacks.
mixedpacks-packs2 = 5.
WRITE: /001 mixedpacks-packs1 NO-ZERO,
mixedpacks-packs2 NO-ZERO,
mixedpacks-packs1 NO-ZERO,
mixedpacks-packs2 NO-ZERO,
mixedpacks-packs1 NO-ZERO,
mixedpacks-packs2 NO-ZERO.gives:
> 5 5 5
which is I think what you want.
The formatting is not very good, but the 0's show as spaces.
Rob
Edited by: Rob Burbank on Jan 15, 2010 3:51 PM
‎2010 Jan 15 8:57 PM
Yes, basically that is what I want. But the "NO-ZERO" command doesn't save the value with no zeros back into the variable mixedpacks-packs1, correct? It just gives me the output with no zeros?
Problem is that I need to print the variable on a barcode label with sapscript and I cannot use the "write x no-zero" command there.
I already tried to enter &mixedpacks-packs1(Z)& into my sapscript form where I figured the '(Z)' would eleminate all leading zeros, but it doesn't in this case, maybe because there is only one zero there.
‎2010 Jan 15 9:20 PM
>
> Problem is that I need to print the variable on a barcode label with sapscript and I cannot use the "write x no-zero" command there.
That's the sort of thing it would be nice to know at the beginning.
You can try conditionally move values to character fields.
Rob
Edited by: Rob Burbank on Jan 15, 2010 4:24 PM
‎2010 Jan 18 2:59 PM
Hi Rob,
I tried to move it to a character field and the zeros don't show anymore, but now if there is a value in the P field, it shows up as * in the character field.
I am now trying to use FM PACK_CHAR_CONVERSION to convert the value from P to C, but I don't get it to work.
Thanks for your help
Anne