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

How to stop Zero values from getting printed ?

Former Member
0 Likes
3,148

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?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,613

"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.

11 REPLIES 11
Read only

Former Member
0 Likes
2,613

try to check the IF menge iS not initial while printing in the smartform

Read only

bastinvinoth
Contributor
0 Likes
2,613

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

Read only

0 Likes
2,613

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 .

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,613

Did you try a MENGE NE 0, without quotes ?

Regards,

Raymond

Read only

0 Likes
2,613

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 ?

Read only

0 Likes
2,613

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

Read only

0 Likes
2,613

i have tried that to no avail,
thanks for your valuable suggestions.

Regards,
Vivian

Read only

Former Member
0 Likes
2,614

"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.

Read only

0 Likes
2,613

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.

Read only

Former Member
0 Likes
2,613

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

Read only

Former Member
0 Likes
2,613

Hi,

Try using &QUANTITY(I)&

Thanks & Regards,

Tushar