ALV - field count

Hi experts,
I am having one requiment i am creating one alv report whre i am displyaing ALV grid. So i hav some fields such as org. unit, personal no, position and job id.
so my requiment is i am haivng no of organiztional units i which there are no of peronnal nos and thir postion and job id.
so after completing of each org. i need to count the no of personal no.( here peronal no shows no of persons in that org. unit) so i need to count and display the no of persons in that org unit before staring of the next org. unit. and also i need to show the job id. job id is comman for all in that org. unit.
i hv to show one row at the end of each org unti showing cout of no of person and the job id.
just look at the format i needed.
Org Unit     Personnel No.POSITION Job ID
5000001     1     6000001     700001
5000001     2     6000001     700001
<b>............     2..........................700001</b>
5000002     3     6000002     700002
5000002     44     6000002     700002
5000002     42     6000002     700002
5000002     40     6000002     700002
<b>............     4..........................700002</b>
note: i need to show the count of persons only . I dont need the sum of perons.
Here 500001, and 500002 are org units. and after completing one org unit. in the same filed personnal no it is showing count of that field and also job id (700001).
How to do in ALv grid display?
<REMOVED BY MODERATOR>
regards,
sunil kairam
Edited by: sunil kairam on Feb 19, 2008 10:50 AM
Edited by: Alvaro Tejada Galindo on Mar 4, 2008 4:05 PM

Hi check the below code
REPORT zmr_cpw NO STANDARD PAGE HEADING
                  LINE-SIZE 165
                  LINE-COUNT 65(2)
                  MESSAGE-ID zmm.
       TABLE DECLARATION
*tables
TABLES: aufk,  "Order master data
        afvc,  "Operations within an order
        ekko,  "purchasing docs
        resb,  "reservation/dep requirements
        bapiret2.      "Return parameter
       SELECT-OPTIONS                                                *
       PARAMETERS                                                    *
*selection parameters
SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP.
PARAMETERS:     p_werks     LIKE resb-werks OBLIGATORY. "plant
SELECT-OPTIONS: s_matnr     FOR resb-matnr,            "material
                s_lifnr     FOR afvc-lifnr,            "vendor
                s_erdat     FOR aufk-erdat.            "start date
SELECTION-SCREEN SKIP.
SELECT-OPTIONS: s_reswk     FOR ekko-reswk NO-DISPLAY
                            DEFAULT '1301' OPTION EQ SIGN I. "whse
SELECTION-SCREEN END OF BLOCK b01.
SELECTION-SCREEN SKIP.
*plant report selections
SELECTION-SCREEN ULINE /10(55).
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 12(17) text-s00
                   FOR FIELD p_obplt.
PARAMETERS: p_obplt RADIOBUTTON GROUP rept.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 20(17) text-s01
                   FOR FIELD p_ptven.
PARAMETERS: p_ptven AS CHECKBOX.
SELECTION-SCREEN COMMENT 44(17) text-s02
                   FOR FIELD p_ptplt.
PARAMETERS: p_ptplt AS CHECKBOX.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
*vendor report selection
SELECTION-SCREEN ULINE /10(55).
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 12(17) text-s03
                     FOR FIELD p_obven.
PARAMETERS: p_obven RADIOBUTTON GROUP rept.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
*ALV data
TYPE-POOLS slis.                       "ALV list viewer
DATA: gs_sett  TYPE lvc_s_glay,
      gs_title TYPE lvc_title,
      gx_vari  TYPE disvariant,
      g_vari   TYPE disvariant,
      d_extfg(1)  TYPE c.
DATA:  p_fieldcat  TYPE slis_t_fieldcat_alv, "list
       t_fieldcat  TYPE slis_t_fieldcat_alv, "popup
       s_fieldcat  TYPE slis_fieldcat_alv,
       t_extab     TYPE slis_t_extab, "funct exclude
       t_extab_x   TYPE slis_t_extab,
       s_extab     TYPE slis_extab,
       p_programname LIKE sy-repid.
*----- Processing options -
SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-002.
SELECTION-SCREEN SKIP.
PARAMETERS:
  p_varia     LIKE gx_vari-variant .       "Layout
SELECTION-SCREEN END   OF BLOCK b02.
DATA: count(2) TYPE n,
      header2  TYPE char100,
      header3  TYPE char100,
      header4  TYPE char100,
      datch    TYPE char10,   "date character
      datfr    TYPE char10,   "reformat date
      datto    TYPE char10,   "reformat date
      qfield   TYPE char14,
      afield   TYPE char14,
      qtfld    TYPE char3 VALUE 'qty',
      amfld    TYPE char3 VALUE 'dmb',
      name1    LIKE lfa1-lifnr.
*internal tables
*BAPI messages
DATA: BEGIN OF t_bapiret2 OCCURS 0.
        INCLUDE STRUCTURE bapiret2.
DATA: END OF t_bapiret2.
*-report data
DATA: BEGIN OF t_coredata OCCURS 0.
        INCLUDE STRUCTURE zms_coredata.
DATA: flagd.
DATA: ebeln LIKE ekkn-ebeln.
DATA: END OF t_coredata.
DATA: t_coredata_x LIKE t_coredata OCCURS 0 WITH HEADER LINE.
*EKKO
DATA: BEGIN OF t_ekko OCCURS 0,
      ebeln LIKE ekko-ebeln,
      loekz LIKE ekko-loekz,
      zzref LIKE ekko-zzref,
      zzref_n LIKE ekko-ebeln,
      flagd,
      END OF t_ekko.
*-EKKN
DATA: BEGIN OF t_ekkn OCCURS 0,
      ebeln LIKE ekkn-ebeln,
      aufnr LIKE ekkn-aufnr,
      END OF t_ekkn.
*-AUFK
DATA: BEGIN OF t_aufk OCCURS 0,
      aufnr LIKE aufk-aufnr,
      auart LIKE aufk-auart,
      END OF t_aufk.
*descriptions
*-report
DATA: BEGIN OF t_report OCCURS 0,
      codet LIKE dd03p-scrtext_m,
      lifnr LIKE afvc-lifnr,
      namel LIKE lfa1-name1,
      aufnr LIKE mseg-aufnr,
      auart LIKE aufk-auart,
      aufnr_m LIKE mseg-aufnr,
      auart_m LIKE aufk-auart,
      erdat LIKE aufk-erdat,
      matnr LIKE mseg-matnr,
      maktx LIKE makt-maktx,
      iloan LIKE zms_coredata-iloan,
      tplnr LIKE zms_coredata-tplnr,
      equnr LIKE zms_coredata-equnr,
      eqktx LIKE zms_coredata-eqktx,
      quans LIKE zms_coredata-quans,
      sernr LIKE zms_coredata-sernr,
      count TYPE i,
      END OF t_report.
