Skip to Content
author's profile photo Former Member
Former Member

regarding subroutine for report

hi everyone,

below is the code of my invoice report.

in this subroutine l_netvalue2 is the total value of mateial item details. while im seeing priint preview its showing the values correctly as 10,000 and while taking print out its doubled as 20,000.

this is because of the line l_netvalue2 = l_netvalue2 + l_netvalue. if i didn use this line means its not calculating the item details which is more than one.

FORM getpriceinfo TABLES intab

if ty eq 'YAED'or ty eq 'ZIMSPP' or ty eq 'ZSLFAT'.

SELECT single kWERT FROM konv INTO k1 WHERE knumv EQ l_knumv AND kschl EQ 'ZASV' AND kposn = temp2.

SELECT single kWERT FROM konv INTO k2 WHERE knumv EQ l_knumv AND kschl EQ 'ZPR0' AND kposn = temp2.

SELECT single kWERT FROM konv INTO k5 WHERE knumv EQ l_knumv AND kschl EQ 'ZCES' AND kposn = temp2.

SELECT single kWERT FROM konv INTO k6 WHERE knumv EQ l_knumv AND kschl EQ 'ZHES' AND kposn = temp2.

l_netpr = k1 + k2 + k5 + k6.

l_netpr = l_netpr / l_quan.

SELECT single kbetr FROM konv INTO k1 WHERE knumv EQ l_knumv AND kschl EQ 'ZASV' AND kposn = temp2.

SELECT single kbetr FROM konv INTO k2 WHERE knumv EQ l_knumv AND kschl EQ 'ZPR0' AND kposn = temp2.

l_price1 = k1 + k2.

endif.

SELECT single kbetr FROM konv INTO zpac WHERE knumv EQ l_knumv AND kschl EQ 'ZPAC' AND kposn = temp2.

select single EXbas from J_1IEXCDTL into exbas where RDOC2 eq l_docno.

select single SRGRP from J_1IEXChdr into var where RDOC eq l_docno.

select single exdat from J_1IEXChdr into dat where RDOC eq l_docno.

if dat <= '20080229'.

tx = '16%'.

elseif dat <= '20081206'.

tx = '14%'.

elseif dat <= '20080224'.

tx = '10%'.

elseif dat <= '20100226'.

tx = '8%'.

else.

tx = '10%'.

endif.

select single EXBED from J_1IEXCdtl into l_bed where RDOC2 eq l_docno and ZEILE eq n.

select single BEDRATE from J_1IEXCdtl into rate where RDOC2 eq l_docno.

ratet = tx.

if var eq 'SD' or var eq 'SE'.

val = '0'.

else.

val ='16'.

endif.

t2 = l_netpr + zpac.

l_price = t2.

condense l_price.

condense l_price1.

condense l_price2.

READ TABLE outtab INDEX 1.

MOVE l_price TO outtab-value.

MODIFY outtab INDEX 1.

k_netvalue = l_quan * l_price.

k_netvalue1 = l_quan * l_price1.

k_netvalue2 = l_quan * l_price2.

t = k_netvalue.

t5 = k_netvalue1.

t6 = k_netvalue2.

l_netvalue = t.

l_netvalue1 = t5.

l_netvalue3 = t6.

m_netvalue = l_quan * l_netpr.

t1 = t_netvalue + m_netvalue.

t_netvalue = t1.

l_netvalue2 = l_netvalue2 + l_netvalue.

READ TABLE outtab INDEX 13.

MOVE l_NETVALUE2 TO outtab-value.

MODIFY outtab INDEX 13.

thanks & regards

karthe

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Oct 13, 2010 at 11:37 AM

    Hi ,

    You have to Debug Properly on your own .

    Regards

    Deepak.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2010 at 11:43 AM

    Hi,

    Clear the variables being used in appropriate places.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2010 at 12:47 PM

    Hi,

    During preview you are seeing the correct value and after print the value is changing,

    so debbuging is the solution to correct the issue. While debugging check the value in the field

    in the internal table outtab-value.

    Thanks,

    Vengalrao

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 14, 2010 at 07:27 AM

    Hi Karthe,

    I am not an expert, but

    as you are saying the issue is repeated execution of this code "l_netvalue2 = l_netvalue2 + l_netvalue.".

    then you can try (if possible)

    if l_netvalue2 IS INITIAL.
       l_netvalue2 = l_netvalue2 + l_netvalue.
    endif.
    

    or use a toggle variable like

    *decalre some variable 
    data: x type c value 'A'.
    .
    .
    .
    IF X EQ 'A'.
         l_netvalue2 = l_netvalue2 + l_netvalue.
        X = 'B'.
    ENDIF
    
    

    I am not sure It'll help you or not, but as a bigginer, I tried.

    Thanks and regards,

    Sachin Bhatt IN

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.