Error in ALV output

Hi All,
I am getting a runtime error in output while i try to do sum in ALV output.
In my ouput table i want to do sum for below feilds those are defined in output table :
CURR TYPE P DECIMALS 2,         
B30 TYPE  P DECIMALS 2,        
B60 TYPE P DECIMALS 2,         
B90 TYPE P DECIMALS 2,       
B120 TYPE P DECIMALS 2,        
BG121 TYPE P DECIMALS 2,
i defined feildcatalog as below:
WA_FIELDCAT-FIELDNAME = 'B60'.
WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
WA_FIELDCAT-SELTEXT_L = TEXT-033.
WA_FIELDCAT-DO_SUM = 'X' .
  WA_FIELDCAT-OUTPUTLEN = 17.
  WA_FIELDCAT-DATATYPE = 'DEC'.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR  WA_FIELDCAT.
even if i try to download the ouput feilds in file,then also i am getting a run time error as field symbols are not assign,
Please help.
Thanks and Regards,
Mohit

Hi,
I am getting a dump that cause of  by a message type (X).Same i get if i try to download the file.
My ouput internal table is as below:
data:BEGIN OF IT_FINAL occurs 0,
      BUKRS TYPE BUKRS,               "Company code
      KUNNR TYPE KUNNR,               "Customer number
      NAME1 TYPE NAME1,               "Name
      BILL_TO TYPE KUNNR,              "Bill To
      BILL_NAME TYPE NAME1,           "Bill To Name
      BRANCH TYPE FILKD,              "Branch
      BRANCH_NAME TYPE NAME1,         "Branch Name
      BRANCH_REGION TYPE REGIO,      "Region
      BRANCH_CITY TYPE ORT01,        "City
      BELNR TYPE BELNR,              "Accounting Document Number
      ACC_CLK_SOLD  TYPE BUSAB,       "A/C Clerk Sold To
      ACC_CLK_SOLD_NAME TYPE SNAME,  "A/C Name
      ACC_CLK_PAYER TYPE BUSAB,      "A/C Payer
      ACC_CLK_PAYER_NAME TYPE BUSAB,  "A/C Payer Name
      ASM_PART  TYPE  KUNN2,          "ASM Partner
      ASM_NAME TYPE   NAME1,          "ASM Name
      DUNNING TYPE BUSAB,             "Dunning Clerk
      KATR4 TYPE KATR4,               "Local /National Account
      ZUONR TYPE DZUONR,              "Assingment Number
      REFERENCE TYPE XBLNR,           "Reference
      XREF1  TYPE  XREF1,             "Ref Key1
      XREF2  TYPE  XREF2,             "Ref Key2
      XREF3  TYPE  XREF3,             "Ref Key3,
      SGTXT     TYPE SGTXT,           "Item Text
      DUE_DATE  TYPE SY-DATUM,        "Due Date
      DOC_DATE  TYPE BLDAT,           "Doc Date
      BILL_DOC_NO TYPE VBELN,         "Billing Doc Number
      ZTERM TYPE  DZTERM,              "Terms
      HKONT TYPE HKONT,               "Gl Account
      CURR TYPE P DECIMALS 2,         "Current Balance
      B30 TYPE  P DECIMALS 2,         "1-30
      B60 TYPE P DECIMALS 2,          "32-60
      B90 TYPE P DECIMALS 2,          "61-90
      B120 TYPE P DECIMALS 2,         "91-120
      BG121 TYPE P DECIMALS 2,        " >121
      BAL TYPE p DECIMALS 2,          "Balance
      P_CURR TYPE CHAR10,       "Current Percentage
      PB30 TYPE CHAR10,         "1-30 %
      PB60 TYPE CHAR10,         "32-60 Percentage
      PB90 TYPE CHAR10,         "61-90 Percentage
      PB120 TYPE CHAR10,        "91-120 Percentage
      PBG121 TYPE CHAR10,       ">121 %
      END OF it_final..
My fieldcatalog is below:
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
    WA_FIELDCAT-TABNAME   =  'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L =   TEXT-004.
    WA_FIELDCAT-OUTPUTLEN = 12.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'KUNNR'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-005.
    WA_FIELDCAT-OUTPUTLEN = 10.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'NAME1'.
    WA_FIELDCAT-TABNAME   =  'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L =  TEXT-006.
    WA_FIELDCAT-OUTPUTLEN = 30.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'BILL_TO'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-007.
    WA_FIELDCAT-OUTPUTLEN = 10.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'BILL_NAME'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-008.
    WA_FIELDCAT-OUTPUTLEN = 30.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'BRANCH'  .
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-009.
    WA_FIELDCAT-OUTPUTLEN = 10.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'BRANCH_NAME'  .
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-043.
    WA_FIELDCAT-OUTPUTLEN = 30.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'BRANCH_REGION'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L =  TEXT-010.
    WA_FIELDCAT-OUTPUTLEN = 8.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'BRANCH_CITY'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-011.
    WA_FIELDCAT-OUTPUTLEN = 12.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'BELNR'  .
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-012.
    WA_FIELDCAT-OUTPUTLEN = 11.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'ACC_CLK_SOLD'  .
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-013.
    WA_FIELDCAT-OUTPUTLEN = 10.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'ACC_CLK_SOLD_NAME'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-014.
    WA_FIELDCAT-OUTPUTLEN = 30.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'ACC_CLK_PAYER' .
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L =  TEXT-015.
    WA_FIELDCAT-OUTPUTLEN = 10.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'ACC_CLK_PAYER_NAME'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L =  TEXT-016.
    WA_FIELDCAT-OUTPUTLEN = 30.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'ASM_PART'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-017.
    WA_FIELDCAT-OUTPUTLEN = 10.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'ASM_NAME'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-018.
    WA_FIELDCAT-OUTPUTLEN = 30.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'DUNNING' .
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-019.
    WA_FIELDCAT-OUTPUTLEN = 10.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'KATR4'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-020.
    WA_FIELDCAT-OUTPUTLEN = 2.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'ZUONR'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-044.
    WA_FIELDCAT-OUTPUTLEN = 18.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'REFERENCE'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-021.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'XREF1'  .
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-022.
    WA_FIELDCAT-OUTPUTLEN = 12.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'XREF2'  .
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-023.
    WA_FIELDCAT-OUTPUTLEN = 12.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'XREF3'  .
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-024.
    WA_FIELDCAT-OUTPUTLEN = 12.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'SGTXT'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-025.
    WA_FIELDCAT-OUTPUTLEN = 50.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'DUE_DATE'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-026.
    WA_FIELDCAT-OUTPUTLEN = 10.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'DOC_DATE'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-027.
    WA_FIELDCAT-OUTPUTLEN = 10.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'BILL_DOC_NO'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-028.
    WA_FIELDCAT-OUTPUTLEN = 15.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'ZTERM'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-029.
    WA_FIELDCAT-OUTPUTLEN = 5.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'HKONT'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-030.
    WA_FIELDCAT-OUTPUTLEN = 11.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'CURR'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-031.
   WA_FIELDCAT-OUTPUTLEN = 17.
    WA_FIELDCAT-DO_SUM = 'X' .
    WA_FIELDCAT-DATATYPE = 'DEC'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'B30'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-032.
    WA_FIELDCAT-DO_SUM = 'X' .
   WA_FIELDCAT-OUTPUTLEN = 17.
    WA_FIELDCAT-DATATYPE = 'DEC'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'B60'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-033.
    WA_FIELDCAT-DO_SUM = 'X' .
   WA_FIELDCAT-OUTPUTLEN = 17.
    WA_FIELDCAT-DATATYPE = 'DEC'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'B90'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-034.
    WA_FIELDCAT-DO_SUM = 'X' .
   WA_FIELDCAT-OUTPUTLEN = 17.
    WA_FIELDCAT-DATATYPE = 'DEC'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'B120'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-035.
    WA_FIELDCAT-DO_SUM = 'X' .
   WA_FIELDCAT-OUTPUTLEN = 17.
    WA_FIELDCAT-DATATYPE = 'DEC'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'BG121'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-036.
    WA_FIELDCAT-DO_SUM = 'X' .
   WA_FIELDCAT-OUTPUTLEN = 17.
    WA_FIELDCAT-DATATYPE = 'DEC'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'BAL'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-045.
    WA_FIELDCAT-DO_SUM = 'X' .
   WA_FIELDCAT-OUTPUTLEN = 17.
    WA_FIELDCAT-DATATYPE = 'DEC'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'P_CURR'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-037.
    WA_FIELDCAT-OUTPUTLEN = 17.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'PB30'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-038.
    WA_FIELDCAT-OUTPUTLEN = 17.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'PB60'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-039.
    WA_FIELDCAT-OUTPUTLEN = 17.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'PB90'.
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-040.
    WA_FIELDCAT-OUTPUTLEN = 17.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'PB120' .
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-041.
    WA_FIELDCAT-OUTPUTLEN = 17.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'PBG120' .
    WA_FIELDCAT-TABNAME   = 'IT_FINAL'.
    WA_FIELDCAT-SELTEXT_L = TEXT-042.
    WA_FIELDCAT-OUTPUTLEN = 17.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
     Please help.
Thanks
Mohit