*-detail table
DATA: BEGIN OF t_detail_01 OCCURS 0,
      aufnr LIKE mseg-aufnr,
      aufnr_m LIKE mseg-aufnr,
      ebeln LIKE ekko-ebeln,
      matnr LIKE mseg-matnr,
      END OF t_detail_01.
        CONSTANTS DECLARATION                                        *
CONSTANTS: c_yes    TYPE char1      VALUE 'X',
           c_nodesc TYPE name1      VALUE '**NO DESCRIPTION**',
           c_pov  LIKE zms_coredata-ocode VALUE 'POV',"Plant owes vendor
           c_pop  LIKE zms_coredata-ocode VALUE 'POP',"Plant owes plant
           c_vop  LIKE zms_coredata-ocode VALUE 'VOP',"Vendor owes plant
           c_ub   LIKE aufk-auart         VALUE 'UB'.
       HEADER                                                        *
TOP-OF-PAGE.
  PERFORM top_of_page.
       FOOTER                                                        *
INCLUDE zfooter.
       END-OF-PAGE                                                   *
*END-OF-PAGE.
*PERFORM display_footer.
AT SELECTION-SCREEN.
*message if no reporting option is chosen for Owed by Plant
  IF NOT p_obplt IS INITIAL.
    IF p_ptven IS INITIAL
   AND p_ptplt IS INITIAL.
      MESSAGE e000(zmm) WITH text-m02.
    ENDIF.
  ENDIF.
----- At selection screen on value request for "Layout" -
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_varia.
  PERFORM select_layout.
       START-OF-SELECTION
START-OF-SELECTION.
*retrieve CORE data using BAPI
  PERFORM get_core_data.
*build report table
  PERFORM report_table.
END-OF-SELECTION.
       LIST PROCESSING                                               *
*write report
*-heading data
  PERFORM heading_data.
  PERFORM alv_list_viewer.
       SUBROUTINES                                                   *
*forms
*&      Form  get_CORE_DATA
FORM get_core_data.
  CALL FUNCTION 'ZMM_BAPI_GET_CORE_OWEAGE'
    EXPORTING
      bapi_plant       = p_werks
    TABLES
      bapi_rangesmatnr = s_matnr
      bapi_rangeslifnr = s_lifnr
      bapi_rangesbldat = s_erdat
      bapi_rangesreswk = s_reswk
      coredata         = t_coredata
      return           = t_bapiret2.
*Vendor owes Plant
  IF NOT p_obven IS INITIAL.
    DELETE t_coredata WHERE NOT ocode = c_vop.
    EXIT.
  ENDIF.
*Plant owes
  IF NOT p_obplt IS INITIAL.
    DELETE t_coredata WHERE ocode = c_vop.
  ENDIF.
*Plant owes vendor
  IF NOT p_ptven IS INITIAL.
    t_coredata-flagd = c_yes.
    MODIFY t_coredata TRANSPORTING flagd WHERE ocode = c_pov. "keep
  ENDIF.
*Plant owes plant
  IF NOT p_ptplt IS INITIAL.
    t_coredata-flagd = c_yes.
    MODIFY t_coredata TRANSPORTING flagd WHERE ocode = c_pop. "keep
  ENDIF.
  DELETE t_coredata WHERE flagd IS INITIAL.
*-get additional data
  t_coredata_x[] = t_coredata[].
  DELETE t_coredata_x WHERE NOT auart = c_ub. "STO
  CHECK NOT t_coredata_x[] IS INITIAL.
  LOOP AT t_coredata_x.
    t_coredata_x-ebeln = t_coredata_x-aufnr.
    MODIFY t_coredata_x TRANSPORTING ebeln.
  ENDLOOP.
*-get CORE Stock Transport Orders for display
  SELECT ebeln loekz zzref
    INTO TABLE t_ekko
    FROM ekko
    WHERE reswk = p_werks.
  DELETE t_ekko WHERE NOT loekz IS INITIAL.
  DELETE t_ekko WHERE zzref IS INITIAL. "not create w/ref to STO
*reformat field
  LOOP AT t_ekko.
    t_ekko-zzref_n = t_ekko-zzref(10).
    MODIFY t_ekko TRANSPORTING zzref_n.
  ENDLOOP.
  SORT t_ekko BY zzref_n.
*--Mine Maintenance Order
  SELECT ebeln aufnr
    INTO TABLE t_ekkn
    FROM ekkn
    FOR ALL ENTRIES IN t_coredata_x
    WHERE ebeln = t_coredata_x-ebeln.
  DELETE t_ekkn WHERE aufnr IS INITIAL.
  CHECK NOT t_ekkn[] IS INITIAL.
*--Mine Maintenance Order Type
  SELECT aufnr auart
    INTO TABLE t_aufk
    FROM aufk
    FOR ALL ENTRIES IN t_ekkn
    WHERE aufnr = t_ekkn-aufnr.
ENDFORM.                    " get_CORE_DATA
*&      Form  report_table
FORM report_table.
*create report table
  SORT t_ekkn BY ebeln.
  SORT t_aufk BY aufnr.
  LOOP AT t_coredata.
    CLEAR t_report.
    MOVE-CORRESPONDING t_coredata TO t_report.
*Mine maint order
    IF t_report-auart = c_ub.
      READ TABLE t_ekkn WITH KEY ebeln = t_report-aufnr BINARY SEARCH.
      IF sy-subrc = 0.
        t_report-aufnr_m = t_ekkn-aufnr.
        READ TABLE t_aufk WITH KEY aufnr = t_ekkn-aufnr BINARY SEARCH.
        IF sy-subrc = 0.
          t_report-auart_m = t_aufk-auart.
        ENDIF.
      ENDIF.
    ENDIF.
    CASE t_coredata-ocode.
      WHEN c_pop.
        t_report-codet = text-s02.
      WHEN c_pov.
        t_report-codet = text-s01.
      WHEN c_vop.
        t_report-codet = text-s03.
    ENDCASE.
  Add 1 to the count column to use with totaling
    t_report-count = '1'.
    APPEND t_report.
  ENDLOOP.
ENDFORM.                    " report_table
*&      Form  ALV_list_viewer
FORM alv_list_viewer.
  IF t_report[] IS INITIAL.
    WRITE: text-m01.
  ENDIF.
  CHECK NOT t_report[] IS INITIAL.
  SORT t_report BY lifnr matnr aufnr sernr.
  PERFORM function_exclude. "this is for the popup view
