‎2008 Jun 20 11:54 AM
hi,
in my report i need fetch number of line items of a vendor.
for eg:
from lfa1 table i am fetching lifnr
for this lifnr in bsik table how many line items are there.
for eg;
gt_lfa1-lifnr = 900
for this 900 lifnr i have 2 line items in bsik i need get 2 as output.
i mean output should be.
BUKRS LIFNR NO OF LINE ITEMS
0010 900 2
PLEASE HELP HOW TO WRITE CODE FOR THIS
‎2008 Jun 20 11:57 AM
select single BUZEI from bsik
where lifnr = ...
and bukrs = .....
‎2008 Jun 20 11:59 AM
after getting data from bsik
loop at it_bsik.
v_count = v_count + 1.
at end of lifnr.
write 😕 it_bsik-bukrs , it_bsik-lifnr , v_count.
clear : v_count
endat
endloop.
‎2008 Jun 20 12:00 PM
hi use this...
1.loop at bsik table...
2 . use at end of lifnr
3. use counter.
‎2008 Jun 20 12:02 PM
hi kiran,
use this.
SELECT count(buzei)
INTO ld_count
FROM bsik
FOR ALL ENTRIES IN it_lfa1
WHERE lifnr eq it_lfa1-lifnr.
regards,
Peter
‎2008 Jun 20 12:11 PM
Hi,
try this code....
TABLES BSIK.
TYPES: BEGIN OF TY_BSIK,
BUKRS TYPE BUKRS,
LIFNR TYPE LIFNR,
END OF TY_BSIK.
DATA : IT_BSIK TYPE STANDARD TABLE OF TY_BSIK WITH HEADER LINE.
DATA : V_COUNT TYPE I.
PARAMETERS: P_BUKRS TYPE BUKRS.
SELECT BUKRS
LIFNR
FROM BSIK
INTO TABLE IT_BSIK
WHERE BUKRS EQ P_BUKRS.
LOOP AT IT_BSIK.
V_COUNT = V_COUNT + 1.
AT END OF LIFNR.
WRITE 😕 IT_BSIK-BUKRS , IT_BSIK-LIFNR , V_COUNT.
CLEAR : V_COUNT.
ENDAT.
ENDLOOP.
-Regards.
‎2008 Jun 20 12:19 PM
Ihave written even though i am not getting.
the code is
loop at GT_bsik.
v_count = v_count + 1.
at end of lifnr.
MOVE V_COUNT TO GT_FINAL-LV_INV.
clear : v_count.
endat.
endloop.
‎2008 Jun 20 12:23 PM
write as below ...
loop at GT_bsik.
v_count = v_count + 1.
at end of lifnr.
read table GT_bsik index sy-tabix.
move-corresponding GT_bsik to GT_FINAL.
MOVE V_COUNT TO GT_FINAL-LV_INV.
append GT_FINAL.
clear : v_count.
endat.
endloop.
‎2008 Jun 20 12:23 PM
hi,
try this
sort gt_bsik by lifnr.
loop at GT_bsik.
v_count = v_count + 1.
at end of lifnr.
MOVE V_COUNT TO GT_FINAL-LV_INV.
append gt_final.
clear : v_count.
endat.
endloop.
regards,
Peter
‎2008 Jun 20 12:32 PM
hi to select all the line items use like this
select f1 f2 f3 from lfa1 into table t_lfa1
where lifnr = <condt>.
if not t_lfa1[] is initial.
select f1 f2 f3 f4 from bsik into table t_bsik
for all entries in t_lfa1[]
where lifnr = t_lfa1-lifnr.
endif.
use this . for whatever lifnr in lfa1 whatever entries are there in bsik will be selected in t_bsik table .
Reward if helpful
Regards
‎2008 Jun 20 12:51 PM
Hi.
You can increase the number of people reading your question by using a better subject. Describe your issue and more people get interested in reading your posting. Please have a look into our rules of engagement which will explain some other things you should know as a member of SDN. Postings not following the rules will be locked or deleted.
Best regards,
Jan Stallkamp