Application Development 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: 

Want code for this.

Former Member
0 Kudos
173

Hi Gurus,

plz help me in this coding part.

. Fix the checking for Gross Sales, General Discount, Trade Discount, Net Value, Tax Amount by adding following condition.

If VBRK-VBTYP = “M” or “P”, multiply this value with 1.

If VBRK-VBTYP = “O”, multiply this value with -1.

how to code for this Gurus.

plz help me...

Rewards are gaurenteed.

thanks & regards

sirish

1 ACCEPTED SOLUTION

Former Member
0 Kudos
135

"you need not do anything for first condition.
"i.e.    VBRK-VBTYP = “M” or “P”, multiply this value with 1.
"multiplying by 1 is not going change anything .
"So check for second cond..

SELECT <field list> INTO <itab> from <DBTAB> 
WHERE <cond>.

IF <itab>-VBTYP = 'O'.
 "mulptiply value by -1.
ENDIF.

 APPEND <itab>.
ENDSELECT. 

6 REPLIES 6

former_member386202
Active Contributor
0 Kudos
135

Hi,

Do like this

If ( VBRK-VBTYP = 'M' ) or

( VBRK-VBTYP = 'P' ) .

lv_var = var * 1

elseIf VBRK-VBTYP = 'O'.

lv_var = var * ( -1 ).

endif.

Regards,

Prashant

former_member404244
Active Contributor
0 Kudos
135

Hi,

If ( VBRK-VBTYP = 'M' ) or

( VBRK-VBTYP = 'P' ) .

value = value * 1.

elseIf VBRK-VBTYP = 'O'.

value = value * -1.

endif.

Reagrds,

Nagaraj

ibrahim_u
Active Participant
0 Kudos
135

if VBRK-VBTYP = 'M' or VBRK-VBTYP = 'P'.
    multiply VARIABLE by 1.
elseif VBRK-VBTYP = 'O'.
    multiply VARIABLE by -1.
endif.

Former Member
0 Kudos
136

"you need not do anything for first condition.
"i.e.    VBRK-VBTYP = “M” or “P”, multiply this value with 1.
"multiplying by 1 is not going change anything .
"So check for second cond..

SELECT <field list> INTO <itab> from <DBTAB> 
WHERE <cond>.

IF <itab>-VBTYP = 'O'.
 "mulptiply value by -1.
ENDIF.

 APPEND <itab>.
ENDSELECT. 

Former Member
0 Kudos
135

Hi,

try this code

it will work for sure

If ( VBRK-VBTYP = 'M' ) or

( VBRK-VBTYP = 'P' ) .

value = value * 1.

elseIf VBRK-VBTYP = 'O'.

value = value * -1.

endif.

plzzzz reward if useful.

feel free to ask any quiries

my mail id mutyalasunilkumar@gmail.com

Former Member
0 Kudos
135

Hi,

Gross Sales, General Discount, Trade Discount, Net Value, Tax Amount

First decide from which tables you want to pickup the vaues for the fields you mentioned.

If you know the tables,Declare internal table with these fields.

Then write select stmt using join cond fetching from more than 2 tables if required.

Select f1 f2 f3 from <Table_Name>

into table itab

where <Cond>.

*f1 contains value of vbtyp.

Loop at itab where f1 = 'O'.

*if itab-f1 = 'O'.

itab-f2 = itab-f2 * ( -1 ) .

Modify itab clear itab.

*endif.

endloop.

Tax Amount field VBRP-MWSBP

Net Value field VBRP-NETWR

Thanks

Sivaparvathi.

Please reward points if helpful.

Message was edited by:

Siva Parvathi