Call ABAP List Viewer (ALV)
  p_programname      = sy-repid.
  gx_vari-report     = sy-repid.
  gx_vari-username   = sy-uname.
  gx_vari-variant    = p_varia.
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = p_programname
      i_internal_tabname     = 'T_REPORT'
      i_inclname             = p_programname
    CHANGING
      ct_fieldcat            = p_fieldcat[]
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2
      OTHERS                 = 3.
  PERFORM field_catalog TABLES p_fieldcat.
  gs_sett-top_p_only = 'X'.
  CONCATENATE header3 header4 INTO gs_title SEPARATED BY space.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program      = gx_vari-report
      i_callback_top_of_page  = 'TOP_OF_PAGE'
      i_callback_user_command = 'USER_COMMAND'
      i_grid_settings         = gs_sett
      i_structure_name        = 'T_REPORT'
      i_grid_title            = gs_title
      is_variant              = gx_vari
      i_save                  = 'A'
      it_fieldcat             = p_fieldcat[]
    TABLES
      t_outtab                = t_report.
ENDFORM.                    " ALV_list_viewer
*&      Form  field_catalog
FORM field_catalog TABLES p_fieldcat TYPE slis_t_fieldcat_alv.
  LOOP AT p_fieldcat INTO s_fieldcat.
    CASE s_fieldcat-fieldname.
      WHEN 'CODET'.
        s_fieldcat-seltext_s = 'Oweage'.
        s_fieldcat-seltext_m = 'Oweage'.
        s_fieldcat-seltext_l = 'Oweage'.
        s_fieldcat-reptext_ddic = 'Oweage'.
      WHEN 'NAMEL'.
        s_fieldcat-seltext_s = 'Name'.
        s_fieldcat-seltext_m = 'Name'.
        s_fieldcat-seltext_l = 'Name'.
        s_fieldcat-reptext_ddic = 'Name'.
      WHEN 'AUFNR_M'.
        s_fieldcat-seltext_s = 'MineOrd'.
        s_fieldcat-seltext_m = 'Mine Order'.
        s_fieldcat-seltext_l = 'Mine Maint Order'.
        s_fieldcat-reptext_ddic = 'Mine Order'.
      WHEN 'AUART_M'.
        s_fieldcat-seltext_s = 'MineOrdTyp'.
        s_fieldcat-seltext_m = 'Mine Order Type'.
        s_fieldcat-seltext_l = 'Mine Maint Order Type'.
        s_fieldcat-reptext_ddic = 'Mine Order Type'.
      WHEN 'EBELN'.
        s_fieldcat-seltext_s = 'CORE STO'.
        s_fieldcat-seltext_m = 'CORE STO'.
        s_fieldcat-seltext_l = 'CORE Stock Transport Order'.
        s_fieldcat-reptext_ddic = 'CORE STO'.
        s_fieldcat-key       = ' '.
      WHEN 'COUNT'.
        s_fieldcat-seltext_s = 'COUNT'.
        s_fieldcat-seltext_m = 'COUNT'.
        s_fieldcat-seltext_l = 'COUNT'.
        s_fieldcat-reptext_ddic = 'COUNT'.
        s_fieldcat-key       = ' '.
    ENDCASE.
    MODIFY p_fieldcat FROM s_fieldcat.
  ENDLOOP.
ENDFORM.                    " field_catalog
*&      Form  heading_data
FORM heading_data.
*-heading data
  header2 = text-h01.
*-format date range
  IF s_erdat[] IS INITIAL.
    SORT t_report BY erdat.
    READ TABLE t_report INDEX 1.
    s_erdat-low = t_report-erdat.
    SORT t_report BY erdat DESCENDING.
    READ TABLE t_report INDEX 1.
    s_erdat-high = t_report-erdat.
    APPEND s_erdat.
  ENDIF.
  READ TABLE s_erdat INDEX 1.
  WRITE s_erdat-low TO datfr.
  WRITE s_erdat-high TO datto.
  CONCATENATE datfr 'to' datto
              INTO header3 SEPARATED BY space.
*plant
  READ TABLE t_coredata INDEX 1.
  CONCATENATE p_werks t_coredata-namew
                INTO header4 SEPARATED BY space.
ENDFORM.                    " heading_data
*&      Form  top_of_page
FORM top_of_page.
  CALL FUNCTION 'Z_REPORT_HEADER'
    EXPORTING
      header2 = header2
      header3 = header3
      header4 = header4.
ENDFORM.                    " top_of_page
*&      Form user_command
FORM user_command USING r_ucomm LIKE sy-ucomm
                        rs_selfield TYPE slis_selfield.
*F2
  CHECK r_ucomm = '&IC1'.
*field deterimines further action
  CASE rs_selfield-sel_tab_field.
    WHEN 'T_REPORT-AUFNR'. "if STO - display CORE STO
      READ TABLE t_report INDEX rs_selfield-tabindex.
      CHECK t_report-auart = c_ub."only if order is STO
      REFRESH t_detail_01.
      LOOP AT t_ekko
        WHERE zzref_n = t_report-aufnr.
        t_detail_01-aufnr = t_report-aufnr.
        t_detail_01-aufnr_m = t_report-aufnr_m.
        t_detail_01-ebeln = t_ekko-ebeln.
        t_detail_01-matnr = t_report-matnr.
        APPEND t_detail_01.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = p_programname
          i_internal_tabname     = 'T_DETAIL_01'
          i_inclname             = p_programname
        CHANGING
          ct_fieldcat            = t_fieldcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      PERFORM field_catalog TABLES t_fieldcat.
      t_extab_x[] = t_extab[].
*these are the FCodes to keep on the popup screen
      DELETE t_extab_x WHERE fcode = '&AC1'. "cancel
      DELETE t_extab_x WHERE fcode = '%SC'.  "find
      DELETE t_extab_x WHERE fcode = '%SC+'. "repeat find
      DELETE t_extab_x WHERE fcode = '&OUP'. "sort asc
      DELETE t_extab_x WHERE fcode = '&ODN'. "sort desc
      SORT t_detail_01 BY ebeln.
      CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
        EXPORTING
          i_title      = text-h02
          i_tabname    = 'T_DETAIL_01'
          it_fieldcat  = t_fieldcat[]
          it_excluding = t_extab_x
        TABLES
          t_outtab     = t_detail_01.
  ENDCASE.
