Skip to Content
author's profile photo Former Member
Former Member

alv display

Hi,

Iam getting the details in ALV grid like this.

INDIA 20000234

INDIA 20000456

INDIA 20000567

CHINA 20000432

CHINA 20000567

CHINA 20000879

but i want like this

INDIA 20000234

-


20000456

-


20000567

-


CHINA 20000432

-


20000567

-


20000879

-


Iam getting repetion of countries.How to control this?

And also i want blank under the countries instead of lines.What i have to set in field catalog?

points guaranteed

kaki

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 07, 2005 at 03:36 AM

    Kaki,

    What you will have do is to set a SORT criteria in the ALV by your column name. Also do NOT set the flag NO_MERGING in the layout.

    Once this is done, you should not see the repeating entries. However, if the user changes the selection criteria, it appears again.

    Regards,

    Ravi

    Note : Please reward the posts that help you.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 07, 2005 at 04:02 AM

    Hi Kaki,

    I may be mistaken but looking your field catalog, I think you have only one column in the ALV and your internal table. If you do, you can not achieve the functionality what you want to achieve.

    First, have atleast two columns in internal table i.e. One for country and other for mumeric value. Modify your field catalog accordingly. Then provide the sort criteria with group= 'X' on field for country. Then it will show up in the way you want.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi sharad,

      I have five field in my ITAB.This is my code.

      In this report i want to make <b>Attributed division</b> as group.

      REPORT YET_DISPLAYCOST

      MESSAGE-ID ZM

      NO STANDARD PAGE HEADING

      LINE-SIZE 200.

      TYPE-POOLS: SLIS.

      TABLES: QPCT,

      QPGT,

      QMEL,

      QMMA,

      IHPA,

      JEST,

      HRP1000.

      DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

      ITAB_EXTAB TYPE SLIS_T_EXTAB.

      <b>DATA :

      I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

      S_FIELDCAT TYPE SLIS_FIELDCAT_ALV ,

      G_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND' ,

      G_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'T_TOP_OF_PAGE',

      I_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER WITH HEADER LINE,

      I_EVENTS TYPE SLIS_T_EVENT WITH HEADER LINE,

      S_EVENT TYPE SLIS_ALV_EVENT ,

      S_LAYOUT TYPE SLIS_LAYOUT_ALV,

      IT_SORT TYPE SLIS_T_SORTINFO_ALV.</b>

      DATA: LS_LINE TYPE SLIS_LISTHEADER.

      DATA: I_FCALV TYPE SLIS_FIELDCAT_ALV OCCURS 0 WITH HEADER LINE.

      DATA:F_TDOBJECT LIKE THEAD-TDOBJECT,

      F_TDNAME LIKE THEAD-TDNAME,

      F_TDID LIKE THEAD-TDID,

      ITAB_LINES LIKE tline OCCURS 0 WITH HEADER LINE.

      DATA:BEGIN OF ITAB OCCURS 10,

      QMNUM LIKE QMEL-QMNUM,

      DESC(72),

      END OF ITAB.

      DATA: BEGIN OF T_HDR OCCURS 0,

      QMNUM LIKE QMEL-QMNUM,

      STEXT LIKE HRP1000-STEXT,

      END OF T_HDR.

      DATA: BEGIN OF T_DET OCCURS 10,

      SNO TYPE I,

      QMNUM LIKE QMEL-QMNUM,

      QMTXT LIKE QMEL-QMTXT,

      QMGRP LIKE QMEL-QMGRP,

      QMCOD LIKE QMEL-QMCOD,

      PARNR LIKE IHPA-PARNR,

      OBJNR LIKE QMEL-OBJNR,

      STEXT LIKE HRP1000-STEXT,

      DESC(72),

      COST(20),

      END OF T_DET.

      DATA: T_FINAL LIKE T_DET OCCURS 0 WITH HEADER LINE.

      DATA: SNO(3).

      DATA: CHK2(4).

      DATA: V_REPID TYPE SY-REPID.

      SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-001.

      SELECT-OPTIONS:S_QMNUM FOR QMEL-QMNUM,

      S_QMART FOR QMEL-QMART,

      S_QMDAT FOR QMEL-QMDAT.

      SELECTION-SCREEN END OF BLOCK A1.

      START-OF-SELECTION.

      PERFORM GET_DATA.

      PERFORM DISPLAY_ALV.

      END-OF-SELECTION.

      &----


      *& FORM DISPLAY_ALV

      &----


      • TEXT

      ----


      FORM DISPLAY_ALV.

      PERFORM FIELD_CAT USING FIELDCAT.

      PERFORM EVENT.

      PERFORM LAYOUT.

      • PERFORM SORT_T_FINAL.

      PERFORM TOP-OF-PAGE.

      V_REPID = SY-REPID.

      CALL FUNCTION <b>'REUSE_ALV_GRID_DISPLAY'</b>

      EXPORTING

      I_CALLBACK_PROGRAM = SY-CPROG "V_REPID

      IS_LAYOUT = S_LAYOUT

      IT_FIELDCAT = FIELDCAT

      I_SAVE = 'A'

      IT_EXCLUDING = ITAB_EXTAB

      IT_SORT = IT_SORT

      IT_EVENTS = I_EVENTS[]

      TABLES

      T_OUTTAB = T_FINAL

      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.

      ENDFORM. "DISPLAY_ALV

      &----


      *& FORM FIELD_CAT

      &----


      • TEXT

      ----


      • -->P_FIELDCAT TEXT

      ----


      FORM <b>FIELD_CAT</b> USING P_FIELDCAT.

      • FIELD CATELOG FOR ALV DISPLAY.

      DATA: I_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

      CLEAR I_FIELDCAT.

      <b> I_FIELDCAT-FIELDNAME = 'STEXT'.

      I_FIELDCAT-TABNAME = 'T_FINAL'.

      I_FIELDCAT-NO_OUT = ' '.

      I_FIELDCAT-SELTEXT_L = 'ATTRIBUTED DIV'.

      I_FIELDCAT-OUTPUTLEN = 22.

      APPEND I_FIELDCAT TO FIELDCAT.</b>

      I_FIELDCAT-FIELDNAME = 'SNO'.

      I_FIELDCAT-TABNAME = 'T_FINAL'.

      I_FIELDCAT-NO_OUT = ' '.

      I_FIELDCAT-SELTEXT_L = 'S.NO'.

      I_FIELDCAT-OUTPUTLEN = 4.

      APPEND I_FIELDCAT TO FIELDCAT.

      I_FIELDCAT-FIELDNAME = 'QMNUM'.

      I_FIELDCAT-TABNAME = 'T_FINAL'.

      I_FIELDCAT-NO_OUT = ' '.

      I_FIELDCAT-SELTEXT_L = 'ET.REF.NO'.

      I_FIELDCAT-OUTPUTLEN = 15.

      APPEND I_FIELDCAT TO FIELDCAT.

      I_FIELDCAT-FIELDNAME = 'QMTXT'.

      I_FIELDCAT-TABNAME = 'T_FINAL'.

      I_FIELDCAT-NO_OUT = ' '.

      I_FIELDCAT-SELTEXT_L = 'DESCRIPTION'.

      I_FIELDCAT-OUTPUTLEN = 25.

      APPEND I_FIELDCAT TO FIELDCAT.

      I_FIELDCAT-FIELDNAME = 'DESC'.

      I_FIELDCAT-TABNAME = 'T_FINAL'.

      I_FIELDCAT-NO_OUT = ' '.

      I_FIELDCAT-SELTEXT_L = 'DEFECT'.

      I_FIELDCAT-OUTPUTLEN = 85.

      APPEND I_FIELDCAT TO FIELDCAT.

      I_FIELDCAT-FIELDNAME = 'COST '.

      i_fieldcat-DO_SUM = 'X'.

      I_FIELDCAT-TABNAME = 'T_FINAL'.

      I_FIELDCAT-NO_OUT = ' '.

      I_FIELDCAT-SELTEXT_L = 'COST '.

      I_FIELDCAT-OUTPUTLEN = 20.

      APPEND I_FIELDCAT TO FIELDCAT.

      ENDFORM. "FIED_CAT

      &----


      *& FORM GET_DATA

      &----


      • TEXT

      ----


      FORM GET_DATA.

      *TO GET DETAILS

      SELECT QMNUM REFNUM QMDAT QMTXT OBJNR QMGRP QMCOD FROM QMEL

      INTO CORRESPONDING FIELDS OF TABLE T_DET

      WHERE QMNUM IN S_QMNUM AND

      QMART IN S_QMART AND

      QMDAT IN S_QMDAT.

      LOOP AT T_DET.

      SELECT SINGLE * FROM IHPA WHERE OBJNR = T_DET-OBJNR and

      PARVW = 'AB'.

      IF SY-SUBRC = 0.

      T_DET-PARNR = IHPA-PARNR.

      MODIFY T_DET.

      CLEAR T_DET.

      ENDIF.

      ENDLOOP.

      LOOP AT T_DET.

      SELECT SINGLE * FROM JEST WHERE OBJNR = T_DET-OBJNR AND

      STAT = 'I0072' AND

      INACT NE 'X'.

      IF SY-SUBRC NE 0.

      DELETE T_DET INDEX SY-TABIX.

      ENDIF.

      ENDLOOP.

      LOOP AT T_DET.

      SELECT SINGLE * FROM HRP1000 WHERE OBJID = T_DET-PARNR.

      IF SY-SUBRC = 0.

      T_DET-STEXT = HRP1000-STEXT.

      MODIFY T_DET.

      CLEAR T_DET.

      ENDIF.

      ENDLOOP.

      LOOP AT T_DET.

      CHK2 = T_DET-QMNUM+0(4).

      IF CHK2 NE '0002'.

      DELETE T_DET INDEX SY-TABIX.

      ENDIF.

      ENDLOOP.

      *--FOR HEADER

      LOOP AT T_DET.

      SELECT SINGLE * FROM HRP1000 WHERE OBJID = T_DET-PARNR.

      T_HDR-QMNUM = T_DET-QMNUM.

      T_HDR-STEXT = HRP1000-STEXT.

      APPEND T_HDR.

      CLEAR T_HDR.

      ENDLOOP.

      LOOP AT T_DET.

      F_TDID = 'LTQM'.

      F_TDNAME = T_DET-QMNUM.

      F_TDOBJECT = 'QMEL'.

      CALL FUNCTION 'READ_TEXT'

      EXPORTING

      CLIENT = SY-MANDT

      ID = F_TDID

      LANGUAGE = SY-LANGU

      NAME = F_TDNAME

      OBJECT = F_TDOBJECT

      TABLES

      LINES = ITAB_LINES

      EXCEPTIONS

      ID = 1

      LANGUAGE = 2

      NAME = 3

      NOT_FOUND = 4

      OBJECT = 5

      REFERENCE_CHECK = 6

      WRONG_ACCESS_TO_ARCHIVE = 7

      OTHERS = 8.

      DESCRIBE TABLE ITAB_LINES LINES SY-TFILL.

      IF SY-TFILL > 0.

      LOOP AT ITAB_LINES.

      ITAB-QMNUM = T_DET-QMNUM.

      ITAB-DESC = ITAB_LINES-TDLINE.

      APPEND ITAB.

      CLEAR ITAB.

      ENDLOOP.

      ENDIF.

      ENDLOOP.

      LOOP AT T_DET.

      SNO = SNO + 1.

      T_FINAL-SNO = SNO.

      T_FINAL-QMNUM = T_DET-QMNUM.

      T_FINAL-QMTXT = T_DET-QMTXT.

      T_FINAL-COST = T_DET-COST.

      T_FINAL-STEXT = T_DET-STEXT.

      LOOP AT ITAB WHERE QMNUM = T_DET-QMNUM.

      T_FINAL-DESC = ITAB-DESC.

      APPEND T_FINAL.

      CLEAR T_FINAL.

      IF T_FINAL-SNO = '0'.

      T_FINAL-SNO = ''.

      ENDIF.

      ENDLOOP.

      ENDLOOP.

      ENDFORM. "GET_DATA

      &----


      *& Form SORT_T_FINAL

      &----


      • text

      ----


      FORM SORT_T_FINAL.

      SORT T_FINAL BY STEXT.

      DATA: L_SORT LIKE LINE OF IT_SORT.

      REFRESH IT_SORT.

      CLEAR L_SORT.

      <b> L_SORT-SPOS = '1'.

      L_SORT-FIELDNAME = 'STEXT'.

      L_SORT-TABNAME = 'T_FINAL'.

      L_SORT-UP = 'X'.

      APPEND L_SORT TO IT_SORT.

      CLEAR L_SORT.

      L_SORT-SPOS = '2'.

      L_SORT-FIELDNAME = 'COST'.

      L_SORT-TABNAME = 'T_FINAL'.

      L_SORT-UP = 'X'.

      L_SORT-SUBTOT = 'X'.</b>

      APPEND L_SORT TO IT_SORT.

      CLEAR L_SORT.

      • S_LAYOUT-NO_MERGING = SPACE.

      ENDFORM. "SORT_T_FINAL

      &----


      *& Form EVENT

      &----


      • text

      ----


      FORM EVENT.

      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

      EXPORTING

      I_LIST_TYPE = 0

      IMPORTING

      ET_EVENTS = I_EVENTS[].

      LOOP AT I_EVENTS.

      IF I_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.

      I_EVENTS-FORM = 'T_TOP_OF_PAGE'.

      ENDIF.

      IF I_EVENTS-NAME = SLIS_EV_USER_COMMAND.

      I_EVENTS-FORM = 'USER_COMMAND'.

      ENDIF.

      MODIFY I_EVENTS.

      ENDLOOP.

      ENDFORM. " EVENT

      &----


      *& Form LAYOUT

      &----


      • text

      ----


      FORM LAYOUT .

      S_LAYOUT-DETAIL_POPUP = 'X'.

      S_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

      ENDFORM. " LAYOUT

      &----


      *& Form TOP-OF-PAGE

      &----


      • text

      ----


      FORM TOP-OF-PAGE .

      CLEAR LS_LINE.

      LS_LINE-TYP = 'H'.

      LS_LINE-INFO = 'Error Trouble -by cost'.

      APPEND LS_LINE TO I_LIST_TOP_OF_PAGE.

      CLEAR LS_LINE.

      ENDFORM. " TOP-OF-PAGE

      &----


      *& Form T_TOP_OF_PAGE

      &----


      • text

      ----


      FORM T_TOP_OF_PAGE.

      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

      EXPORTING

      IT_LIST_COMMENTARY = I_LIST_TOP_OF_PAGE[].

      ENDFORM. " T_TOP_OF_PAGE

  • Posted on Dec 07, 2005 at 04:37 AM

    Hi Kaki,

    Check this example....

    BALVST02_GRID

    regards

    vijay

    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.