‎2006 Feb 27 9:38 AM
hello experts,
I am currently modifying a code in a report where it shows PO's and it amount, downpayment, Invoice, GR, payment and balance. Now the problem is, some of the PO amount(it gets the amount from ekpo-netwr) does not show on the report output. the field is t_amount-netwr. I really need help on this one guys. Thanks and take care!
PERFORM process_with_budat.
FORM process_with_budat.
DELETE t_pohistory WHERE hist_type <> 'A'
AND hist_type <> 'E'
AND hist_type <> 'Q'.
LOOP AT t_account.
DELETE it_dtl WHERE ebeln = t_account-ebeln
AND psphi IS initial.
DELETE t_ekpo WHERE ebeln = t_account-ebeln
AND ebelp = t_account-po_item.
t_proj-ebelp = t_account-po_item.
SELECT SINGLE psphi FROM prps INTO t_proj-psphi
WHERE posid = t_account-wbs_elem_e.
CHECK sy-subrc = 0.
LOOP AT t_pohistory WHERE po_item = t_account-po_item
AND ebeln = t_account-ebeln.
t_amount-ebeln = t_account-ebeln.
t_amount-psphi = t_proj-psphi.
ON CHANGE OF t_pohistory-po_item.
CLEAR v_netwr.
SELECT SINGLE netwr FROM ekpo INTO v_netwr
WHERE ebeln = t_account-ebeln
AND ebelp = t_account-po_item.
t_amount-netwr = v_netwr.
ENDON.
IF v_ebeln IS INITIAL AND v_ebelp IS INITIAL.
CLEAR v_netwr.
SELECT SINGLE netwr FROM ekpo INTO v_netwr
WHERE ebeln = t_account-ebeln
AND ebelp = t_account-po_item.
t_amount-netwr = v_netwr.
v_ebeln = t_account-ebeln.
v_ebelp = t_account-po_item.
ELSEIF v_ebeln <> t_account-ebeln AND
v_ebelp <> t_account-po_item.
CLEAR v_netwr.
SELECT SINGLE netwr FROM ekpo INTO v_netwr
WHERE ebeln = t_account-ebeln
AND ebelp = t_account-po_item.
t_amount-netwr = v_netwr.
v_ebeln = t_account-ebeln.
v_ebelp = t_account-po_item.
ELSEIF v_ebeln = t_account-ebeln AND
v_ebelp <> t_account-po_item.
CLEAR v_netwr.
SELECT SINGLE netwr FROM ekpo INTO v_netwr
WHERE ebeln = t_account-ebeln
AND ebelp = t_account-po_item.
t_amount-netwr = v_netwr.
v_ebeln = t_account-ebeln.
v_ebelp = t_account-po_item.
ENDIF.
CHECK NOT t_amount-psphi IS INITIAL.
if t_pohistory-pstng_date LE pa_augdt.
IF t_pohistory-pstng_date IN so_augdt.
IF t_pohistory-db_cr_ind = 'H'.
t_pohistory-val_loccur = - t_pohistory-val_loccur.
t_pohistory-val_forcur = - t_pohistory-val_forcur.
t_pohistory-cl_val_loc = - t_pohistory-cl_val_loc.
ENDIF.
IF t_pohistory-hist_type = 'A'.
IF t_pohistory-currency <> 'PHP'.
t_amount-dpamt = t_amount-dpamt + t_pohistory-val_forcur.
ELSE.
t_amount-dpamt = t_amount-dpamt + t_pohistory-val_loccur.
ENDIF.
ELSEIF t_pohistory-hist_type = 'E'.
IF t_pohistory-currency <> 'PHP'.
t_amount-gramt = t_amount-gramt + t_pohistory-val_forcur.
ELSE.
t_amount-gramt = t_amount-gramt + t_pohistory-val_loccur.
ENDIF.
ELSEIF t_pohistory-hist_type = 'Q'.
IF t_pohistory-currency <> 'PHP'.
t_amount-iramt = t_amount-iramt + t_pohistory-val_forcur.
ELSE.
t_amount-iramt = t_amount-iramt + t_pohistory-val_loccur.
ENDIF.
ENDIF.
IF t_pohistory-currency <> 'PHP'.
IF t_pohistory-val_loccur = 0 OR
t_pohistory-val_forcur = 0.
t_amount-tramt = t_amount-iramt.
t_amount-tramt = t_amount-dpamt.
ELSE.
t_amount-tramt = t_amount-iramt.
ENDIF.
ELSE.
t_amount-tramt = t_amount-iramt.
t_amount-tramt = t_pohistory-cl_val_loc + t_amount-dpamt.
ENDIF.
IF NOT t_pohistory-cl_val_loc IS INITIAL.
CONCATENATE t_pohistory-mat_doc t_pohistory-doc_year
INTO bkpf-awkey.
SELECT SINGLE * FROM bkpf
WHERE awkey = bkpf-awkey.
*AVH - removed wrbtr and dmbtr from selection
SELECT augdt augbl shkzg FROM bsak
INTO (bsak-augdt,bsak-augbl,bsak-shkzg)
WHERE bukrs = bkpf-bukrs
AND gjahr = bkpf-gjahr
AND belnr = bkpf-belnr.
*AVH
if not bsak-augbl is initial.
select belnr gjahr from bsak
into (bsak-belnr, bsak-gjahr)
where bukrs = bkpf-bukrs
and belnr = bkpf-belnr
and gjahr = bkpf-gjahr.
select awkey from bkpf
into v_bkpf_aw
where bukrs = 'GLOB'
and belnr = bsak-belnr
and gjahr = bsak-gjahr.
w_len = strlen( v_bkpf_aw ).
w_off = w_len - 4.
v_awkey_1 = v_bkpf_aw+0(10).
v_awkey_2 = v_bkpf_aw+w_off(4).
select single dmbtr wrbtr from ekbe
into (ekbe-dmbtr, ekbe-wrbtr)
where belnr = v_awkey_1
and gjahr = v_awkey_2.
*AVH - Changed all bsak-wrbtr to ekbe-wrbtr and dmbtr to ekbe-dmbtr.
IF bsak-shkzg = 'H'.
ekbe-dmbtr = - ekbe-dmbtr.
ekbe-wrbtr = - ekbe-wrbtr.
ENDIF.
IF t_pohistory-currency <> 'PHP'.
IF bsak-augdt GT pa_augdt.
IF bsak-augdt IN so_augdt.
t_amount-tramt = t_amount-tramt + ekbe-wrbtr.
ENDIF.
ELSE.
IF bsak-augdt GT pa_augdt.
IF bsak-augdt IN so_augdt.
t_amount-tramt = t_amount-tramt + ekbe-dmbtr.
ENDIF.
ENDIF.
endselect.
endselect.
endselect.
endif.
ENDSELECT.
ENDIF.
IF t_account-distr_perc <> 0.
t_amount-dpamt = ( t_account-distr_perc *
t_amount-dpamt ) / 100.
t_amount-gramt = ( t_account-distr_perc *
t_amount-gramt ) / 100.
t_amount-iramt = ( t_account-distr_perc *
t_amount-iramt ) / 100.
t_amount-tramt = ( t_account-distr_perc *
t_amount-tramt ) / 100.
ENDIF.
ENDIF.
IF t_amount-tramt < 0.
t_amount-tramt = 0.
ENDIF.
t_amount-tramt = t_amount-iramt.
t_amount-blamt = t_amount-netwr - t_amount-tramt.
COLLECT t_amount. CLEAR t_amount.
APPEND t_proj.
ENDLOOP.
IF sy-subrc <> 0.
CLEAR v_netwr.
SELECT SINGLE netwr FROM ekpo INTO v_netwr
WHERE ebeln = t_account-ebeln
AND ebelp = t_account-po_item.
t_amount-ebeln = t_account-ebeln.
t_amount-psphi = t_proj-psphi.
t_amount-tramt = t_amount-iramt.
t_amount-blamt = t_amount-netwr - t_amount-tramt.
COLLECT t_amount. CLEAR t_amount.
APPEND t_proj.
ENDIF.
ENDLOOP.
endform.
**This is where it transfers the data**
LOOP AT t_amount.
it_dtl-netwr = t_amount-netwr.
it_dtl-dpamt = t_amount-dpamt.
it_dtl-gramt = t_amount-gramt.
it_dtl-iramt = t_amount-iramt.
it_dtl-tramt = t_amount-tramt.
it_dtl-blamt = t_amount-blamt.
MODIFY it_dtl TRANSPORTING netwr dpamt gramt
iramt tramt blamt
WHERE ebeln = t_amount-ebeln
AND psphi = t_amount-psphi.
CLEAR it_dtl.
ENDLOOP.
‎2006 Feb 27 9:47 AM
‎2006 Feb 27 9:47 AM
‎2006 Feb 27 9:48 AM
Hi viraylab
check whether this select statement sy-subrc is zero
IF sy-subrc <> 0.
CLEAR v_netwr.
<b>SELECT SINGLE netwr FROM ekpo INTO v_netwr
WHERE ebeln = t_account-ebeln
AND ebelp = t_account-po_item.</b>
t_amount-ebeln = t_account-ebeln.
t_amount-psphi = t_proj-psphi.
t_amount-tramt = t_amount-iramt.
t_amount-blamt = t_amount-netwr - t_amount-tramt.
COLLECT t_amount. CLEAR t_amount.
APPEND t_proj.
ENDIF.
ENDLOOP.
endform
regards
kishore
‎2006 Feb 27 9:52 AM
hi ,
just place the code and check for a particular po if its there inthe ekpo table then it has to get it for ur select single query .
but ur logic is build on if --- endif.check this option first of all.
if in the debugging u see the value then as u say in the report output u r not able to see the value then the problem will be space alignment also.
check the value in debugging and let us know first of all . okay
vijay.
___________________________________________________
IF v_ebeln IS INITIAL AND v_ebelp IS INITIAL.
CLEAR v_netwr.
SELECT SINGLE netwr FROM ekpo INTO v_netwr
WHERE ebeln = t_account-ebeln
AND ebelp = t_account-po_item.
*******************
break-point.
******************
t_amount-netwr = v_netwr.
v_ebeln = t_account-ebeln.
v_ebelp = t_account-po_item.
ELSEIF v_ebeln <> t_account-ebeln AND
v_ebelp <> t_account-po_item.
CLEAR v_netwr.
SELECT SINGLE netwr FROM ekpo INTO v_netwr
WHERE ebeln = t_account-ebeln
AND ebelp = t_account-po_item.
break-point.
***********************************
t_amount-netwr = v_netwr.
***********************************
v_ebeln = t_account-ebeln.
v_ebelp = t_account-po_item.
ELSEIF v_ebeln = t_account-ebeln AND
v_ebelp <> t_account-po_item.
CLEAR v_netwr.
SELECT SINGLE netwr FROM ekpo INTO v_netwr
WHERE ebeln = t_account-ebeln
AND ebelp = t_account-po_item.
break-point.
***********************************
t_amount-netwr = v_netwr.
‎2006 Feb 27 10:00 AM