ENDFORM.                    " user_command
*&      Form  function_exclude
FORM function_exclude.
*this form excludes all functions on popup screen
*delete entries that should appear on the popup from this table prior to
*REUSE_ALV_POPUP_TO_SELECT
  s_extab-fcode = '&ONT'. "copy/enter
  APPEND s_extab TO t_extab.
  s_extab-fcode = '&ETA'. "detail
  APPEND s_extab TO t_extab.
  s_extab-fcode = '%SC'.  "find
  APPEND s_extab TO t_extab.
  s_extab-fcode = '%SC+'. "find next
  APPEND s_extab TO t_extab.
  s_extab-fcode = '&OUP'.  "sort asc
  APPEND s_extab TO t_extab.
  s_extab-fcode = '&ODN'. "sort desc
  APPEND s_extab TO t_extab.
  s_extab-fcode = '&ILT'.  "filter
  APPEND s_extab TO t_extab.
  s_extab-fcode = '&OL0'. "display variant
  APPEND s_extab TO t_extab.
  s_extab-fcode = '&CRB'.  "H scroll-1st
  APPEND s_extab TO t_extab.
  s_extab-fcode = '&CRL'.  "H scroll-prev
  APPEND s_extab TO t_extab.
  s_extab-fcode = '&CRR'. "H scroll-next
  APPEND s_extab TO t_extab.
  s_extab-fcode = '&CRE'.  "H scroll-last
  APPEND s_extab TO t_extab.
  s_extab-fcode = '&AC1'. "Cancel
  APPEND s_extab TO t_extab.
  s_extab-fcode = '&ALL'.  "select all
  APPEND s_extab TO t_extab.
  s_extab-fcode = '&SAL'.  "deselect all
  APPEND s_extab TO t_extab.
ENDFORM.                    " function_exclude

