2023 Sep 20 6:45 AM
Hi All,
I have a custom report with two inputs: Vendor and plant. In selection screen i have given select-option for vendor and parameters for plant. when i pass some values to vendor then getting correct records but when I keep the vendor fields blank, i.e. to fetch all vendors the some line items for some vendors are missing. I am not able to understand why it is happenning and how to resolve this.
Need your kind support and help on this.
2023 Sep 21 9:58 AM
Hi All,
Thanks for the replay and concern.
I debug the program and corrected it. All records and line items are populating correctly to my internal tables. One small mistake in read table statement for which some line items were missing.
2023 Sep 20 7:14 AM
2023 Sep 20 8:20 AM
Post the actual selection-screen definition and the select statement where you use it, where clause?
2023 Sep 21 5:27 AM
DATA: vendor TYPE lfa1-lifnr.
SELECTION-SCREEN BEGIN OF BLOCK blk.
SELECT-OPTIONS: s_vendor FOR vendor.
PARAMETERS : p_werks TYPE ekpo-werks.
SELECTION-SCREEN END OF BLOCK blk.
SELECT lifnr
name1
ktokk
FROM lfa1 INTO CORRESPONDING FIELDS OF TABLE it_lfa1
WHERE lifnr IN s_vendor.
IF it_lfa1 IS NOT INITIAL.
SELECT *
FROM t077y INTO TABLE it_t077y FOR ALL ENTRIES IN it_lfa1
WHERE ktokk = it_lfa1-ktokk.
SELECT ebeln
lifnr
zterm
FROM ekko INTO TABLE it_ekko FOR ALL ENTRIES IN it_lfa1
WHERE lifnr = it_lfa1-lifnr.
ENDIF.
IF it_ekko IS NOT INITIAL.
SELECT ebeln
ebelp
FROM ekpo INTO TABLE it_ekpo
FOR ALL ENTRIES IN it_ekko
WHERE ebeln = it_ekko-ebeln AND werks = p_werks.
ENDIF.
IF it_ekpo IS NOT INITIAL.
SELECT ebeln
ebelp
belnr
budat
werks
xblnr
bldat
bewtp
wrbtr
gjahr
lfbnr
hswae
dmbtr
FROM ekbe INTO CORRESPONDING FIELDS OF TABLE it_ekbe
FOR ALL ENTRIES IN it_ekpo
WHERE ebeln = it_ekpo-ebeln
AND ebelp = it_ekpo-ebelp
AND werks = p_werks.
ENDIF.
IF it_ekbe IS NOT INITIAL.
SELECT *
FROM rbkp INTO CORRESPONDING FIELDS OF TABLE it_rbkp
FOR ALL ENTRIES IN it_ekbe
WHERE belnr = it_ekbe-belnr
AND gjahr = it_ekbe-gjahr.
ENDIF.
IF it_rbkp IS NOT INITIAL.
SELECT *
FROM bsik INTO CORRESPONDING FIELDS OF TABLE it_bsik
FOR ALL ENTRIES IN it_rbkp
WHERE lifnr = it_rbkp-lifnr
AND gjahr = it_rbkp-gjahr.
ENDIF.
IF it_bsik IS NOT INITIAL.
SELECT * FROM bseg INTO TABLE it_bseg
FOR ALL ENTRIES IN it_bsik
WHERE gjahr = it_bsik-gjahr
AND belnr = it_bsik-belnr
AND augbl = ''
AND koart = 'S'.
SELECT lifnr
augbl
gjahr
belnr
xblnr
blart
FROM bsak INTO CORRESPONDING FIELDS OF TABLE it_bsak
FOR ALL ENTRIES IN it_bsik
WHERE lifnr = it_bsik-lifnr
AND belnr = it_bsik-belnr.
SELECT *
FROM with_item INTO TABLE it_with_item
FOR ALL ENTRIES IN it_bsik
WHERE belnr = it_bsik-belnr
AND gjahr = it_bsik-gjahr.
ENDIF.
IF it_ekko IS NOT INITIAL.
SELECT * FROM t052u INTO TABLE it_t052
FOR ALL ENTRIES IN it_ekko
WHERE zterm = it_ekko-zterm.
ENDIF.
IF it_bsak IS NOT INITIAL.
SELECT chect
lifnr
vblnr
gjahr
FROM payr INTO CORRESPONDING FIELDS OF TABLE it_payr
FOR ALL ENTRIES IN it_bsak
WHERE lifnr = it_bsak-lifnr
AND vblnr = it_bsak-augbl.
ENDIF.
2023 Sep 21 8:09 AM
some line items are missing -> which line item table? from ekko table select query or where?
2023 Sep 21 9:58 AM
Hi All,
Thanks for the replay and concern.
I debug the program and corrected it. All records and line items are populating correctly to my internal tables. One small mistake in read table statement for which some line items were missing.
2023 Sep 21 12:44 PM
That was a question without minimum details needed to answer, and now we have the answer that it was a "small mistake of missing stuff" (?) which is now fixed. Happy for you but I don't think the existence of this question/answer will help future visitors 😉