cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Custom logic for payment advice to add profit center

Dinakar1996__19
Explorer
0 Kudos
71

We are using custom logic for the profit center population in the payment advice form (business context: FINS_PAYMENT_ADVICE_ITEM, ID: FBL_PAYM_ADV_PRINT_ITEM ). The issue is Profit center of the 1st line is repeated for the all the line in the payment advice.

 

DATA: lv_comp        TYPE c LENGTH 4,
      lv_jou         TYPE c LENGTH 10,
      lv_year        TYPE c LENGTH 4,
      lv_pft_ctr     TYPE i_journalentryitem-profitcenter,
      lv_pft_desc    TYPE i_profitcentertext-profitcentername,
      lc_lang        TYPE c LENGTH 1 VALUE 'E',
      wa_item     LIKE LINE OF paymentpaiditems.

 

LOOP AT paymentpaiditems INTO wa_item.

 

  CLEAR: lv_comp, lv_jou, lv_year, lv_pft_ctr, lv_pft_desc.

 

  lv_comp = wa_item-doc2r+0(4).
  lv_jou  = wa_item-doc2r+4(10).
  lv_year = wa_item-doc2r+14(4).

 

  SELECT SINGLE profitcenter
    INTO @LV_pft_ctr
    FROM i_journalentryitem
    WHERE companycode        = @LV_comp
      AND accountingdocument = @LV_jou
      AND fiscalyear         = @LV_year.

 

  IF lv_pft_ctr IS NOT INITIAL.
    SELECT SINGLE profitcentername
      INTO @LV_pft_desc
      FROM i_profitcentertext
      WHERE profitcenter = @LV_pft_ctr
        AND language     = @LC_lang.
  ENDIF.

 

  payment_advice_item_ext-yy1_pftctrpaymentadvic_avi = lv_pft_desc.

 

ENDLOOP.

Accepted Solutions (0)

Answers (0)