Similar Messages

  • Error in updating ALV field catalog in selection tool for Planning Book

    Hi ,
    I am Implementing BADI  '/SAPAPO/SDP_SELECTOR' to upload Custom Fields Data in Planning Book Selection Window under APO Location Product. These Custom Fields are maintained in Custom Table.So from Table whatever Custom Fields are availabe all the fields needs to be available in for selection. Once selection is done the same data to be uploaded into Planning Book.
    This BADI is working Fine upto 4 fields but if any extra fields are added in the table 'Error in updating ALV field catalog in selection tool' error Pop Up is coming. Here i am using Folloowing Methods
    1). INIT_OBJECT_LIST
    2). F4
    3). LOC_PROD_VALUE_LIST
    Please help on the same if u have any idea or clue.
    Thanks.

    Hi Srinivas!
    Where did you get your implementation from?
    It would be nice if you could debug your code!
    For the F4 method, have you seen this note?
    Note 544904 - Sample source code f.BAdI /SAPAPO/SDP_SELECTOR ('F4'method)
    Also check this note. It contains selection modifications in the BAdI:
    Note 376902 - SDP selector: Basis corrections for BADI
    I do not know your release and support package in your SCM, but you can find a lot of notes related to this BAdI.
    Thank you!
    Will
    SCM Support Consultant

  • Error in updating ALV field catalog in selection

    Dear all,
    I'm trying to use the standard transaction /SAPAPO/TSKEYFMAIN in order to check the TS values.
    After filling the selection variant, the system shows the following error:
    'Error in updating ALV field catalog in selection'
    Could you please provide me with further details about the error? What could be the possible solution to avoid it?
    Many thanks,
    SM

    Hi Marius,
    thanks for your answer.
    I would like to use the /SAPAPO/TSKEYFMAIN transaction to check massively the values in the time series KFs and not just the consistency of them.
    So do you know any other transaction to do it or do you have an idea about the error of /SAPAPO/TSKEYFMAIN?
    Thanks for your help!
    SM

  • How to get the total no.of fields count in TFS

    How to check this:
    You can define no more than 1,024 work item fields in the same team project collection, and you can set no more than 1,024 fields to
    reportable in all team project collections.
    I have created some new fields in my customized process template. How to get the field count to check this validation. Do we have any command for this since witadmin listfields does not give the total count info.
    Thanks
    Divya

    Hi Divya, 
    Thanks for your post.
    Try to get fields count in collection using below code snippet:
    TfsTeamProjectCollection tfs =
    new
    TfsTeamProjectCollection(new
    Uri("collectionURL"));
    tfs.EnsureAuthenticated();
    WorkItemStore workitemstore = tfs.GetService<WorkItemStore>();
    FieldDefinitionCollection fields = workitemstore.FieldDefinitions;
    // get fields count in this collection
    Console.WriteLine(fields.Count);
    //get each field name
    foreach(FieldDefinition
    field in fields)
    Console.WriteLine(field.Name);
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Error in ALV : Field Does not exists in Output table .

    Hi All,
    In my ALV report, program get dumped and showing error when i tried to put a col named Distribution channel ion the alv.
    I have put the Distribution cannel field in the IT_FInal table , but still getting folwong errors :
    Error : Field Symbol is not been assigned.
    As Instructed i have passed            I_INTERFACE_CHECK              = 'X'.
    By this i am getting detail error that :
    Field Distribution channel does not exists in Output table & Heading for List is missing .
    But i have maintained the distribition channel in IT_Final table
    Please suggest wheather we have to define dis channel in any other place.
    Thanks in advance.
    Can any one help me regrarding this.
    Thanks in advance.

    Hello,
    You have to populate the same in the fieldcatalog as well, i think you have not maintained this field there.
    BR,
    Suhas
    PS: Also make it a point to follow-up on your previous post: [Error in ALV : Field Symbol not been assigned.|Error in ALV : Field Symbol not been assigned.]

  • Decimal Value display in ALV Field display

    Hi Expert,
    I need to dispaly one ALV Field "Routine Work Hour" value up to 2 decimal place in ALV output i.e if value is 2.5 then it should display as 2.50.The field which refers to this is ISMNW and the database table is AFRU.Now if this value is maintained in MINUTE unit, then code converts into HOUR unit and correctly outputs to ALV output up to 2 decimal after i changed the field decimal lenght.But for the value which is mainatined in HOUR unit, it correctlty populated into the final internal table upto 2 decimal and this table data while passing into FM " REUSE_GRID_DISPLAY" it only outputs upto 2 deciamal value for the value which is maintained as MINUTE unit in database table AFRU in ALV output, but for other value(Which are maintained in HOUR unit in table AFRU)  it still shows 1 decimal length.But the internal table correctly populates these values up to 2 decimal for all unit of work(MINUTE/HOUR) while passing though this above FM.
    Please advise where i need to look into.
    Thanks

    hi,
    pass these parameters to fieldcatlog.
    e.g.
    Fcat-ref_fieldname = 'ISMNW'.
    fcat-ref_tabname  = 'AFRU'.
    fcat-decimalsout = 2.
    Hope this will help you.
    Regards,
    Vijay

  • 1000 CHARACTER TEXT IN ALV FIELD

    Hi Experts,
    I have a String type variable containing 1000 character text that I am passing in a field on ALV. But ALV field can display on 132 characters. So now my requirement is that when a user double clicks on that field... then a popup or a screen appears where the user can read the entire text of that field.
    I have tried some FMs (like POPUP_TO_CONFIRM, POPUP_TO_INFORM, POPUP_DISPLAY_TEXT etc...), but all have length restriction.
    Please suggest if there is any FM to get the entire 1000 character text on a popup....  OR if there is any other way to do this...
    Thanks in advance
    Regards,
    Ashish Goyal

    I am using this code provided by you, facing error : Field "OB_GUI_DIALOGBOX_CONTAINER" is unknown. It is neither in one of   the specified tables nor defined by a "DATA" statement. 
    Please take a look and suggest.
    Using REUSE ALV GRID to display ALV.
       TYPES: BEGIN OF tp_text_x .
    TYPES: tdname      TYPE thead-tdname ,
           tdobject    TYPE thead-tdobject ,
           tdid        TYPE thead-tdid ,
           tdspras     TYPE thead-tdspras ,
           tdtxtlines  TYPE thead-tdtxtlines .
    TYPES: tdline      TYPE tline-tdline ,
           it_tline    TYPE tline_tab .
    TYPES: END OF tp_text_x .
    CLASS cl_event_reciever DEFINITION DEFERRED.
    DATA v_event_reciever TYPE REF TO cl_event_reciever.
    CLASS cl_event_receiver DEFINITION .
      PRIVATE SECTION.
        METHODS: close
                 FOR EVENT close OF cl_gui_dialogbox_container
                 IMPORTING sender.
        METHODS: init_container .
        METHODS: display_textedit
                 IMPORTING value(st_text_x) TYPE tp_text_x .
    ENDCLASS .                    "cl_event_receiver DEFINITION
    CLASS cl_event_receiver IMPLEMENTATION.
      METHOD close .
        CALL METHOD sender->set_visible
          EXPORTING
            visible = abap_false.
      ENDMETHOD .                    "handle_close
      METHOD init_container .
    *    DATA: ob_gui_dialogbox_container TYPE REF TO cl_gui_dialogbox_container.
        IF ob_gui_dialogbox_container IS NOT INITIAL .
    *    IF EDITOR_CONTAINER IS NOT INITIAL .
          me->close( EXPORTING sender =  ob_gui_dialogbox_container ) .   " EDITOR_CONTAINER ).
        ENDIF .
        CREATE OBJECT ob_gui_dialogbox_container
          EXPORTING
            parent   = cl_gui_container=>screen0
            top      = 40
            left     = 200
            lifetime = cntl_lifetime_dynpro
            width    = 600
            height   = 100.
      ENDMETHOD.                    "init_container
      METHOD display_textedit .
        me->init_container( ) .
        DATA: ob_gui_textedit TYPE REF TO cl_gui_textedit .
    *    DATA: ob_gui_dialogbox_container TYPE REF TO cl_gui_dialogbox_container.
        CREATE OBJECT ob_gui_textedit
          EXPORTING
            parent = ob_gui_dialogbox_container.
        CALL METHOD ob_gui_textedit->set_readonly_mode
          EXPORTING
            readonly_mode = cl_gui_textedit=>true.
        DATA: it_tdline TYPE TABLE OF tdline .
        DATA: st_tdline LIKE LINE OF it_tdline .
        FIELD-SYMBOLS: <st_tline> LIKE LINE OF st_text_x-it_tline .
        LOOP AT st_text_x-it_tline ASSIGNING <st_tline> .
          APPEND <st_tline>-tdline TO it_tdline .
        ENDLOOP .
        CALL METHOD ob_gui_textedit->set_text_as_stream
          EXPORTING
            text = it_tdline.
      ENDMETHOD.                    "display_textedit
    ENDCLASS .                    "cl_event_receiver IMPLEMENTATION
    INITIALIZATION.
    CREATE OBJECT v_event_reciever.
    DATA: ob_gui_dialogbox_container TYPE REF TO cl_gui_dialogbox_container.
    CREATE OBJECT ob_gui_dialogbox_container.
    START-OF-SELECTION.
    v_event_reciever->display_textedit( EXPORTING st_text_x = <st_alv_data_1>-text_1 ) .

  • Hi, i have doubt in alv field cat log

    1)In alv field cat preparation (i dont want to display for one particular field in output screen) can u pls send me the code.
    2)in field cat for a particular field i want to display in different color for that can u send me code.
    3)code for (DOUBLE CLICK) event.
                for the can u send me a code
    Regards,
    Nagesh

    Hi Nagesh,
    I think you have posted your question in the wrong forum, this forum is for education related topics only.  Please review the existing forums and re-post it to the appropriate one.
    Regards,
    Simon

  • I am trying to add, through an amplification project, the field counts alte

    hello dear, 
    I have a countable document with several positions with classes of costs, which have imputation object the order co. 
    I am trying to add, through an amplification project, the field counts alternative to transaction KSB1. 
    the problem that I have in the routine, is that, he/she repeats the last bill alternative to all the positions of the cost classes. 
    the routine is the following one: 
    clear CS_RECORD-ZZ_LOKKT. 
    select * from bseg where bukrs eq ld_documents-bukrs 
                             and belnr eq ld_documents-docnr 
                             and gjahr eq ld_documents-ac_gjahr. 
            if not bseg-kostl is initial. 
               CS_RECORD-ZZ_LOKKT = BSEG-LOKKT. 
            endif. 
    endselect. 
    example of the result that it shows me:                                                                               
    It counts Alternative 
    30101001 COMMISSION SUB-AGENCY 113,64       6220000 
    30202001 SALARIES                             142,05       6220000 
    grateful of their help, 
    greetings 
    jorge silva

    Make the back of the car a 3D layer. Add a camera. Animate the camera so the motiion looks right.
    Another option, track something in the frame that is in the same plane as the back of the car. Track scale. Apply the tracked scale information to the back of the car layer.
    A better way to get better suggestions. Post a screenshot of the video or better yet, upload the video to You-tube and let us see what you are trying to do.

  • Alv field with f4 help without using class

    Hi,
    Can any one give me a program of "Alv field with f4 help without using class".
    Thanking you in advance.

    hi
    <b>Linking F4 Help to Fields</b>
    For the last section, we will deal with linking F4 help to fields. It is easy. As usual, define, implement and register the event “onf4” at proper places in your code. For F4 help, you must register the fields whose F4 request will trigger the “onf4” event. For this you must prepare a table of type “LVC_T_F4” and register this table using the method “register_f4_for_fields”. While preparing table you must include a line for each field which will trigger F4 event. For each field in the structure;
    &#1048766; Pass the fieldname to ‘FIELDNAME’
    &#1048766; Set ‘REGISTER’ to make the field registered,
    &#1048766; Set ‘GETBEFORE’ to provide field content transport before F4 in editable mode
    &#1048766; Set ‘CHNGEAFTER’ to make the data changed after F4 in editable mode.
    DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE .
    lt_f4-fieldname = 'PRICE'.
    lt_f4-register = 'X' .
    lt_f4-getbefore = 'X' .
    APPEND lt_f4 .
    CALL METHOD gr_alvgrid->register_f4_for_fields
    EXPORTING
    it_f4 = lt_f4[] .
    Preparing table for the fields to be registered to trigger F4 event
    METHOD handle_on_f4 .
    PERFORM f4_help USING e_fieldname es_row_no .
    er_event_data->m_event_handled = 'X' .
    ENDMETHOD .
    A sample “onf4” method implementation
    Again, we set the attribute “er_event_data->m_event_handled” to prevent further processing of standard F4 help.
    regards
    Ravish
    <b>
    reward if useful</b>

  • ALV field, max length?

    Hello all,
    When entering data on the screen into the ALV, field VALID will allow only 128 characters.  But the field has 255 characters.
    Is the max field lenth in an ALV 128 characters? 
    The fieldcat has these values for field VALID:
    DATATYPE        char
    INTLEN               255
    DD_OUTLEN     255  
    The Layout has just 2 fields populated, ZEBRA and GRID_TITLE.
    Here is the bits of code I'm using.
    DATA: w_container TYPE scrfname VALUE 'ZCONTAINER1',
          w_grid  TYPE REF TO cl_gui_alv_grid,
           w_custom_container TYPE REF TO cl_gui_custom_container.
    DATA: i_alv TYPE TABLE OF zalv_zfxxu004.  " ALV table - displayed
    DATA: w_outtab  TYPE zalv_zfxxu004.           " ALV table row
    *zalv_zfxxu004 is a structure with the following fields.
    *AUFNR CHAR     12
    *BUKRS CHAR     4
    *KTEXT CHAR     40
    *VALID CHAR     255
               Create an instance of the container displayed on screen 100
      CREATE OBJECT w_custom_container
             EXPORTING container_name = w_container.
               Create an instance of the grid displayed in the container
      CREATE OBJECT w_grid
             EXPORTING i_parent = w_custom_container.
      CALL METHOD w_grid->set_table_for_first_display
        EXPORTING
          i_bypassing_buffer   = 'X'
          is_layout            = l_layout
          it_toolbar_excluding = lt_exclude
        CHANGING
          it_fieldcatalog      = il_fieldcat
          it_outtab            = il_outtab.
    Any thoughts?
    Thanks
    Bruce

    Hello,
    Check SAP note 857823.
    This is the standard system behavior and cannot be changed.
    Regards,
    David

  • Regarding ALV Field Catalogue

    Hi ,
    Checked in the forum for this issue. => Not a wise plan to hoodwink the Moderators.
    Could not find any.Guide me.
    SAY i have a table  CRICKET with 2 fields
    1) PLAYER
    2) SCORE
    Records are say::
    PLAYER    SCORE
    SACHIN     50
    RAHUL      40
    SEHWAG  100
    In Selection Screen, i have a field PLAYER.
    a)If user enters value SACHIN in field PLAYER..
    output shd be:
    SACHIN
    50
    b)If user enters value SACHIN,RAHUL,SEHWAG in Selection screen,
    output shd be
    SACHIN     RAHUL   SEHWAG
    50             40             100
    Mean to say dynamically creating the fields based on inputs entered by user.
    In ALV field catalog there is option NO_OUT ='X' to hide the fields.
    But not able to get how to compare with values entered by user.
    Edited by: kishan P on Oct 5, 2010 2:38 PM

    Hi manju
    suppose you have a table(itab) in which you have all the data related to player and the score.
    before displaying the data to ALV apply the condition like:
    fetch score from DBTABLE into table itab where player in s_player.
    where s_player is your select option.
    and then pass your ITAB to ALV.
    i hope it will work.
    Thanks
    Lalit Gupta

  • Exception while creating f4 help for editable alv field

         hi experts
    i have created search help for editable alv field by following link
    http://scn.sap.com/docs/DOC-39832
    But i m getting an exception :  Field symbol has not yet been assigned.
    exception area code
       read table <tab1> into <ls_wa> index i_row_id.
        assign component m_cl_variant->ms_layout-stylefname
               of structure <ls_wa> to <l_field>.
        read table <l_field> into ls_style
                with table key fieldname = is_col_id-fieldname.
        if sy-subrc eq 0.
          if ls_style-style o mc_style_enabled.
            ready_for_input = 1.
            exit.
          elseif ls_style-style o mc_style_disabled.
            ready_for_input = 0.
            exit.
          endif.
    first read statement is giving sy-subrc =4.
    PS: exception from method..:IS_READY_FOR_INPUT
    kindly help

    Hello Ankush,
    read table <tab1>  ASSIGNING <ls_wa> index i_row_id.
    IF  <ls_wa> IS ASSIGNED.
        assign component m_cl_variant->ms_layout-stylefname
               of structure <ls_wa> to <l_field>.
        read table <l_field> into ls_style
                with table key fieldname = is_col_id-fieldname.
        if sy-subrc eq 0.
          if ls_style-style o mc_style_enabled.
            ready_for_input = 1.
            exit.
          elseif ls_style-style o mc_style_disabled.
            ready_for_input = 0.
            exit.
          endif.
    ENDIF.
    Regards,
    TP

  • Getting dump when using do_sum in alv field cat in the output of the report

    Dear Freinds,
                 Iam getting the alv report when i click on the segma field (Sum) on my salary
    field iam getting dump. and also if i try to print my alv output iam getting dump , only
    happening to my custom report.
    i have used the following code pleae correct me .
    This perform is used for Layout settings
      perform st_layout_build  using gs_layout.
    form st_layout_build  using  st_ls_layout type slis_layout_alv.
       st_ls_layout-no_input          = 'X'.
      st_ls_layout-colwidth_optimize = 'X'.
    st_ls_layout-zebra             = 'X'.
    st_ls_layout-detail_popup      = 'X'.
    endform.                    " st_layout_build
    Field Catalog details
    perform st_fieldcat_init changing gt_fieldcat.
    form st_fieldcat_init  changing  fp_i_fieldcat type slis_t_fieldcat_alv.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 1.
      ls_fieldcat-fieldname    = 'ORGUNIT'.
      ls_fieldcat-seltext_l    = 'Orgunit'.
    ls_fieldcat-no_out       = 'X'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 2.
      ls_fieldcat-fieldname    = 'ORGTEXT'.
      ls_fieldcat-seltext_l    = 'Orgdesc'.
    ls_fieldcat-no_out       = 'X'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'SALARY'.
      ls_fieldcat-seltext_l    = 'Salary'.
      ls_fieldcat-col_pos      = 3.
      ls_fieldcat-outputlen   = 15.
      ls_fieldcat-do_sum       = 'X'.
      ls_fieldcat-datatype     = 'CURR'.    "CURR
      append ls_fieldcat to fp_i_fieldcat.
    endform.
    Variant
      perform st_variant_init  using gs_variant g_repid.
    form st_variant_init   using  st_gs_variant type disvariant
                                 st_repid      like sy-repid.
      clear st_gs_variant.
      st_gs_variant-report = st_repid.
    endform.                    " st_variant_init
      g_repid = sy-repid.
      perform st_comment_build  using gt_list_top_of_page[].
    form st_comment_build  using   st_lt_top_of_page type slis_t_listheader.
      data: ls_line type slis_listheader.
    Listenüberschrift: Typ H
      clear ls_line.
      ls_line-typ  = 'H'.
    LS_LINE-KEY:  not used for this type
      ls_line-info = text-000.
      append ls_line to st_lt_top_of_page.
    endform.                    " st_comment_build
         call function 'REUSE_ALV_GRID_DISPLAY'
          exporting
             i_buffer_active        = 'X'
            i_callback_top_of_page = 'TOP_OF_PAGE'
            i_callback_program     = g_repid
            is_layout              = gs_layout
            it_fieldcat            = gt_fieldcat[]
           i_structure_name       = 'i_final'   "c_i_final "'objec'
           i_save                 = g_save
            is_variant             = gs_variant
          tables
            t_outtab               = fp_i_pyrol_final
          exceptions
            program_error          = 1
            others                 = 2.
        if sy-subrc ne 0.
          message e018. " Displaying the ALV GRID has failed
        endif.
    Please could any  one let me know why iam getting dump when iam clicking for total
    on my salary field.
    Regards
    latha

    Dear Chandu,
    my code iam giving in details
    types : begin of ty_output_data,
            staffno     type pernr_d,
            staffname   type emnam,
            grade       type stell,
            orgunit     type orgeh,
            orgtext     type hr_mcstext,
            psgroup     type trfgr,      " Pay Scale Group
            salary      type maxbt,       "PAD_AMT7S,
            rrefunded   type pad_amt7s,
            leavepay    type pad_amt7s,
            mshortfal   type pad_amt7s,   " Medical Shortfall
            echkshfal   type pad_amt7s,   " Execute checkup shortfall
            ofindeduc   type pad_amt7s,   " Other Finance Deduction
            mtyprem     type pad_amt7s,   " maternity premium
            vpbonus     type pad_amt7s,   " VP/Bonus
            gratuity    type pad_amt7s,   " Gratuity
            vpay        type pad_amt7s,   " Variable pay
            mallowance  type pad_amt7s,   " Meal Allowance
            overtime    type pad_amt7s,   " overtime
            other       type  pad_amt7s,  "  OTHER
            pfundeecon  type pad_amt7s,   " PFund Employee's Contribution
            banktrnsfer type pad_amt7s,   " Bank Transfer
            count       type i,
            end of ty_output_data.
    data : i_final         type standard table of ty_output_data.
    iam getting all my data in the internal table  I_FINAL.
    perform get_final_alv  using  i_final.
    form get_final_alv  using   fp_i_pyrol_final type ty_t_output_data.
    *local variable declarations
      data : l_v_idx      type sy-tabix.
    *local work areas
      data : l_wa_final type ty_output_data.
      g_save = 'A'.
    This perform is used for Layout settings
      perform st_layout_build  using gs_layout.
    Field Catalog details
      perform st_fieldcat_init changing gt_fieldcat.
    Variant
      perform st_variant_init  using gs_variant g_repid.
      g_repid = sy-repid.
      perform st_comment_build  using gt_list_top_of_page[].
      if not fp_i_pyrol_final is initial.
        delete adjacent duplicates from fp_i_pyrol_final comparing all fields.
        call function 'REUSE_ALV_GRID_DISPLAY'
          exporting
             i_buffer_active        = 'X'
            i_callback_top_of_page = 'TOP_OF_PAGE'
            i_callback_program     = g_repid
            is_layout              = gs_layout
            it_fieldcat            = gt_fieldcat[]
           i_structure_name       = 'i_final'   "c_i_final "'objec'
           i_save                 = g_save
            is_variant             = gs_variant
          tables
            t_outtab               = fp_i_pyrol_final
          exceptions
            program_error          = 1
            others                 = 2.
        if sy-subrc ne 0.
          message e018. " Displaying the ALV GRID has failed
        endif.
      endif.
    endform.                    " get_final_alv
    form st_layout_build  using  st_ls_layout type slis_layout_alv.
       st_ls_layout-no_input          = 'X'.
      st_ls_layout-colwidth_optimize = 'X'.
    st_ls_layout-zebra             = 'X'.
    st_ls_layout-detail_popup      = 'X'.
    endform.                    " st_layout_build
    form st_fieldcat_init  changing  fp_i_fieldcat type slis_t_fieldcat_alv.
      data: ls_fieldcat type slis_fieldcat_alv.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 1.
      ls_fieldcat-fieldname    = 'ORGUNIT'.
      ls_fieldcat-seltext_l    = 'Orgunit'.
    ls_fieldcat-no_out       = 'X'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 2.
      ls_fieldcat-fieldname    = 'ORGTEXT'.
      ls_fieldcat-seltext_l    = 'Orgdesc'.
    ls_fieldcat-no_out       = 'X'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 5.
      ls_fieldcat-fieldname    = 'STAFFNAME'.
    ls_fieldcat-no_out       = 'X'.
      ls_fieldcat-seltext_l    = 'StaffName'.
      append ls_fieldcat to fp_i_fieldcat.
       clear ls_fieldcat.
      ls_fieldcat-col_pos      = 4.
      ls_fieldcat-fieldname    = 'STAFFNO'.
    ls_fieldcat-no_out       = 'X'.
      ls_fieldcat-seltext_l    = 'StaffNo.'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 6.
      ls_fieldcat-fieldname    = 'GRADE'.
      ls_fieldcat-seltext_l    = 'Grade'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 3.
      ls_fieldcat-fieldname    = 'COUNT'.
      ls_fieldcat-seltext_l    = 'Headcount'.
      append ls_fieldcat to fp_i_fieldcat.
    if the field name is 'Salary' then do a sum on this field.
    IF  fp_fname = c_betrg.
        l_wa_fieldcat-do_sum    = c_x.
    ENDIF.
    NOTE : IAM GETTING PROBLEM IN THE BELOW SALARY.
    IAM JUST CHECKING ITSELF NOT ALLOWING ME TO EXECUTE
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'SALARY'.
      ls_fieldcat-seltext_l    = 'Salary'.
      ls_fieldcat-col_pos      = 7.
      ls_fieldcat-outputlen   = 20.
      ls_fieldcat-do_sum       = 'X'.
      ls_fieldcat-datatype     = 'CURR'.    "CURR
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 9.
      ls_fieldcat-fieldname    = 'LEAVEPAY'.
      ls_fieldcat-seltext_l    = 'Leave Pay'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 10.
      ls_fieldcat-fieldname    = 'MSHORTFAL'.
      ls_fieldcat-seltext_l    = 'Med.Sfall'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 11.
      ls_fieldcat-fieldname    = 'ECHKSHFAL'.
      ls_fieldcat-seltext_l    = 'EX.Chckup.Sfall'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 12.
      ls_fieldcat-fieldname    = 'OFINDEDUC'.
      ls_fieldcat-seltext_l    = 'Oth.Fin.Deduction'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 13.
      ls_fieldcat-fieldname    = 'MTYPREM'.
      ls_fieldcat-seltext_l    = 'Mat.Premium'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 14.
      ls_fieldcat-fieldname    = 'VPBONUS'.
      ls_fieldcat-seltext_l    = 'VP/Bonus'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 15.
      ls_fieldcat-fieldname    = 'GRATUITY'.
      ls_fieldcat-seltext_l    = 'Gratuity'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 16.
      ls_fieldcat-fieldname    = 'VPAY'.
      ls_fieldcat-seltext_l    = 'Variable Pay'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 17.
      ls_fieldcat-fieldname    = 'MALLOWANCE'.
      ls_fieldcat-seltext_l    = 'Meal.Allowance'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 18.
      ls_fieldcat-fieldname    = 'OVERTIME'.
      ls_fieldcat-seltext_l    = 'Overtime'.
      append ls_fieldcat to fp_i_fieldcat.
        clear ls_fieldcat.
      ls_fieldcat-col_pos      = 19.
      ls_fieldcat-fieldname    = 'OTHER'.
      ls_fieldcat-seltext_l    = 'Other'.
      append ls_fieldcat to fp_i_fieldcat.
    pfundeecon
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 20.
      ls_fieldcat-fieldname    = 'P FUND EMPLOYEES CONTRIBUTION'.
      ls_fieldcat-seltext_l    = 'P.Fund.Emp.Contrib'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 21.
      ls_fieldcat-fieldname    = 'BANKTRNSFER'.
      ls_fieldcat-seltext_l    = 'Payment'.
      append ls_fieldcat to fp_i_fieldcat.
    endform.                    " st_fieldcat_init
    form st_variant_init   using  st_gs_variant type disvariant
                                 st_repid      like sy-repid.
      clear st_gs_variant.
      st_gs_variant-report = st_repid.
    endform.                    " st_variant_init
    form st_comment_build  using   st_lt_top_of_page type slis_t_listheader.
      data: ls_line type slis_listheader.
    Listenüberschrift: Typ H
      clear ls_line.
      ls_line-typ  = 'H'.
    LS_LINE-KEY:  not used for this type
      ls_line-info = text-000.
      append ls_line to st_lt_top_of_page.
    endform.                    " st_comment_build
          FORM TOP_OF_PAGE                                              *
    form top_of_page.
      data: l_i_detailheader type slis_t_listheader.
    To get the header for ALV
      perform detail_header changing l_i_detailheader.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
          it_list_commentary = l_i_detailheader.
    endform.                    "top_of_page
    form detail_header  changing fp_i_detailheader type slis_t_listheader.
      data: l_wa_header       type slis_listheader,
            l_v_time         type slis_edit_mask,
            l_v_date         type slis_edit_mask,
            l_v_abkrs        type char5,
            l_v_pabrj        type char8,
            l_v_pagno        type char10.
    Local Constants
      constants: l_c_h type char1 value 'H',
                 l_c_1  type i     value '1',
                 l_c_edit type char10 value '__.__.____',
                 l_c_slash  type c value '/'. " constant for slash
    To display the report Header
      l_wa_header-typ = l_c_h.
    WRITE sy-repid TO l_wa_header-info LEFT-JUSTIFIED.
      write text-014  to l_wa_header-info left-justified.
      append l_wa_header to fp_i_detailheader.
      clear l_wa_header.
    To display the Page no
      l_v_pagno =   sy-pagno + l_c_1.
      l_wa_header-typ = c_s.
      l_wa_header-key = text-008. " Page No:
      l_wa_header-info =  l_v_pagno.
      append l_wa_header to fp_i_detailheader.
      clear l_wa_header.
    To Display the User ID
      l_wa_header-typ = c_s.
      l_wa_header-key = text-009. " User ID
      l_wa_header-info = sy-uname.
      append l_wa_header to fp_i_detailheader.
      clear l_wa_header.
    To Display the Date/Time
      l_wa_header-typ = c_s.
      l_wa_header-key = text-010. " Date/Time:
      l_v_time = sy-uzeit.
      l_v_date = sy-datum.
      write: sy-uzeit to l_v_time.
      write sy-datum to l_v_date using edit mask l_c_edit.
      concatenate l_v_date
                  l_c_slash
                  l_v_time into l_wa_header-info+0(25) separated by space.
      append l_wa_header to fp_i_detailheader.
      clear: l_wa_header, l_v_date.
    To Display the Report Description
      l_wa_header-typ = c_s.
      l_wa_header-key = text-011.                " Report Description
      l_wa_header-info = text-012.
      append l_wa_header to fp_i_detailheader.
      clear l_wa_header.
      append l_wa_header to fp_i_detailheader.
    endform.                    " detail_header
    I will be greatful if any one can please help me in removing me the dump.
    REGARDS
    LATHA.

  • ALV Row Counter or row number

    hi,
    plz i want to make row counter or row number in alv report , how can i?
    ex.
    NO  :  Name   :  age
    1      :  ahm    :  12
    2       : a2        :  25
    3        :  a3       : 30
    30
    waiting answers
    thanks

    Take an additional field in your ITAB as 'counter'
    Make counter = counter + 1, before your APPEND ITAB statement.
    But I think better options is in TOP-OF-PAGE, take a value of counter = '<no>'.
    DESCRIBE TABLE it_final LINES t_cnt.
      CONDENSE t_cnt.
    wa_top-typ = 'S'.
      wa_top-key = 'Total no.of Records: '.
      wa_top-info = t_cnt.
      APPEND wa_top TO it_top.
      CLEAR wa_top.
    Edited by: ashleshabhagatshelke on Aug 31, 2010 3:24 AM

Maybe you are looking for