Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

alv output issue

Hi friends,

I have designed a classical ALV for displaying totals of amount. The logic is that the field  POPER from FAGLFLEXA is equal to a month of a financial year. For instance POPER = 1 corresponds to April , POPER = 2 corresponds to May, POPER = 3 corresponds to June and so on. The ALV displays the total of the amount for each month. Example, the month of April shows the total of amount for April given by the field HSL01. The month of May shows the total of amount for May represented by field HSL02, so on. The output is coming perfectly fine in my output. But if i am giving  any range of POPER in the selection screen , it is displaying totals for all the months. For example, if i give 5 to 12 as period in selection screen, it is displaying the totals of all the months from  1 to 12. I need to display only the totals from 5 to 12. How to solve this issue. Please go through the code and screenshots for complete understanding. Please help with code. Points will be duly rewarded.

Regards,

Saurav Lahiry

program3.doc.xml (250263 B)
program2.txt.zip (5880 B)
replied

Hi Saurav, if I understood correctly you wan't to show the columns (months) depending the ones selected in selection screen, right ?

If that is the case just check when you create the fieldcat if the POPER entered in the selection should be showed or not, if not set the field no_output = 'X' in the fieldcat.

for example if you give like u said 5 to 12.

In each column in the fieldcat do this conditional

* POPER 1 = c_poper1 = 1

wa_fieldcat-col_pos= '3'.
wa_fieldcat-fieldname  = 'HSL1'." Fieldname in the data table

  wa_fieldcat-seltext_m  = 'April'.

  wa_fieldcat-do_sum= 'X'.

IF c_poper1 IN so_per. "c_poper1 should have value 1

  wa_fieldcat-no_output = ' '.

ELSE.

  wa_fieldcat-no_output = 'X'.

ENDIF.

  APPEND wa_fieldcat  TO it_fieldcat.

CLEAR   wa_fieldcat.

In the following just use another constants

IF c_poper2 IN so_per.  "c_poper2 should have value 2

  wa_fieldcat-no_output = ' '.

ELSE.

  wa_fieldcat-no_output = 'X'.

ENDIF.

Regards

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question