Skip to Content

ALV Grid DIsplay in dialog or module pool programming

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 07:32 AM

    Hi,

    just do the hilighted change in ur code.........it ll work perfectly

    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.

    free T_FCAT. "Add this line

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 07:30 AM

    Hi

    refresh when press back and also debug your code the values are getting added each when you press back

    Try refreshing your ITAB each time whne pressed BACK

    Regards

    Shiva

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 07:31 AM

    Hi,

    Before filling fieldcat

    refresh T_FCAT.

    Then ur problem will solved.

    Plzz do reward.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 07:40 AM

    HI,

    clearing / refreshing of fieldcatalogue after once it has done displaying which is being dipslayed on the alv grid/list has to be refreshed each time it displays the coulmn.

    just after that FM, after coming out of it, it should refresh the IT_FINAL ,and then call FM again, it will not repeat the column,

    as you can see

    this is the problem of area not getting cleared/refreshed

    because first time it shows ok,

    and then next time it shows 2 times, means previous one+this time.

    you can see the exact point where it is getting wrong by debugging it and clear it just before it fills the second time.

    hope it is clear,

    plzz reward points if helpful

    Rohan Malik

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.