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: 

Needed Report Solution

Former Member
0 Kudos

Hi ,

I need solution for the following requirement;

Input

Vendor Stock debit/credit indicator

10 S

25 H

5 S

10 H

I need to add the vendor stock based on S or H, if s add ,h subtract .

output - should display only data with indicator S and not with H.

output

Vendor Stock debit/credit indicator

10 S

0 S

Thanks in advance

5 REPLIES 5

jayakummar
Active Participant
0 Kudos

Please give some what clear for my reply....Means give u r formula and examples

former_member585060
Active Contributor
0 Kudos

Hi,

LOOP AT it_itab INTO wa_itab.
      IF wa_itab-indic = 'S'.
     WRITE 😕 wa_itab-vendor, wa_itab-indic,
      ENDIF.
ENDLOOP.

too add use COLLECT statement.

Regards

Bala Krishna

Former Member
0 Kudos

Hi Rajeev,

in your scenario based on the indicator you need to add the vendor details.

so while looping the use the authermetic condtions.

data: l_vendor_s type i.

clear l_vendor_s.

loop at the i_vendordetails into wa_vendor details

if wa_vendordetais-indicator = 'S'.

l_vendor_s = l_vendor_s + wa_vendordetais-indicator.

endif.

endloop.

while displaying you can use the l_vendor_s in the final output.

and show remaing details as zero.

Hope it will be useful to you.

Regards,

Prasanth.

0 Kudos

If my data is like this

Vendor st

10 S

20 S

10 H

Then o/p shud b

Vendor st

10 in 1sr row

20 in 2nd row .( 10+20 -10 ).

This code works only for 1 material thatu2019s the last 1. not for multiple products

My code is like this

Loop at it_data into wa_data.

<<<,if indicator is S I have to add to exsisting vendor stock >>>

if wa_data-shkzg EQ 'S'.

lv_vendor_stock = lv_vendor_stock + wa_data-menge.

ELSEif..

<<<,if indicator is H I have to subtract from exsisting vendor stock >>>

wa_data-shkzg EQ 'H'.

lv_vendor_stock = lv_vendor_stock - wa_data-menge.

ENDIF.

<<<< need to display records only with S indicator >>>

If wa_data-shkzg EQ 'S'

Lv_count = lv_count +1.

Wa_data-matnr = Wa_final-matnr

Wa_data-lifnr = Wa_final-lifnr.

Wa_data-lv_vendor_stock = Wa_final-lv_vendor_stock.

Wa_data-trans_qty = Wa_final- trans_qty.

APPEND wa_final to it_final.

Elseif.

wa_data-shkzg EQ 'H'.

Wa_data-matnr = Wa_final-matnr

Wa_data-lifnr = Wa_final-lifnr.

Wa_data-lv_vendor_stock = Wa_final-lv_vendor_stock.

Wa_data-trans_qty = Wa_final- trans_qty

<<<<<<this is to show the last record with subtracted value .>>>>>>>

Modify wa_final index lv_ctount transporting matnr lifnr lv_vendor_stock trans_qty.

Endloop.

0 Kudos

Hi,

Modify this u have to fill into wa_final so it must be left side.

if wa_data-shkzg EQ 'S'
Lv_count = lv_count +1.
 Wa_final-matnr = Wa_data-matnr.
 Wa_final-lifnr = Wa_data-lifnr.
 Wa_final-lv_vendor_stock = Wa_data-lv_vendor_stock.
 Wa_final- trans_qty = Wa_data-trans_qty.

APPEND wa_final to it_final.

Elseif.
wa_data-shkzg EQ 'H'.
Wa_final-matnr = Wa_data-matnr.
 Wa_final-lifnr = Wa_data-lifnr.
 Wa_final-lv_vendor_stock = Wa_data-lv_vendor_stock.
 Wa_final- trans_qty = Wa_data-trans_qty.

<<<<<<this is to show the last record with subtracted value .>>>>>>>
Modify wa_final index lv_ctount transporting matnr lifnr lv_vendor_stock trans_qty.

Endloop.

Regards

Bala Krishna