Similar Messages

  • Spool Error in ALV output

    Dear Friends,
    I have report  which has 46 output columns. When I try to print to spool the values get shuffled. Specially the field VENDOR NAME....I have observed if i comment the vendor name field in the field catalog...the reports in spool shows accurately.
    1. I have changed the line-size = 1023
    2. The output format is set for coloumn 1023
    3.In SPAD the output Controller is also marked for  Number of columns for List Display from Format .
    Please advice what is wrong with the Vendor Name.
    Thanks.
    Simraan.

    Hai Manas,
    Recently I tried replacing VENDOR NAME by VENDOR NUMBER.
    And in spool exactly at Vendor Number fields its getting shuffled with  nearby SO number  and customer number fields  data..
    In the spool in the heading its shows VENDOR NAME/VENDOR NUMBER but data is of sales order number and customer number..
    please let me know what exactly you mean by other fields getting overridden..
    Thanks,
    Simraan..

  • Runtime Error while summing a column in ALV output

    Dear All,
    I have developed an ALV Report and the report is giving output without any flaws.
    I have defined proper field catalog and displaying the results using REUSE_ALV_GRID function module.
    Now the report is generating Runtime Error while the user selects a column and click the SUM icon.
    The fields like Qty, or amounts are also theowing runtime error while summing up their column in the ALV output.
    What might be the reason and how to resolve this issu?
    Regards
    Pavan

    Hi ,
    I don't know how you have write  down the code but follow the below coding example:
    FOR TOTAL:
    there is a property of fieldcatalog, that is do_sum.
    USE COED LIKE:
    PERFORM fieldcat USING:
    '1' 'MATNR' 'I_MARD' 'MATERIAL NO' 'MARD' 'MATNR ' ' ',
    '2' 'NETWR' 'I_MARD' 'PLANT' 'MARD' 'WERKS' ' ',
    FORM fieldcat USING value(p_0029)
    value(p_0030)
    value(p_0031)
    value(p_0032)
    wa_fieldcat-col_pos = p_0029.
    wa_fieldcat-fieldname = p_0030.
    wa_fieldcat-tabname = p_0031.
    wa_fieldcat-reptext = p_0032.
    wa_fieldcat-do_sum = 'X'.
    APPEND wa_fieldcat TO i_fieldcat.
    ENDFORM. " FIELDCAT
    in final output you will get the total of currency field.
    FOR SUB TOTAL:
    decleare: i_sort type standard table of slis_sortinfo_alv,
              wa_sort type slis_t_sortinfo_alv.
    wa_sort-spos = '1'.
    wa_sort-fieldname = 'field1'.
    wa_sort-subtot = 'X'.
    append wa_tab to i_sort.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    it_fieldcat = it_fieldcat
    it_sort = i_sort
    Hope this can solve your pbs.
    If you need more inputs let me know.
    Regards,
    Tutun

  • 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.]

  • Getting ERROR when downloading alv output to Excel

    Hello All,
    I get a error message when I try to use the standard funtionality to download the alv output to excel.
    The current statement only supports character-type data objects.
    What happened?
    The current ABAP/4 program "SAPLKKBL " had to be terminated because
    one of the statements could not be executed.
    This is probably due to an error in the ABAP/4 program.
    Error analysis
    In statement
       "STRLEN( obj )..."
    the argument "obj" can only take a character-type data object.
    Source code extract
    038620   *   ansonsten entspricht sich min. Ausgabelänge und Ausprägungslänge
    038630       else.
    038640         if gs_fc-tech_form ne 99.
         >           gs_out-hlplen = strlen(  ).
    038660         endif.
    038670       endif.
    In this case, the operand "obj" has the non-character type "I".
    Please can anyone put some light on this. It is veru difficult to go through the whole std functionality to download.
    Thanks for all support guys!
    Sri.

    Hi srikanth,
    This error comes because the values present in any one of the displayed coloums containing special character like * present before or after the number....  i.e  instead of 4 ...**4.
    While displaying in the screen it is of no problem. since both *4 are converted into char format (internally) and gets displayed.
    But while you download the same throu the EXCEL functionality SAP will intenally convert the same into NUMERIC format. Since 4 is number.
    So in that case *4 will cause dump.
    *So find out the place in which the value appearing like this *4 and try to correct it.
    *Surely it is of Field LENGTH problem. Try to increase the length of the field 4.
    It Should WORK.!!!..  else post ur query here.
    REWARD POINTS IF USEFUL
    ~Lakshmiraj~

  • Error while dowloading ALV output

    Hi All,
      When am trying to download the ALV output to a spreadsheet it is giving an information message 'Filter criteria, sorting, totals and subtotals are not taken into account' and the followed by the message 'Export of a list object was terminated (internal error)'.This is occuring when the ALV does not contain any data otherwise it donload fine.In other standard report even if the ALV doesnt have data it downloads empty data to excel.what could be wrong?
    THanks,
    Rakesh.

    Hi rakesh,
      You can put one condition to check the final internal table consists any data or not. If that table is not initial then display the output otherwise just display a message 'Data not found'.
    I think this is the solution .
    IF NOT T_FINAL[] IS INITIAL.
    * Fill field catalog table
        PERFORM FILL_FIELDCATALOG.
    * Fill Layout options
        PERFORM FILL_LAYOUT.
        CALL SCREEN 0100.
    ELSE
      MESSAGE ' No data found' Type 'E'.
      ENDIF.
    Check  whether you filled  fieldcatalog correctly or not.
    Regards,
    Rajitha.

  • Page-break in alv background job for alv output variant not coming correctl

    Hi,
    I have created an ALV grid report. When i run the report in background i get the output with correct page-break on FIELD1. Now when i run the report in background with an "ALV output variant" (its the ALV variant that controls the fields display in the output; this is not the program variant), i do not get the page-break on FIELD1.  I have already build the sort criteria and using:
    gs_sort-group = '* '.     "New-Page
    Please let me know what could be reason for not getting the page-break in background when i am using the alv output variant and how do i correct this problem.
    Regards,
    Rakesh

    Hello Everyone,
    I have solved the problem. While running the program in background, we get the page-breaks when we use the below part of code in the sort catalogue with the condition that the program variant should not use any ALV layout variant.
    gs_sort-group = '* '.     "New-Page
    If you are using the ALV layout variant in the program variant then we can check the ROWPOS, COLPOS, and NO_OUT for that ALV layout variant and pass them along in the fieldcatalog table. You should be careful with not to pass the layout variant in the DISVARIANT. You can notice that i have cleared it and simply passing the program name into that.
    *C-- Process separately for jobs running in Background. Actually
    *C-- sortcat-group solves the problem only in Foreground. In background
    *C-- when ALV layout variant is not selected then it works otherwise it
    *C-- fails. So for background jobs we are reading the fieldcat and then
    *C-- passing the same in the display FM.
      IF sy-batch = 'X'.
        CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
          EXPORTING
           i_dialog                  = ' '
           i_user_specific           = ' '
           i_default                 = ' '
    *   I_TABNAME_HEADER          =
    *   I_TABNAME_ITEM            =
            it_default_fieldcat       = gt_fieldcat
            i_layout                  = gs_layout
    *   I_BYPASSING_BUFFER        =
    *   I_BUFFER_ACTIVE           =
         IMPORTING
    *   E_EXIT                    =
           et_fieldcat               = lt_fieldcat
    *     et_sort                   = gt_sort[]
    *   ET_FILTER                 =
    *     es_layout                 = gs_layout
         CHANGING
           cs_variant                = gs_disvariant
         EXCEPTIONS
           wrong_input               = 1
           fc_not_complete           = 2
           not_found                 = 3
           program_error             = 4
           OTHERS                    = 5
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CLEAR gs_fieldcat.
        LOOP AT gt_fieldcat INTO gs_fieldcat.
    *C-- Transfer all position changes to gt_fieldcat from lt_fieldcat
          CLEAR ls_fieldcat.
          READ TABLE lt_fieldcat
                INTO ls_fieldcat
                WITH KEY fieldname = gs_fieldcat-fieldname.
          IF sy-subrc = 0.
            gs_fieldcat-row_pos = ls_fieldcat-row_pos.
            gs_fieldcat-col_pos = ls_fieldcat-col_pos.
            gs_fieldcat-no_out = ls_fieldcat-no_out.
            MODIFY gt_fieldcat FROM gs_fieldcat INDEX sy-tabix.
            CLEAR gs_fieldcat.
          ENDIF.
        ENDLOOP.
    *C-- Clear the disvariant for the background job as it contains the ALV
    *C-- layout varinat
        CLEAR gs_disvariant.
        gs_disvariant-report = 'ZGPPMP0001'.
    Then pass gt_fieldcat to 'REUSE_ALV_GRID_DISPLAY'.
    The reason i'm doing it this way is that when we pass the layout variant name, the contents in gt_fieldcat were getting modified.
    One more thing i'd like to point out is that that, i tried to delete the fields with no_out = 'x'. Now when i ran the program in background with all the fields in sort catalog (suppose there are 2 fields field1 and field2) also in fieldcatalog it ran fine. In the next run in background i removed one of the fields in sort catalog from the fieldcatalog (delete the fields with no_out = 'x') and i got dump. Basically i had hidden field1 and so the code which was deleting fields with no_out = 'x' deleted this field from gt_fieldcat. So basically we should not delete fields with no_out = 'x'.
    I was getting ABAP runtime errors    MESSAGE_TYPE_X in the following part of the standard code.
    000310     LOOP AT CT_SORT INTO LS_SORT.
    000320
    000330       READ TABLE IT_FIELDCAT ASSIGNING <LS_FIELDCAT>
    000340            WITH KEY FIELDNAME = LS_SORT-FIELDNAME BINARY SEARCH.
    000350       IF SY-SUBRC NE 0.
         >         MESSAGE X000(0K).
    000370       ENDIF.
    000380
    000390       LS_SORT-SELTEXT = <LS_FIELDCAT>-SELTEXT.
    i have just mentioned this part because when i checked the forum many people were getting such errors "MESSAGE_TYPE_X". This could also be one of the reasons.

  • ALV output problem in displaying the field lengths.( LONG_DES1 & LONG DES)

    I have  declared itab of ALV output like below...
    Internal table for ALV report generation***********
    DATA : Begin of pdet_otab_alv occurs 0,
            bukrs LIKE bsid-bukrs, "Company code
            postm(4),              "Posting month (YYMM format)
            xblnr LIKE bsid-xblnr, "Reference document number
            kunnr LIKE bsid-kunnr, "Customer (Supplier Billing Customer)
            name1 LIKE kna1-name1,                              "Name 1
            buzei like bsid-buzei,
            gjahr like bsid-gjahr,
            filkd like bsid-filkd, "Rep Number
            rname like kna1-name1, "Rep Name
            belnr LIKE bsid-belnr, "Document number (invoice number)
            blart LIKE bsid-blart, "Document type
            zfbdt LIKE bsid-zfbdt, "Baseline date
            zterm LIKE knb1-zterm, "Terms
            netdt LIKE bsega-netdt,"Due date
            sgtxt LIKE bsid-sgtxt, "Text
            agerg TYPE t_agerg,    "Age range of invoice
            wrbtr LIKE bsid-wrbtr, "Original invoice amount
            due   LIKE bsid-wrbtr, "Amount outstanding on invoice
           long_des(250) type c,   " Long description
    <b>            long_des  TYPE string,
                long_des1 TYPE string,</b>      
          date_s(10) type c,  " Date
            short_des(20) type c,  " Short Description
            counter type i,
           End of pdet_otab_alv.
    And after filling the internal table fields ( fields 'LONG_DES1' & 'LONG_DES'  from FM READ_TEXT 's longtext, which are  of 265 chars each )
    <b>'LONG_DES1' & 'LONG_DES' are trimmed  in ALV out put  WHY ?</b>
      w_fieldcat-fieldname = 'LONG_DES1'.
      w_fieldcat-tabname   = 'PDEL_OTAB_ALV'.
    w_fieldcat-ref_fieldname = 'SCRTEXT_L'.
    w_fieldcat-ref_tabname   = 'DD03P'.
      w_fieldcat-seltext_l = 'Original Note'.
      w_fieldcat-col_pos   = 17.
      APPEND w_fieldcat TO fieldcat.
      CLEAR w_fieldcat.
      w_fieldcat-fieldname = 'LONG_DES'.
      w_fieldcat-tabname   =  'PDEL_OTAB_ALV'.
    w_fieldcat-ref_fieldname = 'SCRTEXT_L'.
    w_fieldcat-ref_tabname   = 'DD03P'.
      w_fieldcat-seltext_l = 'Latest Note'.
      w_fieldcat-col_pos   = 18.
      APPEND w_fieldcat TO fieldcat.
      CLEAR w_fieldcat.
    <b>next part i.e.,   before passing fieldcat.... I have filled s_layout like below.</b>
    <b>  s_layout-max_linesize = 1000.
      s_layout-colwidth_optimize = 'X'.</b>
    Call the following function to display output in ALV form
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program = 'ZFRSBOI0'
                is_layout          = s_layout
                it_fieldcat        = fieldcat
                it_events          = p_events[]
               it_sort            = p_it_sort[]
                i_save             = 'A'
           TABLES
                t_outtab           = pdet_otab_alv1
           EXCEPTIONS
                program_error      = 1
                OTHERS             = 2.
    If the function call is not successful, raise error message
    and come out from the program
      IF sy-subrc <> 0.
        message e000(00) with
                          'Unable to display report'(e01).
        exit.
      ENDIF.

    some body suggested me....we can display full length of text by below coding ?
    Is that not correct - just asking....
    s_layout-max_linesize = 1000.
    s_layout-colwidth_optimize = 'X'.
    Call the following function to display output in ALV form
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = 'ZFRSBOI0'
    is_layout = s_layout
    it_fieldcat = fieldcat
    it_events = p_events[]
    it_sort = p_it_sort[]
    i_save = 'A'
    TABLES
    t_outtab = pdet_otab_alv1
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    If the function call is not successful, raise error message
    and come out from the program
    IF sy-subrc <> 0.
    message e000(00) with
    'Unable to display report'(e01).
    exit.
    ENDIF.

  • Error in ALV

    Hi all, pls help me its urgent,
    i'm displaying one internal table in alv gri .
    i used 'REUSE_ALV_GRID_DISPALY' .
    it gives me alv output . but when i'm clicking on 'LOCAL_FILE' button on application tool bar then it gives dump error .
    the dump error is as follows ,
    ' Field symbol has not yet been assigned'.
    ASSIGNED                                                          
    Date and Time          21.05.2008 15:26:41                                                                               
    ShrtText                                                                               
    Field symbol has not yet been assigned.                                                       
    What happened?                                                                               
    Error in ABAP application program.                                                                               
    The current ABAP program "SAPLKKBL" had to be terminated because one of the                   
        statements could not be executed.                                                                               
    This is probably due to an error in the ABAP program.                                         
    What can you do?                                                                               
    Print out the error message (using the "Print" function)                                      
        and make a note of the actions and input that caused the                                      
        error.                                                                               
    To resolve the problem, contact your SAP system administrator.                                
        You can use transaction ST22 (ABAP Dump Analysis) to view and administer                      
         termination messages, especially those beyond their normal deletion                          
        date.                                                                               
    is especially useful if you want to keep a particular message.                                
    Error analysis                                                                               
    You attempted to access an unassigned field symbol                                            
        (data segment 107).                                                                               
    This error may occur for any of the following reasons:                                        
        - You address a typed field symbol before it is set using ASSIGN                              
        - You address a field symbol that points to a line in an internal table                       
          that has been deleted                                                                       
        - You address a field symbol that had previously been reset using                             
          UNASSIGN, or that pointed to a local field that no longer exists                            
        - You address a global function interface parameter, even                                     
          though the relevant function module is not active,                                          
          that is it is not in the list of active calls. You can get the list                         
          of active calls from the this short dump.                                                                               
    How to correct the error                                                                               
    You may able to find an interim solution to the problem                                       
        in the SAP note system. If you have access to the note system yourself,                       
        use the following search criteria:                                                                               
    "GETWA_NOT_ASSIGNED" C                                                                        
        "SAPLKKBL" or "LKKBLF99"                                                                      
        "GEN_FIELD_OUT2"                                                                               
    If you cannot solve the problem yourself and you wish to send                                 
        an error message to SAP, include the following documents:                                                                               
    1. A printout of the problem description (short dump)                                         
           To obtain this, select in the current display "System->List->                              
           Save->Local File (unconverted)".                                                                               
    2. A suitable printout of the system log                                                      
           To obtain this, call the system log through transaction SM21.                              
           Limit the time interval to 10 minutes before and 5 minutes                                 
           after the short dump. In the display, then select the function                             
           "System->List->Save->Local File (unconverted)".                                                                               
    3. If the programs are your own programs or modified SAP programs,                            
           supply the source code.                                                                    
           To do this, select the Editor function "Further Utilities->                                
           Upload/Download->Download".                                                                               
    4. Details regarding the conditions under which the error occurred                            
           or which actions and input led to the error.                                               
    System environment                                                                               
    SAP Release.............. "640"                                                                               
    Application server....... "production"                                                        
        Network address.......... "192.168.0.27"                                                      
        Operating system......... "Windows NT"                                                        
        Release.................. "5.2"                                                               
        Hardware type............ "2x Intel 80686"                                                    
        Character length......... 16 Bits                                                             
        Pointer length........... 32 Bits                                                             
        Work process number...... 1                                                                   
        Short dump setting....... "full"                                                                               
    Database server.......... "PRODUCTION"                                                        
        Database type............ "ORACLE"                                                            
        Database name............ "P50"                                                               
        Database owner........... "SAPP50"                                                                               
    Character set............ "C"                                                                               
    SAP kernel............... "640"                                                               
        Created on............... "Nov 26 2007 00:46:41"                                              
        Created in............... "NT 5.0 2195 Service Pack 4 x86 MS VC++ 13.10"                      
        Database version......... "OCI_920_SHARE "                                                                               
    Patch level.............. "210"                                                               
        Patch text............... " "                                                                               
    Supported environment....                                                                     
        Database................. "ORACLE 9.2.0.., ORACLE 10.1.0.., ORACLE                        
         10.2.0.."                                                                               
    SAP database version..... "640"                                                               
        Operating system......... "Windows NT 5.0, Windows NT 5.1, Windows NT 5.2,                    
         Windows NT 6.0"                                                                               
    Memory usage.............                                                                     
        Roll..................... 8176                                                                
        EM....................... 27176032                                                            
        Heap..................... 0                                                                   
        Page..................... 163840                                                              
        MM Used.................. 15995976                                                            
        MM Free.................. 724656                                                              
        SAP Release.............. "640"                                                                               
    User and Transaction                                                                               
    Client.............. 610                                                                      
        User................ "DEVUSER"                                                                
        Language key........ "E"                                                                      
        Transaction......... "ZSB "                                                                   
        Program............. "SAPLKKBL"                                                               
        Screen.............. "SAPLKKBL 0500"                                                          
        Screen line......... 3                                                                        
    Information on where terminated                                                                   
        The termination occurred in the ABAP program "SAPLKKBL" in "GEN_FIELD_OUT2".                  
        The main program was "ZSCOREBOARD_MANUAL ".                                                                               
    The termination occurred in line 2916 of the source code of the (Include)                     
         program "LKKBLF99"                                                                               
    of the source code of program "LKKBLF99" (when calling the editor 29160).                     
    Source Code Extract                                                                               
    Line  SourceCde                                                                               
    2886       else.                                                                               
    2887         assign <fs12> to <field>.                                                           
    2888         gs_fc = gs_sfc12.                                                                   
    2889       endif.                                                                               
    2890     when 013.                                                                               
    2891       if gs_out_flags-slave ne 'X'.                                                         
    2892         assign <fm13> to <field>.                                                           
    2893         gs_fc = gs_mfc13.                                                                   
    2894       else.                                                                               
    2895         assign <fs13> to <field>.                                                           
    2896         gs_fc = gs_sfc13.                                                                   
    2897       endif.                                                                               
    2898     when 014.                                                                               
    2899       if gs_out_flags-slave ne 'X'.                                                         
    2900         assign <fm14> to <field>.                                                           
    2901         gs_fc = gs_mfc14.                                                                   
    2902       else.                                                                               
    2903         assign <fs14> to <field>.                                                           
    2904         gs_fc = gs_sfc14.                                                                   
    2905       endif.                                                                               
    2906     when 015.                                                                               
    2907       if gs_out_flags-slave ne 'X'.                                                         
    2908         assign <fm15> to <field>.                                                           
    2909         gs_fc = gs_mfc15.                                                                   
    2910       else.                                                                               
    2911         assign <fs15> to <field>.                                                           
    2912         gs_fc = gs_sfc15.                                                                   
    2913       endif.                                                                               
    2914     when 016.                                                                               
    2915       if gs_out_flags-slave ne 'X'.                                                         
    >>>>>         assign <fm16> to <field>.                                                           
    2917         gs_fc = gs_mfc16.                                                                   
    2918       else.                                                                               
    2919         assign <fs16> to <field>.                                                           
    2920         gs_fc = gs_sfc16.                                                                   
    2921       endif.                                                                               
    2922     when 017.                                                                               
    2923       if gs_out_flags-slave ne 'X'.                                                         
    2924         assign <fm17> to <field>.

    Hi,
    check this program as reference..
    TABLES: ekko.
    type-pools slis.
    data my type SLIS_T_FIELDCAT_ALV with header line.
    selection-screen begin of block b1 with frame title text-001.
    select-options: pur for ekko-ekorg obligatory,
                    ord1 for ekko-ebeln,
                    date1 for ekko-aedat obligatory.
    selection-screen end of block b1.
    DATA: begin of details occurs 10,
          ord like EKKO-EBELN,
          org like EKKO-EKORG,
          date like EKKO-AEDAT,
          ven like EKKO-LLIEF,
          nam like LFA1-NAME1,
          item like EKPO-EBELP,
          mat like EKPO-MATNR,
          plant like EKPO-WERKS,
          text like EKPO-TXZ01,
          qty like EKPO-MENGE,
          end of details.
    SELECT EKKOEBELN EKKOEKORG EKKOAEDAT EKKOLLIEF LFA1NAME1 EKPOEBELP
    EKPOMATNR EKPOWERKS EKPOTXZ01 EKPOMENGE into table details FROM
    EKKO INNER JOIN EKPO ON EKPOebeln = EKKOEBELN INNER JOIN LFA1 ON
    EKKOLIFRE = LFA1NAME1.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               =  sy-repid
       I_INTERNAL_TABNAME           = 'DETAILS'
      I_STRUCTURE_NAME            =
      I_CLIENT_NEVER_DISPLAY      = 'X'
       I_INCLNAME                   = sy-repid
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
      CHANGING
       ct_fieldcat                  = my[].
    EXCEPTIONS
      INCONSISTENT_INTERFACE       = 1
      PROGRAM_ERROR                = 2
      OTHERS                       = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
        I_CALLBACK_PROGRAM                = sy-repid
      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                       = my[]
      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                          = details[]
    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.
    hope this will help..
    reward if useful.
    with regards,
    Syed

  • Problem in downloading ALV output in excel

    Dear Abapers,
                           I am facing a problem while downloading alv output in spreadsheet. Report headers and data headings are coming in excle but contents are missing instead of that No Data is displaying on excel sheet. I have debug that and observed the deep structure name T_OUTTAB using by the FM ALV_DATA_EXPORT is empty, It should contain the contents of my output data.
    Below I am giving my code. 
    ***********************************************declaration****************
          BEGIN OF d_file_out,
            index           TYPE i,                      "Index no
            msg             TYPE string,              "Message
            msgtyp(1)       TYPE c,                 "Message type
           END OF d_file_out,
    DATA:t_file_out       TYPE TABLE OF d_file_out.
    DATA:wa_file_out          TYPE d_file_out.
    Display Error Logs
    PERFORM display_logs USING text-006.
    FORM display_logs USING p_text TYPE string.
      CONSTANTS:  c_count    TYPE char5 VALUE 'INDEX',
                  c_mestyp   TYPE char6 VALUE 'MSG',
                  c_message  TYPE char7 VALUE 'MSGTYP'.
    *Field catalog
      PERFORM: z_field_catalog USING c_count   text-010,  "Record number
               z_field_catalog USING c_mestyp  text-011,  "Message type
               z_field_catalog USING c_message text-012.  "Message
    *Top of page event
      PERFORM z_event USING t_events.
    wa_layout-colwidth_optimize = c_x.
    ALV grid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
         i_buffer_active          = 'X'
           i_callback_program = sy-repid
         is_layout          = wa_layout
         I_STRUCTURE_NAME   = wa_file_out
          it_fieldcat        = t_field
          it_events          = t_events
        TABLES
          t_outtab           = t_file_out
        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.
    ***********************************Fieldcatalog**********************************************
    FORM z_field_catalog USING p_field TYPE any
                                                p_name  TYPE any.
      wa_field-fieldname = p_field.
      wa_field-seltext_l = p_name.
      IF p_field = 'INDEX'.
        wa_field-outputlen = '14'.
        wa_field-col_pos = 1.
      ELSEIF p_field = 'MSG'.
        wa_field-outputlen = '120'.
        wa_field-col_pos = 2.
      ELSEIF p_field = 'MSGTYP'.
        wa_field-outputlen = '08'.
        wa_field-col_pos = 3.
      ENDIF.
      APPEND wa_field TO t_field.
      CLEAR wa_field.
    ENDFORM. 
    Here I have given my code, which contain the building of field catalog and Calling ALV Grid. I have already checked the excel micros settings. Other programs are working fine on my system and downloading in excel is also working.
    Hope to get reply soon.
    Regards,
    Himanshu

    Hi ,
    use this to down load to xcel
    v_file = lv_file.
      DATA:  BEGIN OF s_head OCCURS 0,
             head(40) TYPE c ,
             END OF s_head.
      s_head-head = text-015."'Sales price'.   * for header
      APPEND s_head.
      s_head-head = text-016."'Purchase price'.   * for header
      APPEND s_head.
      s_head-head = text-017."'Listing Procedure'.   * for header
      APPEND s_head.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                        = v_file
         filetype                        = 'ASC'
         write_field_separator           = '#'
        TABLES
          data_tab                        = it_output1[]
          fieldnames                      = s_head[]
       EXCEPTIONS
         file_write_error                = 1
         no_batch                        = 2
         gui_refuse_filetransfer         = 3
         invalid_type                    = 4
         no_authority                    = 5
         unknown_error                   = 6
         header_not_allowed              = 7
         separator_not_allowed           = 8
         filesize_not_allowed            = 9
         header_too_long                 = 10
         dp_error_create                 = 11
         dp_error_send                   = 12
         dp_error_write                  = 13
         unknown_dp_error                = 14
         access_denied                   = 15
         dp_out_of_memory                = 16
         disk_full                       = 17
         dp_timeout                      = 18
         file_not_found                  = 19
         dataprovider_exception          = 20
         control_flush_error             = 21
         OTHERS                          = 22
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.

  • Want to save the alv output in local file

    Hi,
    i want to save the alv output to local file throuh menu.
    in out put
    system>LIst>save
    using oops alv
    Regards
    Jagadeeshwar.B

    Hi,
    I get the following dump when i try to download alv output to local file.Please suggest what is to be done:-
    Runtime Errors         PERFORM_NOT_FOUND            
    Except.                CX_SY_DYN_CALL_ILLEGAL_FORM  
    Date and Time          09/23/2008 22:09:28          
    Error analysis                                                                     
        An exception occurred that is explained in detail below.                       
        The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_FORM', was   
         not caught in                                                                 
        procedure "METHOD_PRINT_TOP_OF_PAGE" "(FORM)", nor was it propagated by a      
         RAISING clause.                                                               
        Since the caller of the procedure could not have anticipated that the          
        exception would occur, the current program is terminated.                      
        The reason for the exception is:                                               
        The program "SAPLSLVC_FULLSCREEN" is meant to execute an external PERFORM,     
        namely the routine "TOP_OF_PAGE_BATCH " of the program "ZRTCLT06_ALV ", but    
        this routine does not exist.                                                   
    Line  SourceCde                                                                               
    133   endif.                                                                               
    134                                                                               
    135   export alv_form_html from abap_false                                                       
      136          to memory id 'ALV_FORM_HTML'.                                                       
      137                                                                               
    138 endform.                               " METHOD_END_OF_LIST                                  
      139 &----                     
      140 *&      Form  METHOD_PRINT_TOP_OF_PAGE                                                       
      141 &----                     
      142 *       text                                                                               
    143 ----                     
      144 *  -->  p1        text                                                                       
      145 *  <--  p2        text                                                                       
      146 ----                     
      147 form method_print_top_of_page using value(i_table_index) type syindex.                       
      148                                                                               
    149   if gt_grid-r_salv_fullscreen_adapter is bound.                                             
      150     if not gt_grid-i_callback_top_of_page is initial and                                     
      151        not i_callback_program is initial.                                                    
      152       perform (gt_grid-i_callback_top_of_page)                                               
      153         in program (i_callback_program) using i_table_index.                                 
      154     endif.                                                                               
    155   else.                                                                               
    156     if not gt_grid-i_callback_top_of_page is initial and                                     
      157        not i_callback_program is initial.                                                    
      158       perform (gt_grid-i_callback_top_of_page)                                               
      159         in program (i_callback_program).                                                     
      160     endif.                                                                               
    161   endif.                                                                               
    162                                                                           
    >>>> endform.                               " METHOD_PRINT_TOP_OF_PAGE         
    164 ----   
    165 *       FORM METHOD_PRINT_END_OF_LIST                                 *   
    166 ----   
    167 *       ........                                                      *   
    168 ----   
    169 form method_print_end_of_list.                                            
    170   if not gt_grid-i_callback_end_of_list is initial and                    
    171      not i_callback_program is initial.                                   
    172     perform (gt_grid-i_callback_end_of_list)                              
    173       in program (i_callback_program).                                    
    174   endif.                                                                  
    175                                                                           
    176 endform.                               " METHOD_PRINT_END_OF_LIST         
    177 &----  
    178 *&      Form  METHOD_DOUBLE_CLICK                                         
    179 &----  
    180 *       text                                                              
    181 ----  
    182 *  -->  p1        text

  • ALV Output need to send to Printer

    Hi Folks,
    I need to send the ALV output to the printer. I built the ALV in OOps. The printer button is enabled in the scrren and when I give print it is goint to dump
    Below I have pasted the dump.
    Help me to solve this.
    Points will be rewarded.
    Regards,
    Raj.
    Short text
        Field symbol has not yet been assigned.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "SAPLKKBL" had to be terminated because it has
        come across a statement that unfortunately cannot be executed.
    Error analysis
        You attempted to access an unassigned field symbol
        (data segment 81).
        This error may occur if
        - You address a typed field symbol before it has been set with
          ASSIGN
        - You address a field symbol that pointed to the line of an
          internal table that was deleted
        - You address a field symbol that was previously reset using
          UNASSIGN or that pointed to a local field that no
          longer exists
        - You address a global function interface, although the
          respective function module is not active - that is, is
          not in the list of active calls. The list of active calls
          can be taken from this short dump.
    rigger Location of Runtime Error
       Program                                 SAPLKKBL
       Include                                 LKKBLF01
       Row                                     1,315
       Module type                             (FORM)
       Module Name                             CHECKBOX_OUT
    ource Code Extract
    ine  SourceCde
    1285     "<<Unicode/Doublebyte 1
    1286   else.
    1287     write at (rs_fieldcat-outputlen) <hf> as icon no-gap quickinfo
    1288                                                  rs_fieldcat-tooltip.
    1289   endif.
    1290
    1291   g_tabname = l_tabname.
    1292
    1293   format hotspot off.
    1294 *End of Orginalcoding 4.6c
    1295
    1296 endform.                               " HEADER_FIELD_OUT
    1297 &----
    1298 *&      Form  CHECKBOX_OUT
    1299 &----
    1300 *       text                                                           *
    1301 ----
    1302 form checkbox_out using rs_layout type kkblo_layout
    1303                         r_tabname type stack-i_tabname
    1304                         r_sum     type c.
    1305
    1306   data: l_mark(1) type c.
    1307
    1308   if not rs_layout-box_tabname is initial and
    1309          rs_layout-box_tabname ne r_tabname.
    1310     format color off.
    1311     write at (2) space no-gap.
    1312     exit.
    1313   endif.
    1314
    >>>>>   if not r_sum is initial or <box> = '-'.
    1316     format color off.
    1317     write at (2) space no-gap.
    1318   else.
    1319     format color off.
    1320     if <box> = ' ' or <box> = 'X'.
    1321       g_mark = <box>.
    1322       if rs_layout-no_input = 'X'.
    1323         write g_mark as checkbox no-gap input off.
    1324       else.

    check these parts in ur method:
                I_SAVE                = <var. of type CHAR01 >
                I_DEFAULT             = <var. of type CHAR01 >
                IS_LAYOUT             = <structure of type LVC_S_LAYO >
                IS_PRINT              = <structure of type LVC_S_PRNT >

  • How to create 2 ALV output lists in a single output?

    Hi guys...
    My clients requirement is to create 2 ALV output lists in a single output list.how can i do this?i mean which function module i can use for this requirement?please help me out...
    Regards..

    *& Report  ZLCL_ALV_INT_INVOICE                                        *
    REPORT  ZLCL_ALV_INT_INVOICE                    .
    DATA: O_CONT1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          O_CONT2 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          O_GRID1 TYPE REF TO CL_GUI_ALV_GRID,
          O_GRID2 TYPE REF TO CL_GUI_ALV_GRID.
    DATA: IT_VBRK LIKE VBRK OCCURS 1 WITH HEADER LINE.
    DATA: IT_VBRP LIKE VBRP OCCURS 1 WITH HEADER LINE.
    DATA: WA_VBRK LIKE VBRK.
    *--Layout
    DATA: WA_LAYO TYPE LVC_S_LAYO.
          CLASS LCL_BILLING DEFINITION
    CLASS LCL_BILLING DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS: HANDLE_HOTSPOT_CLICK
                 FOR EVENT HOTSPOT_CLICK
                 OF CL_GUI_ALV_GRID
                 IMPORTING E_ROW_ID.
    ENDCLASS.                    "LCL_BILLING DEFINITION
          CLASS LCL_BILLING IMPLEMENTATION
    CLASS LCL_BILLING IMPLEMENTATION.
      METHOD HANDLE_HOTSPOT_CLICK.
        IF NOT E_ROW_ID IS INITIAL.
    *--Reading selected billing docno
          READ TABLE IT_VBRK INTO WA_VBRK INDEX E_ROW_ID-INDEX.
    *--GETTING BILLING DOC ITEMS
          REFRESH IT_VBRP.
          SELECT *
            FROM VBRP
            INTO TABLE IT_VBRP
            WHERE VBELN = WA_VBRK-VBELN.
          CALL SCREEN 200.
        ENDIF.
      ENDMETHOD.                    "HANDLE_HOTSPOT_CLICK
    ENDCLASS.                    "LCL_BILLING IMPLEMENTATION
    SELECT-OPTIONS: S_VBELN FOR IT_VBRK-VBELN.
    START-OF-SELECTION.
      PERFORM GET_DATA.
      SET SCREEN 100.
    *&      Form  GET_DATA
          text
    FORM GET_DATA .
    *--billing header data
      SELECT *
        FROM VBRK
        INTO TABLE IT_VBRK
        WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE I000(Z00) WITH 'No Data Found'.
      ENDIF.
      EXIT.
    ENDFORM.                    " GET_DATA
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'MENU'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          PERFORM EXIT_PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  PBO_100  OUTPUT
          text
    MODULE PBO_100 OUTPUT.
      IF O_CONT1 IS INITIAL.
        CREATE OBJECT O_CONT1
          EXPORTING
            CONTAINER_NAME              = 'VBRK_CONT'
          EXCEPTIONS
            CNTL_ERROR                  = 1
            CNTL_SYSTEM_ERROR           = 2
            CREATE_ERROR                = 3
            LIFETIME_ERROR              = 4
            LIFETIME_DYNPRO_DYNPRO_LINK = 5
            OTHERS                      = 6
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in container'.
          EXIT.
        ENDIF.
        CREATE OBJECT O_GRID1
          EXPORTING
             I_PARENT          = O_CONT1
          EXCEPTIONS
            ERROR_CNTL_CREATE = 1
            ERROR_CNTL_INIT   = 2
            ERROR_CNTL_LINK   = 3
            ERROR_DP_CREATE   = 4
            OTHERS            = 5
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in Grid'.
          EXIT.
        ENDIF.
      ENDIF.
    *--Layout for 1st grid
      WA_LAYO-KEYHOT = 'X'.
      WA_LAYO-GRID_TITLE = 'Billing Document Header Data'.
      CALL METHOD O_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME              = 'VBRK'
          IS_LAYOUT                     = WA_LAYO
        CHANGING
          IT_OUTTAB                     = IT_VBRK[]
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          OTHERS                        = 4.
      IF SY-SUBRC <> 0.
        MESSAGE I000(Z00) WITH 'Error in showing grid'.
        EXIT.
      ENDIF.
    *-Setting the focus on the grid
      CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
        EXPORTING
          CONTROL           = O_GRID1 "Grid control object
        EXCEPTIONS
          CNTL_ERROR        = 1
          CNTL_SYSTEM_ERROR = 2
          OTHERS            = 3.
      IF SY-SUBRC <> 0.
        MESSAGE I000(Z00) WITH 'Error in setting focus'.
      ENDIF.
    *--Event handler registration
      SET HANDLER LCL_BILLING=>HANDLE_HOTSPOT_CLICK FOR O_GRID1.
    ENDMODULE.                 " PBO_100  OUTPUT
    *&      Module  STATUS_0200  OUTPUT
          text
    MODULE STATUS_0200 OUTPUT.
      SET PF-STATUS 'MENU'.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
          text
    MODULE USER_COMMAND_0200 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE TO SCREEN 100.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    *&      Module  PBO_200  OUTPUT
          text
    MODULE PBO_200 OUTPUT.
      IF O_CONT2 IS INITIAL.
        CREATE OBJECT O_CONT2
            EXPORTING
            CONTAINER_NAME              = 'VBRP_CONT'
        EXCEPTIONS
          CNTL_ERROR                  = 1
          CNTL_SYSTEM_ERROR           = 2
          CREATE_ERROR                = 3
          LIFETIME_ERROR              = 4
          LIFETIME_DYNPRO_DYNPRO_LINK = 5
          OTHERS                      = 6
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in container'.
          EXIT.
        ENDIF.
        CREATE OBJECT O_GRID2
          EXPORTING
            I_PARENT          = O_CONT2
          EXCEPTIONS
            ERROR_CNTL_CREATE = 1
            ERROR_CNTL_INIT   = 2
            ERROR_CNTL_LINK   = 3
            ERROR_DP_CREATE   = 4
            OTHERS            = 5.
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in grid linking'.
          EXIT.
        ENDIF.
        CALL METHOD O_GRID2->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
            I_STRUCTURE_NAME              = 'VBRP'
          CHANGING
            IT_OUTTAB                     = IT_VBRP[]
          EXCEPTIONS
            INVALID_PARAMETER_COMBINATION = 1
            PROGRAM_ERROR                 = 2
            TOO_MANY_LINES                = 3
            OTHERS                        = 4.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ELSE.
    *--refreshing the alv grid with the latest content of the internal table
    *--which is linked
        CALL METHOD O_GRID2->REFRESH_TABLE_DISPLAY
          EXCEPTIONS
            FINISHED = 1
            OTHERS   = 2.
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in Refreshing gird'.
        ENDIF.
      ENDIF.
    ENDMODULE.                 " PBO_200  OUTPUT
    *&      Form  EXIT_PROGRAM
          text
    FORM EXIT_PROGRAM .
    *--Deallocating the memory
      IF NOT O_CONT2 IS INITIAL.
        CALL METHOD O_CONT2->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 2
            OTHERS            = 3.
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in deallocating memory'.
          EXIT.
        ENDIF.
        CLEAR: IT_VBRP,
               IT_VBRP[].
        FREE:  IT_VBRP,
               IT_VBRP[].
      ENDIF.
      IF NOT O_CONT1 IS INITIAL.
        CALL METHOD O_CONT1->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 2
            OTHERS            = 3.
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in deallocating memory'.
          EXIT.
        ENDIF.
        CLEAR: IT_VBRK,
               IT_VBRK[].
        FREE:  IT_VBRK,
               IT_VBRK[].
      ENDIF.
    *--Cearing the buffered content
      CALL METHOD CL_GUI_CFW=>FLUSH
        EXCEPTIONS
          CNTL_SYSTEM_ERROR = 1
          CNTL_ERROR        = 2
          OTHERS            = 3.
      IF SY-SUBRC <> 0.
        MESSAGE I000(Z00) WITH 'Error in clearing Buffer'.
        EXIT.
      ENDIF.
      LEAVE PROGRAM.
    ENDFORM.                    " EXIT_PROGRAM
    SCREEN 100
    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0100.
      MODULE PBO_100.
    PROCESS AFTER INPUT.
      MODULE USER_COMMAND_0100.
    SCREEN200
    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0200.
      MODULE PBO_200.
    PROCESS AFTER INPUT.
      MODULE USER_COMMAND_0200.

  • Editing Alv Output

    Hi all ,
    Iam Generating ALV Grid using OOPs method, In the output list Iam editing some of the entries , now i need to store the edited output in a custom table.
    Can anyubody tell me how to capture these changes into an internal table.
    Early replies would be rewarded points.
    Thanks In advance,
    Neha

    Hi Neha,
    check this code
    *& Report  ZLAXMI_REPORT6                                              *
    REPORT  ZLAXMI_REPORT6     NO STANDARD PAGE HEADING
                               MESSAGE-ID ZZ
                               LINE-SIZE 132
                               LINE-COUNT 65 .
    TABLES: MARA.
    TYPE-POOLS: SLIS.
    TYPES: BEGIN OF T_MARA,
            MATNR TYPE MARA-MATNR, "Material Number
            ERSDA TYPE MARA-ERSDA, "Creation date
            BRGEW TYPE MARA-BRGEW, "Gross weight
            NTGEW TYPE MARA-NTGEW, "Net weight
            MTART TYPE MARA-MTART, "Material type
            MBRSH TYPE MARA-MBRSH, "Industry Sector
            REC_SEL   TYPE C , "checkbox
          END OF T_MARA.
                   V A R I A B L E S
    DATA: V_REPID LIKE SY-REPID,
          V_FLAG(1) TYPE C.
    CONSTANTS :
           C_X(1) TYPE C VALUE 'X',
           C_PF_STATUS TYPE SLIS_FORMNAME VALUE 'F_SET_PF_STATUS',
           C_FC_DELETE(6) TYPE C VALUE 'DELETE',
           C_FC_MODIFY(6) TYPE C VALUE 'MODIFY',
           C_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'F_USER_COMMAND',
           C_USER_COMMAND_MODIFY TYPE SLIS_FORMNAME
                                      VALUE 'F_USER_COMMAND_MODIFY',
           C_ICON_DELETE TYPE ICON-NAME VALUE 'ICON_DELETE', " Icon,Delete'
           C_ICON_CANCEL TYPE ICON-NAME VALUE 'ICON_CANCEL', " Icon,Cancel'
           C_FC_SAVE(4)  TYPE C VALUE 'SAVE'.
    *internal table declarations.
    DATA: IT_MARA TYPE STANDARD TABLE OF T_MARA WITH HEADER LINE,
          IT_MODIFY TYPE STANDARD TABLE OF T_MARA WITH HEADER LINE,
          IT_TEMP TYPE STANDARD TABLE OF MARA WITH HEADER LINE,
    *-ALV Internal Tables.
    *--Field Catalog
           IT_FIELDCAT TYPE STANDARD TABLE OF
                            SLIS_FIELDCAT_ALV WITH HEADER LINE,
    *--Layout
           WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
    *--Sort
           IT_SORT TYPE SLIS_T_SORTINFO_ALV,
           WA_SORT TYPE SLIS_SORTINFO_ALV  ,
    **-Structure for excluding function codes
           WA_EXTAB TYPE SLIS_EXTAB,
    **-To hold function codes to be excluded in ALV toolbar
           IT_EXTAB TYPE SLIS_T_EXTAB.
    *selection screen.
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: S_MATNR FOR MARA-MATNR,
                    S_ERSDA FOR MARA-ERSDA.
    SELECTION-SCREEN: END OF BLOCK B1.
    *--Radio buttons to select either Display/Delete/Modify
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME
                    TITLE TEXT-002.
    SELECTION-SCREEN : BEGIN OF LINE.
    SELECTION-SCREEN  COMMENT 1(20) TEXT-003.
    PARAMETERS: P_DISP RADIOBUTTON GROUP RAD1 DEFAULT 'X'.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) TEXT-005.
    PARAMETERS: P_UPD RADIOBUTTON GROUP RAD1.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) TEXT-004.
    PARAMETERS: P_DEL RADIOBUTTON GROUP RAD1.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN END OF BLOCK B2 .
    AT SELECTION-SCREEN.
      PERFORM VALIDATE_SCREEN.
    *start of selection
    START-OF-SELECTION.
    *clear the internal tables to be used.
      CLEAR: IT_MARA,IT_MARA[],
             V_FLAG.
    *get the data
      PERFORM GET_DATA.
    *end of selection
    END-OF-SELECTION.
      IF IT_MARA[] IS INITIAL.
        MESSAGE I000 WITH
              'No Records found for the given Selection Criteria'(012).
      ELSE.
    *do alv process
        V_REPID = SY-REPID.
    *--Sort the Output Fields
        PERFORM SORT_FIELDS.
    *--Build Field catalog for the Output fields
        PERFORM BUILD_FIELDCAT.
    *--Set the Layout for ALV
        PERFORM SET_LAYOUT.
        IF P_DISP = C_X.
    *--Exclude any Buttons on the Appn tool bar
       perform change_default_pf_status.
          MOVE C_FC_DELETE TO WA_EXTAB-FCODE.    " DELETE button on ALV
          APPEND WA_EXTAB TO IT_EXTAB.
          MOVE C_FC_MODIFY TO WA_EXTAB-FCODE.    " MODIFY button on ALV
          APPEND WA_EXTAB TO IT_EXTAB.
        ELSEIF P_UPD = C_X.
    *--Exclude DELETE Button on the appn tool bar
          MOVE C_FC_DELETE TO WA_EXTAB-FCODE.    " DELETE button on ALV
          APPEND WA_EXTAB TO IT_EXTAB.
        ELSEIF P_DEL = C_X.
    *--Exclude MODIFY button on appn tool bar
          MOVE C_FC_MODIFY TO WA_EXTAB-FCODE.    " MODIFY button on ALV
          APPEND WA_EXTAB TO IT_EXTAB.
        ENDIF.
    *--Exclude SAVE button for all options
        MOVE 'SAVE' TO WA_EXTAB-FCODE.    " SAVE button on ALV
        APPEND WA_EXTAB TO IT_EXTAB.
    *--Display ALV output
        PERFORM LIST_DISPLAY TABLES IT_MARA
                             USING  C_USER_COMMAND.
      ENDIF.
    *&      Form  get_data
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DATA .
      SELECT MATNR
             ERSDA
             BRGEW
             NTGEW
             MTART
             MBRSH
             FROM MARA
             INTO TABLE IT_MARA
             WHERE MATNR IN S_MATNR
             AND ERSDA IN S_ERSDA.
      IF SY-SUBRC <> 0.
    *no records selected leave processing
        STOP.
      ENDIF.
      SORT IT_MARA.
    ENDFORM.                    " get_data
    *&      Form  sort_fields
          text
    -->  p1        text
    <--  p2        text
    FORM SORT_FIELDS .
      CLEAR WA_SORT.
      WA_SORT-FIELDNAME = 'MATNR'.
      WA_SORT-SPOS = '1'.
      WA_SORT-UP = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
      WA_SORT-FIELDNAME = 'ERSDA'.
      WA_SORT-SPOS = '2'.
      WA_SORT-UP = 'X'.
      APPEND WA_SORT TO IT_SORT.
    ENDFORM.                    " sort_fields
    *&      Form  build_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM BUILD_FIELDCAT .
      IT_FIELDCAT-COL_POS    = '1'.
      IT_FIELDCAT-FIELDNAME  = 'MATNR'.
      IT_FIELDCAT-KEY        = 'X'.
      IT_FIELDCAT-OUTPUTLEN  = '15'.
      IT_FIELDCAT-SELTEXT_L  = 'Material number'(022).
      APPEND IT_FIELDCAT.
      CLEAR  IT_FIELDCAT.
      IT_FIELDCAT-COL_POS    = '2'.
      IT_FIELDCAT-FIELDNAME  = 'ERSDA'.
      IT_FIELDCAT-KEY        = 'X'.
      IT_FIELDCAT-OUTPUTLEN  = '10'.
      IT_FIELDCAT-SELTEXT_L  = 'Created on'(023).
      APPEND IT_FIELDCAT.
      CLEAR  IT_FIELDCAT.
      IT_FIELDCAT-COL_POS    = '3'.
      IT_FIELDCAT-FIELDNAME  = 'BRGEW'.
      IT_FIELDCAT-OUTPUTLEN  = '10'.
      IT_FIELDCAT-SELTEXT_L  = 'GROSS WEIGHT'(024).
      APPEND IT_FIELDCAT.
      CLEAR  IT_FIELDCAT.
      IT_FIELDCAT-COL_POS    = '4'.
      IT_FIELDCAT-FIELDNAME  = 'NTGEW'.
      IT_FIELDCAT-OUTPUTLEN  = '15'.
      IT_FIELDCAT-SELTEXT_L  = 'NET WEIGHT'(025).
      APPEND IT_FIELDCAT.
      CLEAR  IT_FIELDCAT.
      IT_FIELDCAT-COL_POS    = '5'.
      IT_FIELDCAT-FIELDNAME  = 'MTART'.
      IT_FIELDCAT-OUTPUTLEN  = '3'.
      IT_FIELDCAT-SELTEXT_L  = 'Material type'(026).
      APPEND IT_FIELDCAT.
      CLEAR  IT_FIELDCAT.
      IT_FIELDCAT-COL_POS    = '6'.
      IT_FIELDCAT-FIELDNAME  = 'MBRSH'.
      IT_FIELDCAT-OUTPUTLEN  = '25'.
      IT_FIELDCAT-SELTEXT_L  = 'Industry sector'(027).
      APPEND IT_FIELDCAT.
      CLEAR  IT_FIELDCAT.
      IT_FIELDCAT-FIELDNAME  = 'REC_SEL'.
      IT_FIELDCAT-NO_OUT = C_X.
      APPEND IT_FIELDCAT.
      CLEAR  IT_FIELDCAT.
    ENDFORM.                    " build_fieldcat
    *&      Form  list_display
          text
         -->P_IT_MARA  text
         -->P_C_USER_COMMAND  text
    FORM LIST_DISPLAY  TABLES   P_IT_MARA
                       USING    P_USER_COMMAND TYPE SLIS_FORMNAME.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = V_REPID
          I_CALLBACK_PF_STATUS_SET = C_PF_STATUS
          I_CALLBACK_USER_COMMAND  = P_USER_COMMAND
          IS_LAYOUT                = WA_LAYOUT
          IT_FIELDCAT              = IT_FIELDCAT[]
          IT_EXCLUDING             = IT_EXTAB[]
          IT_SORT                  = IT_SORT[]
        TABLES
          T_OUTTAB                 = P_IT_MARA
        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.                    " list_display
    *&      Form  F_SET_PF_STATUS
          Set PF_STATUS STANDARD modifying the standard toolbar
          by excluding some buttons
         -->P_IT_EXTAB  -- TABLE OF EXCLUDING FUNCTIONS
    FORM F_SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
      CLEAR : WA_EXTAB,
              IT_EXTAB.
    *--Set the Modified PF status for the ALV.
      SET PF-STATUS 'ALV_STATUS_01' EXCLUDING RT_EXTAB.
    ENDFORM.                               " SET_PF_STATUS
    *&      Form  f_user_command
          Handle user action on ALV toolbar
    FORM F_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                              RS_SELFIELD TYPE SLIS_SELFIELD.
      RS_SELFIELD-REFRESH = C_X.
      IF R_UCOMM = C_FC_DELETE.
    *--User Selected DELETE button.
        PERFORM DELETE_SELECTED_RECORDS.
      ELSEIF R_UCOMM = C_FC_MODIFY.
    *--If user selects MODIFY button.
        PERFORM CHANGE_RECORDS.
      ENDIF.
    ENDFORM.                    "F_USER_COMMAND
    *&      Form  POP_UP_CONFIRMATION
          text
         <--P_ANSWER  text
    FORM POP_UP_CONFIRMATION
                                CHANGING P_ANSWER TYPE C.
      DATA:
         L_TITLE(14) TYPE C,               " Title of pop-up
         L_TXT_QUESTION(52) TYPE C,        " Text displayed in pop-up
        L_DISP_CANCEL TYPE C,             " Display 'Cancel' button?
         L_BTN1 TYPE ICON-NAME,            " Icon on button 1
         L_BTN2 TYPE ICON-NAME.            " Icon on button 2
      L_TITLE        = 'Delete'(017).                   " delete
      L_TXT_QUESTION = 'Are you sure to delete?'(018).
      L_BTN1         = C_ICON_DELETE.
      L_BTN2         = C_ICON_CANCEL.
    **-Display pop-up asking user for confirmation
      CALL FUNCTION 'POPUP_TO_CONFIRM'
        EXPORTING
          TITLEBAR              = L_TITLE
          TEXT_QUESTION         = L_TXT_QUESTION
          TEXT_BUTTON_1         = 'Yes'
          ICON_BUTTON_1         = L_BTN1
          TEXT_BUTTON_2         = 'No'
          ICON_BUTTON_2         = L_BTN2
          DEFAULT_BUTTON        = '2'
          DISPLAY_CANCEL_BUTTON = 'X'
        IMPORTING
          ANSWER                = P_ANSWER
        EXCEPTIONS
          TEXT_NOT_FOUND        = 1
          OTHERS                = 2.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'Error executing function module:'(019)
                                 'POPUP_TO_CONFIRM'.
      ENDIF.
    ENDFORM.                    "pop_up_confirmation
    *&      Form  set_layout
          text
    -->  p1        text
    <--  p2        text
    FORM SET_LAYOUT .
      IF P_DEL = C_X OR P_UPD = C_X.
    *--Allow Input only if user choose 'UPDATE'/ 'DELETE' radio buttons
        WA_LAYOUT-BOX_FIELDNAME = 'REC_SEL'.
        WA_LAYOUT-BOX_TABNAME = 'IT_MARA'.
      ENDIF.
    *--Display Header based on the user selection
      IF P_DISP = C_X.
        WA_LAYOUT-WINDOW_TITLEBAR =
                              'Display '(036).
      ELSEIF P_DEL = C_X.
        WA_LAYOUT-WINDOW_TITLEBAR =
                     'Delete '(037).
      ELSEIF P_UPD = C_X.
        WA_LAYOUT-WINDOW_TITLEBAR =
                     'Change '(038).
      ENDIF.
    ENDFORM.                    " set_layout
    *&      Form  change_default_pf_status
          text
    -->  p1        text
    <--  p2        text
    FORM CHANGE_DEFAULT_PF_STATUS .
      MOVE C_FC_DELETE TO WA_EXTAB-FCODE.    " DELETE button on ALV
      APPEND WA_EXTAB TO IT_EXTAB.
      MOVE C_FC_MODIFY TO WA_EXTAB-FCODE.    " MODIFY button on ALV
      APPEND WA_EXTAB TO IT_EXTAB.
    ENDFORM.                    " change_default_pf_status
    *&      Form  f_user_command
          Handle user action on ALV toolbar
    FORM F_USER_COMMAND_MODIFY USING R_UCOMM LIKE SY-UCOMM      "#EC *
                              RS_SELFIELD TYPE SLIS_SELFIELD.
      DATA :     L_ANSWER TYPE C.                               "#EC *
      IF R_UCOMM = C_FC_SAVE.
    *user selected save button
        READ TABLE IT_MODIFY WITH KEY REC_SEL = 'X'.
    *check if user selected atleast one line.
        IF SY-SUBRC <> 0.
          MESSAGE I000 WITH 'No record(s) Selected to Modify'(016).
          EXIT.
        ENDIF.
        LOOP AT IT_MODIFY WHERE REC_SEL = 'X'.
    *--Check the entered values are valid or not.
         IF NOT ( it_modify-status = 'A' OR
                  it_modify-status = 'C' OR
                  it_modify-status = 'E' ).
    *--User Entered invalid value for STATUS field,so Display Error Msg
          CLEAR R_UCOMM.
           MESSAGE e000 WITH 'Invalid value '''(031)
                            '' for Status in the Record # '(032)
                            sy-tabix.
         ENDIF.
        ENDLOOP.
        CLEAR: IT_TEMP,
               IT_TEMP[].
        LOOP AT IT_MODIFY WHERE REC_SEL = 'X'.
          MOVE-CORRESPONDING IT_MODIFY TO IT_TEMP.
          APPEND IT_TEMP.
          CLEAR IT_TEMP.
        ENDLOOP.
    *--start new code
        DATA : IT_TEMP2 LIKE STANDARD TABLE OF MARA WITH HEADER LINE.
        SELECT * FROM MARA
                  INTO TABLE IT_TEMP2
                  FOR ALL ENTRIES IN IT_TEMP
                  WHERE MATNR = IT_TEMP-MATNR.
        IF SY-SUBRC = 0.
          LOOP AT IT_MODIFY WHERE REC_SEL = 'X'.
            READ TABLE IT_TEMP2 WITH KEY MATNR = IT_MODIFY-MATNR.
            IF SY-SUBRC = 0.
              IT_TEMP2-NTGEW = IT_MODIFY-NTGEW.
              IT_TEMP2-BRGEW = IT_MODIFY-BRGEW.
              MODIFY IT_TEMP2 INDEX SY-TABIX.
            ENDIF.
          ENDLOOP.
        ENDIF.
    *modify mara table with the changed values
        MODIFY MARA FROM TABLE IT_TEMP2 .
    *--end new code
        IF SY-SUBRC = 0.
          COMMIT WORK AND WAIT.
    *--Display message with Success in Updating database
          MESSAGE I000 WITH SY-DBCNT
                            ' Record(s) has been Updated'(020).
          CLEAR :
                 IT_MARA,
                 IT_MARA[].
    *get-data again from database.
          PERFORM GET_DATA.
            RS_SELFIELD-REFRESH = C_X.
        ELSE.
    *--Error occurred
          MESSAGE I000 WITH 'Error occured in Modifying the database'(021).
        ENDIF.
      ENDIF.
    ENDFORM.                    "f_user_command_modify
    *&      Form  validate_screen
          text
    -->  p1        text
    <--  p2        text
    FORM VALIDATE_SCREEN .
      DATA  : LV_MATNR LIKE MARA-MATNR.
    *--validate product
       IF NOT S_MATNR[] IS INITIAL.
      SELECT MATNR
             INTO MARA-MATNR
             FROM MARA
             WHERE MATNR IN S_MATNR.
      ENDSELECT.
      IF SY-SUBRC <> 0.
    *--Error
        MESSAGE E000 WITH 'Invalid Material'(034).
      ENDIF.
    ENDIF.
    ENDFORM.                    " validate_screen
    *&      Form  delete_records
          text
    -->  p1        text
    <--  p2        text
    FORM DELETE_RECORDS .
      LOOP AT IT_MARA.
        MOVE-CORRESPONDING IT_MARA TO IT_TEMP.
        APPEND IT_TEMP.
        CLEAR IT_TEMP.
      ENDLOOP.
      DELETE MARA FROM TABLE IT_TEMP.
      IF SY-SUBRC = 0.
    *--Successfully selected records Deleted.
        COMMIT WORK AND WAIT.
    *--Display Success Message to the user
        MESSAGE I000  WITH SY-DBCNT
                          ' Record(s) deleted Successfully'(010).
      ELSE.
    *--Error occured in deletion
        MESSAGE I000 WITH 'Error occured in Deleting the Record(s)'(011).
      ENDIF.
      CLEAR: IT_MARA,
             IT_MARA[],
             IT_TEMP,
             IT_TEMP[].
      V_FLAG = C_X.
      STOP.
    ENDFORM.                    " delete_records
    *&      Form  delete_selected_records
          text
    -->  p1        text
    <--  p2        text
    FORM DELETE_SELECTED_RECORDS .
      DATA  : L_ANSWER(1) TYPE C.
      READ TABLE IT_MARA WITH KEY REC_SEL = C_X.
      IF SY-SUBRC <> 0.
        MESSAGE I000 WITH 'No record(s) Selected to Delete'(013).
        EXIT.
      ELSE.
    *--Ask for delete confirmation
        PERFORM POP_UP_CONFIRMATION
                                    CHANGING L_ANSWER.
        IF L_ANSWER = '1'.             " 'Yes'
          CLEAR: IT_TEMP,
                 IT_TEMP[].
          LOOP AT IT_MARA WHERE REC_SEL = 'X'.
            MOVE-CORRESPONDING IT_MARA TO IT_TEMP.
            APPEND IT_TEMP.
            CLEAR IT_TEMP.
          ENDLOOP.
          DELETE MARA FROM TABLE IT_TEMP.
          IF SY-SUBRC = 0.
    *--Successfully selected records Deleted.
            COMMIT WORK AND WAIT.
    *--Display completed work information to the user
            MESSAGE I000  WITH SY-DBCNT
                              ' Record(s) deleted Successfully'(014).
    *--Clear the Internal tables
            CLEAR: IT_MARA,
                   IT_MARA[].
    *--Reselects entries from Database again & display in ALV
            PERFORM GET_DATA.
          ELSE.
    *--Error occured
            MESSAGE I000 WITH
                        'Error occured in Deleting the Record(s)'(015).
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.                    " delete_selected_records
    *&      Form  change_records
          text
    -->  p1        text
    <--  p2        text
    FORM CHANGE_RECORDS .
      READ TABLE IT_MARA WITH KEY REC_SEL = 'X'.
    *--check user selected at least 1 record to MODIFY or not
      IF SY-SUBRC <> 0.
        MESSAGE I000 WITH 'No record(s) Selected to Modify'(016).
        EXIT.
      ELSE.
        CLEAR : IT_MODIFY,
                IT_MODIFY[].
        LOOP AT IT_MARA WHERE REC_SEL = 'X'.
          IT_MODIFY = IT_MARA.
          APPEND IT_MODIFY.
          CLEAR IT_MODIFY.
        ENDLOOP.
    *--Change PF status for this new ALV list.
        PERFORM CHANGE_PF_STATUS_AGAIN.
    *--Change Field Catalog to make INPUT enabled.
        READ TABLE IT_FIELDCAT WITH KEY FIELDNAME = 'NTGEW'.
        IT_FIELDCAT-INPUT = C_X.
        MODIFY IT_FIELDCAT INDEX SY-TABIX.
    *--Call ALV LIST DISPLAY with this new values.
        PERFORM  LIST_DISPLAY TABLES IT_MODIFY
                              USING C_USER_COMMAND_MODIFY.
      ENDIF.
    ENDFORM.                    " change_records
    *&      Form  change_pf_status_again
          text
    -->  p1        text
    <--  p2        text
    FORM CHANGE_PF_STATUS_AGAIN .
      MOVE C_FC_DELETE TO WA_EXTAB-FCODE.    " DELETE button on ALV
      APPEND WA_EXTAB TO IT_EXTAB.
      MOVE C_FC_MODIFY TO WA_EXTAB-FCODE.    " MODIFY button on ALV
      APPEND WA_EXTAB TO IT_EXTAB.
    ENDFORM.                    " change_pf_status_again
    Regards,
    Laxmi.

  • Problem in download ALV output

    Hi experts,
         When I try to download my ALV report output, its giving dump  'Field symbol has not yet been assigned.
         In my ALV output, I have 46 fields/columns. When I have 18 fields/columns or less, I able to download, but if it is more than 18. Its giving the above dump.
    *Error details:*
    Runtime Errors         GETWA_NOT_ASSIGNED
    Date and Time          05.09.2009 17:56:13
    Short text
         Field symbol has not yet been assigned.
    What happened?
         Error in the ABAP Application Program
         The current ABAP program "SAPLKKBL" had to be terminated because it has
         come across a statement that unfortunately cannot be executed.
    Error analysis
         You attempted to access an unassigned field symbol
         (data segment 110).
         This error may occur if
         - You address a typed field symbol before it has been set with
           ASSIGN
         - You address a field symbol that pointed to the line of an
           internal table that was deleted
         - You address a field symbol that was previously reset using
           UNASSIGN or that pointed to a local field that no
           longer exists
         - You address a global function interface, although the
           respective function module is not active - that is, is
           not in the list of active calls. The list of active calls
           can be taken from this short dump.
    Please provid the solution for this.
    Thanks and regards,
    Subbu

    Hi Sandra,
    As you told, There is a problem  in populating field catalog.
    Actually, I had passed the same field name 2 times while populating field catalog table. Thats why, the issue has been raised. Now I changed it accordingly.
    Thanks and regards
    Subbu
    Edited by: subbu_1983 on Sep 6, 2009 11:10 AM

Maybe you are looking for