2008 Jan 30 7:22 AM
Hi Experts,
i have a problem with report,
i have created a screen with related my Ztable(zrin),in that i kept three buttons
1)enter
2)display
3)list
1st two a r working properly but when i click on LIST button its displaying alv grid display upto here its ok but when come to screen n again i click on LIST button its displaying each column displaying 2times for 2nd time,n for 3rd time 3times,for 4time 4times,so on
how to control it,it should display each column only single time however i come back n press again n again on list button.
im sending my code plz correct it, send it its very urgent plz.
TABLES : ZRIN.
DATA : BEGIN OF T_ZRIN OCCURS 1,
BILL_OF_LADING TYPE ZRIN-BILL_OF_LADING,
ASSIGNED_RIN TYPE ZRIN-ASSIGNED_RIN,
CALENDAR_YEAR TYPE ZRIN-CALENDAR_YEAR,
EPA_COMPANY_ID TYPE ZRIN-EPA_COMPANY_ID,
EPA_FACITILY_ID TYPE ZRIN-EPA_FACITILY_ID,
RIN_BATCH_CODE TYPE ZRIN-RIN_BATCH_CODE,
EQUIVA_VALUE TYPE ZRIN-EQUIVA_VALUE,
CELLULOSIC TYPE ZRIN-CELLULOSIC,
START_GALLONS TYPE ZRIN-START_GALLONS,
END_GALLONS TYPE ZRIN-END_GALLONS,
RIN_NO TYPE ZRIN-RIN_NO,
TRANSFER_OR_EPA TYPE ZRIN-TRANSFER_OR_EPA,
FILL_DATE TYPE ZRIN-FILL_DATE,
VOL_TRANSFERED TYPE ZRIN-VOL_TRANSFERED,
END OF T_ZRIN.
CASE SY-UCOMM.
WHEN 'GEN'.
INSERT ZRIN.
CLEAR ZRIN.
WHEN 'LIS'.
TYPE-POOLS : SLIS.
*****************DEFINE T_FCAT**************
DATA : W_FCAT TYPE SLIS_FIELDCAT_ALV.
DATA : T_FCAT TYPE SLIS_T_FIELDCAT_ALV.
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'BILL_OF_LADING'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'ASSIGNED_RIN'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'CALENDAR_YEAR'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 4.
W_FCAT-FIELDNAME = 'EPA_COMPANY_ID'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 5.
W_FCAT-FIELDNAME = 'EPA_FACITILY_ID'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 6.
W_FCAT-FIELDNAME = 'RIN_BATCH_CODE'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 7.
W_FCAT-FIELDNAME = 'EQUIVA_VALUE'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 8.
W_FCAT-FIELDNAME = 'CELLULOSIC'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 9.
W_FCAT-FIELDNAME = 'START_GALLONS'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 10.
W_FCAT-FIELDNAME = 'END_GALLONS'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 11.
W_FCAT-FIELDNAME = 'RIN_NO'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 12.
W_FCAT-FIELDNAME = 'TRANSFER_OR_EPA'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 13.
W_FCAT-FIELDNAME = 'FILL_DATE'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 14.
W_FCAT-FIELDNAME = 'VOL_TRANSFERED'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
SELECT BILL_OF_LADING
ASSIGNED_RIN
CALENDAR_YEAR
EPA_COMPANY_ID
EPA_FACITILY_ID
RIN_BATCH_CODE
EQUIVA_VALUE
CELLULOSIC
START_GALLONS
END_GALLONS
RIN_NO
TRANSFER_OR_EPA
FILL_DATE
VOL_TRANSFERED FROM ZRIN INTO TABLE T_ZRIN.
*DATA : PRGNAME TYPE SY-REPID.
PRGNAME = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = PRGNAME
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = T_FCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = T_ZRIN[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDCASE.
ENDMODULE. " XYZ INPUT
2008 Jan 30 8:38 AM
Rajesh,
This is because field catelog is calling n number of times .Stop that.
Declare a count variable
DATA : v_num type i value '1'.
IF v_num EQ 1.
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'BILL_OF_LADING'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'ASSIGNED_RIN'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'CALENDAR_YEAR'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 4.
W_FCAT-FIELDNAME = 'EPA_COMPANY_ID'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 5.
W_FCAT-FIELDNAME = 'EPA_FACITILY_ID'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 6.
W_FCAT-FIELDNAME = 'RIN_BATCH_CODE'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 7.
W_FCAT-FIELDNAME = 'EQUIVA_VALUE'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 8.
W_FCAT-FIELDNAME = 'CELLULOSIC'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 9.
W_FCAT-FIELDNAME = 'START_GALLONS'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 10.
W_FCAT-FIELDNAME = 'END_GALLONS'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 11.
W_FCAT-FIELDNAME = 'RIN_NO'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 12.
W_FCAT-FIELDNAME = 'TRANSFER_OR_EPA'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 13.
W_FCAT-FIELDNAME = 'FILL_DATE'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 14.
W_FCAT-FIELDNAME = 'VOL_TRANSFERED'.
W_FCAT-SELTEXT_M = ''.
APPEND W_FCAT TO T_FCAT.
v_num = v_num + 1.
ENDIF.
Now it will work fine .
Don't forget to reward if useful...