‎2012 Aug 17 5:20 AM
I have an alv report for vendor payment detail.The selction criteria for this is based on po no and vendor no.Report is running correctly while i am displaying it by giving input pono but for vendor no it is not displaying.Below is the logic for this.Kindly help me.
select dmbtr ebeln vgabe shkzg from ekbe into table it_data
where ebeln EQ p_ebeln.
loop at it_data into wa_data.
if wa_data-shkzg = 'H'.
wa_data-xnegp = ' '.
modify it_data from wa_data.
elseif wa_data-shkzg = 'S'.
wa_data-xnegp = 'X'.
*WA_DATA-dmbtr = - IT_DATA-dmbtr.
modify it_data from wa_data.
.
endif.
endloop.
loop at it_data into wa_data.
if wa_data-vgabe = '2'.
wa_data-dmbtr1 = wa_data-dmbtr.
modify it_data from wa_data.
elseif wa_data-vgabe = '4'.
wa_data-bill = wa_data-dmbtr.
modify it_data from wa_data.
endif.
endloop.
*if ( ekbe-shkzg eq 'H' and
*ekbe-xnegp eq ' ' ) or
*( ekbe-shkzg eq 'S' and
*ekbe-xnegp eq 'X' ).
*ekbe-dmbtr = - ekbe-dmbtr.
*endif.
data n type i.
n = 0.
loop at it_data into wa_data.
if wa_data-shkzg = 'H'.
wa_data-dmbtr1 = n - wa_data-dmbtr1.
wa_data-bill = n - wa_data-bill.
modify it_data from wa_data.
endif.
endloop.
*DELETE ADJACENT DUPLICATES FROM it_data comparing ebeln.
*REPLACE ALL OCCURRENCES OF '0
*FORM GET_DATA2 .
if not it_data is initial.
select ebeln lifnr from ekko into table it_ekko for all entries in it_data where ebeln = it_data-ebeln
and lifnr EQ p_lifnr.
loop at it_data into wa_data.
read table it_ekko into wa_ekko with key EBELN = wa_data-EBELN .
if sy-subrc = 0.
wa_data-lifnr = wa_ekko-lifnr.
wa_data-ebeln = wa_ekko-ebeln.
modify it_data from wa_data.
endif.
endloop.
endif.
if not it_data is initial.
select lifnr name1 ort01 from lfa1 INTO TABLE it_lfa1 FOR ALL ENTRIES IN it_data where lifnr = IT_DATA-lifnr .
* AND lifnr = s_lifnr.
endif.
loop at it_data INTO wa_data.
read table it_lfa1 into wa_lfa1 with key lifnr = wa_data-lifnr.
if sy-subrc = 0.
wa_data-name1 = wa_lfa1-name1.
wa_data-ort01 = wa_lfa1-ort01.
wa_data-lifnr = wa_lfa1-lifnr.
modify it_data FROM wa_data.
ENDIF.
ENDLOOP.
DELETE IT_DATA WHERE BILL EQ '0.00' AND DMBTR1 EQ '0.00'.
Moderator message : Not enough re-search before posting, discussion locked.
Message was edited by: Vinod Kumar
‎2012 Aug 17 6:22 AM
SELECTION-SCREEN: BEGIN OF BLOCK B2.
select-OPTIONS :P_EBELN for EKKO-EBELN."use selecct options instead of parameter.
select-OPTIONS : P_LIFNR for LFA1-LIFNR."use selecct options instead of parameter.
SELECTION-SCREEN: END OF BLOCK B2.
"Select options will lend you to choose multiple parameters.
u should select lifnr(vendor code) in start before using loop and and endloop
on final internal table.
"use this select query.
"use innerjoin between these three tables EKBE, EKKo.
"this select query will enable you to select data also if you give vendor no. at selection screen.
SELECT DMBTR EKBE~EBELN VGABE SHKZG
ekko~lifnr
FROM EKBE
inner join ekko
on ekbe~ebeln eq ekko~ebeln
INTO TABLE IT_DATA
WHERE EKBE~EBELN in P_EBELN
and lifnr in p_lifnr.
Revert back if problem still not solved!