2013 Mar 25 1:14 PM
Greetings everyone,
Hi, the values in the field menge which is component quantity has zero values "0.000" automatically assigned to them alongside the actual value that is required for printing, now while printing them in smartforms.
For ex:
RM code Material description Formulation Quantity
L2201 water 2.570
(same)L2201 water 0.000
the same happens for all the elements, now the requirement is to stop the zero's from getting printed, i tried to set condition in the respective Smartform, but they are not affecting the results, now the menge value is taken from the stpo table, and i also use the an itab it_components1_temp which is based on the
structure bapi_order_component, and in the following code:
if it_components1_temp is not initial.
select stlty "BOM category
stlnr "Bill of material
stlkn "BOM item node number
stpoz "Internal counter
aedat "Changed On
idnrk "BOM component
posnr "BOM Item Number
menge "Component quantity
potx1 "BOM Item Text (Line 1)
potx2 "BOM item text (line 2)
from stpo
into table it_stpo
for all entries in it_components1_temp
where stlty = 'M'
and stlnr in r_stlnr[]
and posnr = it_components1_temp-item_number.
endif.
i tried giving menge ne '0', but it did not have any effect, the above code is in the sub routine " form sub_get_stpo",now can anyone give me ideas as how to achieve the required output by adding to my report?
Do i have to use Outer join or Inner Join to achieve it?
2013 Mar 26 5:21 AM
"the same happens for all the elements, now the requirement is to stop the zero's from getting printed, "
Hi Vivian,
Did you try checking the initial value of the variable before printing in the Smartform?
Something like below:
IF &QUANTITY& IS NOT INITIAL.
/: &QUANTITY&
ENDIF.
This worked for me in many cases, Is it working for you?
Thanks,
Venkatesh.
Greetings everyone,
Hi, the values in the field menge which is component quantity has zero values "0.000" automatically assigned to them alongside the actual value that is required for printing, now while printing them in smartforms.
For ex:
RM code Material description Formulation Quantity
L2201 water 2.570
(same)L2201 water 0.000
the same happens for all the elements, now the requirement is to stop the zero's from getting printed, i tried to set condition in the respective Smartform, but they are not affecting the results, now the menge value is taken from the stpo table, and i also use the an itab it_components1_temp which is based on the
structure bapi_order_component, and in the following code:
if it_components1_temp is not initial.
select stlty "BOM category
stlnr "Bill of material
stlkn "BOM item node number
stpoz "Internal counter
aedat "Changed On
idnrk "BOM component
posnr "BOM Item Number
menge "Component quantity
potx1 "BOM Item Text (Line 1)
potx2 "BOM item text (line 2)
from stpo
into table it_stpo
for all entries in it_components1_temp
where stlty = 'M'
and stlnr in r_stlnr[]
and posnr = it_components1_temp-item_number.
endif.
i tried giving menge ne '0', but it did not have any effect, the above code is in the sub routine " form sub_get_stpo",now can anyone give me ideas as how to achieve the required output by adding to my report?
Do i have to use Outer join or Inner Join to achieve it?
2013 Mar 25 1:22 PM
try to check the IF menge iS not initial while printing in the smartform
2013 Mar 25 1:26 PM
Hi Octavious,
Did u try with menge ne '0.000'.
else
declare one more internal table, in that u can specify a required new variable for menge.
then put a loop for it_stpo , inside that u can append it_stpo values to your new internal table.
hope it will work
2013 Mar 26 4:39 AM
Can you please explain further? i am working on previous developer's report, i am also a beginner, i have tried all options in the same select query like menge > '0',GT '0', NE '0' NE '0.000', but it's not having any effect on the outcome, i have also found the respective smartform and went and set the condition as wa_stpo-menge NE '0','0.000' ..it executed without errors, but it has no change in output.thanks for your suggestions .
2013 Mar 25 1:37 PM
2013 Mar 25 2:07 PM
hello raymond
menge data element having p decimals 3,
thats why i preferred to give values like '0.000' within quotes.
if no decimal means we can give zero without quotes right ?
correct me if i wrong ?
2013 Mar 25 2:52 PM
AFAIK no problem with quantity field here 0 = '0' = '0.000' = ' '
Small demo report
REPORT z_zero_test.
SELECT COUNT(*) FROM marc WHERE minbe NE ' '. WRITE: / 'blank', sy-dbcnt.
SELECT COUNT(*) FROM marc WHERE minbe NE 0. WRITE: / '0', sy-dbcnt.
SELECT COUNT(*) FROM marc WHERE minbe NE '0'. WRITE: / '''0''', sy-dbcnt.
SELECT COUNT(*) FROM marc WHERE minbe NE '0.0'. WRITE: / '''0.0''', sy-dbcnt.
SELECT COUNT(*) FROM marc WHERE minbe NE '0.000'. WRITE: / '''0.000''', sy-dbcnt.
giving
TEST
blank 9.722
0 9.722
'0' 9.722
'0.0' 9.722
'0.000' 9.722
Regards,
Raymond
2013 Mar 26 4:41 AM
i have tried that to no avail,
thanks for your valuable suggestions.
Regards,
Vivian
2013 Mar 26 5:21 AM
"the same happens for all the elements, now the requirement is to stop the zero's from getting printed, "
Hi Vivian,
Did you try checking the initial value of the variable before printing in the Smartform?
Something like below:
IF &QUANTITY& IS NOT INITIAL.
/: &QUANTITY&
ENDIF.
This worked for me in many cases, Is it working for you?
Thanks,
Venkatesh.
2013 Mar 26 11:38 AM
It worked just fine, went to smarrtforms table's main are ...gave &menge is not initial& it is now working just fine ...
Thanks & Regards,
Vivian Octavious.
2013 Mar 26 7:11 AM
instead of giving condition on menge....
can you try writing code, setting a variable lv_zero = 'X'.
try use this variable lv_zero in condition....
Thank you
Amarender Reddy
2013 Mar 26 8:24 AM