Hierarchical ALV list with control of printout and Excel download

Hello everybody,
i have to write a program, that has to generate a hierarchical master/client list. The list should
have the same functionality, that a standard ALV Grid
offers (sorting, grouping, OLE export to Excel). The printout must show a new sheet for every master group.
ALV grid does not allow to display hierarchical lists. The ALV hierarchical list and blocklist view switches to
text mode with no "single click Excel activation". I have tried to implement the &XXL ok_code, but in text mode, there is no chance to activate this single-table functionality.
Another possibility seems to be ALV tree, but there is no
possibility to control the printout (new sheet at group level) and the given practice, to load child nodes at selection, is not acceptable for my kind of program (all childs have to be expanded and the printout must contain a dialog to print i.e. a "from to group" selection).
Does anyone have an idea, to solve this problem in an easy object oriented way? my only thought at this time is, to use a standard ABAP list and to integrate Excel via document office integration. This gives me the fullcontrol about printout and export, but it needs far more time then ALV.
Another possibility may be, to develop a custom control, based on VS with Flexgrid, Singray or ComponentOne tools, but ich have to go as near as possible to SAP standard, without using 3rd party programming systems or controls.
I'm glad about tip's!
Greets from germany
Jens

Jens,
Take a look at this for ideas:
REPORT Zsandbox_prog .
INCLUDE OLE2INCL.
field-symbols: <Val> type any.
data: row_cnt type i.
types:  begin of t_Excel,
          Material_Info(20),
          Sugg_Price(20),
          Cost(20),
          Comments(100),
        end of t_Excel.
data: r_Excel type t_Excel.
data: i_Excel type table of t_Excel with header line.
constants: xlCenter type i value '-4108',
           xlBottom type i value '-4107',
           xlLeft   type i value '-4131',
           xlRight  type i value '-4152'.
constants: xlContinuous type i value '1',
           xlInsideVertical type i value '11',
           xlThin type i value '2',
           xlLandscape type i value '2',
           xlPortrait type i value '1',
           xlLetter type i value '1',
           xlLegal type i value '5',
           xlThick type i value '4',
           xlNone type i value '-4142',
           xlAutomatic type i value '-4105'.
DATA: hExcel TYPE OLE2_OBJECT,      " Excel object
      hWorkBooks TYPE OLE2_OBJECT,  " list of workbooks
      hWorkbook TYPE OLE2_OBJECT,   " workbook
      hSheet TYPE OLE2_OBJECT,      " worksheet object
      hRange TYPE OLE2_OBJECT,      " range object
      hRange2 TYPE OLE2_OBJECT,      " range object
      hBorders TYPE OLE2_OBJECT,    " Border object
      hInterior TYPE OLE2_OBJECT,   " interior object - for coloring
      hColumn TYPE OLE2_OBJECT,     "column
      hCell TYPE OLE2_OBJECT,       " cell
      hFont TYPE OLE2_OBJECT,       " font
      hSelected TYPE OLE2_OBJECT,   " range object
      hPicture TYPE OLE2_OBJECT,    "picture object
      hLogo TYPE OLE2_OBJECT.       "Logo object
SELECTION-SCREEN BEGIN OF BLOCK b1.
  SELECTION-SCREEN skip 1.
  parameter: wraptext as checkbox.
SELECTION-SCREEN END OF BLOCK b1.
  row_cnt = 1.
  Perform Build_Dummy_Vals.
  Perform Start_Excel.
  Perform Build_Header_Line using row_cnt.
  Perform Pass_Records using row_cnt.
  Perform Release_Excel.
FORM Build_Dummy_Vals .
  data: matnum(5) type n.
  data: baseprice(3) type n.
  do 5 times.
    matnum = matnum + 50.
    clear r_Excel.
    concatenate 'Material ' matnum into r_Excel-material_info
      separated by space.
    r_excel-Sugg_Price = baseprice * matnum.
    r_excel-Cost = ( baseprice * matnum ) / 2.
    concatenate 'Comments for Material ' matnum into r_excel-Comments
      separated by space.
    append r_excel to i_Excel.
  enddo.
ENDFORM.                    " Build_Dummy_Vals
Form Start_Excel.
  CREATE OBJECT hExcel 'EXCEL.APPLICATION'.
  PERFORM ERR_HDL.
get list of workbooks, initially empty
  CALL METHOD OF hExcel 'Workbooks' = hWorkbooks.
  PERFORM ERR_HDL.
  add a new workbook
  CALL METHOD OF hWorkbooks 'Add' = hWorkbook.
  PERFORM ERR_HDL.
Get Worksheet object.
  get property of hWorkbook 'ActiveSheet' = hSheet.
EndForm.
FORM Build_Header_Line using p_row_cnt.
  data: l_range(30).
  data: row_start(10).
  PERFORM Fill_The_Cell USING p_row_cnt 1 1 'Material'.
  PERFORM Fill_The_Cell USING p_row_cnt 2 1 'Suggested Price'.
  PERFORM Fill_The_Cell USING p_row_cnt 3 1 'Cost'.
  PERFORM Fill_The_Cell USING p_row_cnt 4 1 'Comments'.
  Perform Format_Column using 1 15 xlCenter ' ' xlCenter 0.
  Perform Format_Column using 2 10 xlCenter ' ' xlCenter 1.
  Perform Format_Column using 3 35 xlCenter ' ' xlCenter 0.
  if WrapText = 'X'.
    Perform Format_Column using 4 35 xlLeft ' ' xlCenter 1.
  else.
    Perform Format_Column using 4 100 xlLeft ' ' xlCenter 0.
  endif.
Build the range object.
  row_start = p_row_cnt.
  concatenate 'A' row_start ':D' row_start into l_range.
  condense l_range no-gaps.
Set row color to yellow.
  CALL METHOD OF hExcel 'RANGE' = hRange EXPORTING #1 = l_range.
  call method of hRange 'Interior' = hInterior.
  set property of hInterior 'ColorIndex' = 6.  "yellow
  p_row_cnt = p_row_cnt + 1.
ENDFORM.                    " Build_Header_Line
FORM Format_Column  USING    p_ColNum
                             p_ColWidth
                             p_ColHAlign
                             p_ColFormat
                             p_ColVAlign
                             p_WrapText.
  CALL METHOD OF hExcel 'COLUMNS' = hColumn
    EXPORTING #1 = p_ColNum .           "column number
  SET PROPERTY OF hColumn 'HorizontalAlignment' = p_ColHAlign.
  SET PROPERTY OF hColumn 'VerticalAlignment' = p_ColVAlign.
  SET PROPERTY OF hColumn 'ColumnWidth' = p_ColWidth.
  SET PROPERTY OF hColumn 'WrapText' = p_WrapText.
ENDFORM.                    " Format_Column
Form Pass_Records using p_row_cnt.
  data: col_cnt type i.
  data: l_range(30).
  data: row_start(10).
  col_cnt = 1.
*Pass the internal table values to the spreadsheet.
  loop at i_Excel into r_Excel.
    do 4 times.
      assign component sy-index of STRUCTURE r_excel TO <Val>.
      PERFORM Fill_The_Cell USING p_row_cnt col_cnt 0 <Val>.
      col_cnt = col_cnt + 1.      "increment column
    enddo.
Build the range object.
    row_start = p_row_cnt.
    concatenate 'A' row_start ':D' row_start into l_range.
    condense l_range no-gaps.
  Set row color to yellow.
    CALL METHOD OF hExcel 'RANGE' = hRange EXPORTING #1 = l_range.
    call method of hRange 'Interior' = hInterior.
    set property of hInterior 'ColorIndex' = 7.  "yellow
    p_row_cnt = p_row_cnt + 1.    "increment row
    col_cnt = 1.                  "reset column to A (ie. col 1)
  endloop.
EndForm.
FORM Release_Excel .
  SET PROPERTY OF hExcel  'Visible' = 1.
  FREE OBJECT hExcel.
  PERFORM ERR_HDL.
ENDFORM.                    " Release_Excel
      FORM Fill_The_Cell                                            *
   Sets cell at coordinates i,j to value val boldtype bold          *
   BOLD --> 1 = true, set bold ON    0 = false, set bold OFF
FORM Fill_The_Cell USING I J BOLD TheValue.
  CALL METHOD OF hExcel 'Cells' = hCell EXPORTING #1 = I #2 = J.
  PERFORM ERR_HDL.
  SET PROPERTY OF hCell 'Value' = TheValue.
  PERFORM ERR_HDL.
  GET PROPERTY OF hCell 'Font' = hFont.
  PERFORM ERR_HDL.
  SET PROPERTY OF hFont 'Bold' = BOLD.
  PERFORM ERR_HDL.
ENDFORM.
FORM ERR_HDL.
  IF SY-SUBRC <> 0.
    message i000(zz) with 'OLE Automation error: ' SY-SUBRC.
    exit.
  ENDIF.
ENDFORM.                    " ERR_HDL

Similar Messages

  • ALV list with only 1 field

    Hi guru's,
    I want to create an ALV list with only a char255 field.
    <all_table> contains data of sflight and is of type sflight(dynamically).
    I want to show the data as one line.
    CALL FUNCTION 'DDIF_FIELDINFO_GET'
           EXPORTING
                tabname   = 'TPPARFIL'
                fieldname = 'LINE'
          TABLES
                dfies_tab = it_dfies.
      READ TABLE it_dfies INDEX 1.
      IF sy-subrc IS INITIAL.
      MOVE-CORRESPONDING it_dfies TO wa_fieldcat.
      wa_fieldcat-scrtext_s = 'Results:'.
        APPEND wa_fieldcat TO gt_fieldcat.
      ENDIF.
    t_output[] = <all_table>.
      CALL FUNCTION 'LVC_TRANSFER_TO_SLIS'
           EXPORTING
                it_fieldcat_lvc = gt_fieldcat
           IMPORTING
                it_fieldcat_alv = it_fieldcat_alv.
      PERFORM fill_alv_layout.
    * Show list
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_callback_program = lv_repid
                i_grid_title       = sy-title
                 is_layout          = gs_layout
                it_fieldcat        = it_fieldcat_alv[]
           TABLES
                t_outtab           = t_output
           EXCEPTIONS
                program_error      = 1
                OTHERS             = 2.
    *&      Form  fill_alv_layout
      FORM fill_alv_layout.
        CLEAR: gs_layout.
        gs_layout-max_linesize         = 160.
        gs_layout-min_linesize         = 160.
        gs_layout-detail_initial_lines = 'X'.
        gs_layout-zebra                = 'X'.
        gs_layout-edit_mode            = 'A'.
        gs_layout-numc_sum             = 'X'.
        gs_layout-colwidth_optimize    = 'X'.
        gs_layout-window_titlebar      = sy-title.
        gs_layout-totals_only          = 'X'.
      ENDFORM.                    " fill_alv_layout
    When I run this it only gives an empty view of the fields with type char255.
    Regards,
    Wim

    hi,
    As per your code I think your internal table is empty. Please set debugger after internal table fill and check. If the data is there then please check your field catalog entry.
    Regards,
    Sachin

  • Printing ALV list with ADS (pdf printer) in non-english charset

    Hello!
    I have an issue about printing alv list with pdf printer in non-english charset. We have two printers. One for alv lists (SWINCF: Casc.Fonts SAPWIN Unicode) and one for pdf forms(adobe document service). I want to use one printer for any documents. But PDF printer prints non-english charset like ########.
    What can I do ?

    Hi, Roman!
    I want to use PDF printer for both types of output. I have a dedicated java instance for ADS.
    There is a device type for our Kyocera Printer. My pdf printer prints ALV list good exept russian charset.
    It prints like #####

  • Get the header in centre,make bold, change font in hierarchical alv  list

    Hi all
    I need to get the following header in the centre for hierarchical alv list:
    ex:
                                                                              General Ledger                       -
    want it to be bold
                                                                               July 2009                                -
      want to change font to be less than 1st  line
    Please help me to achieve this.
    I have  got the header in the middle using write statements in top of page.
    But am not able to get it bold and change the font.
    Thanking in advance.

    Hi all
    I need to get the following header in the centre for hierarchical alv list:
    ex:
                                                                    General Ledger   ( want it to be bold)
                                                                     July 2009            (want to change font to be less than 1st  line )
    Please help me to achieve this.
    I have  got the header in the middle using write statements in top of page.
    But am not able to get it bold and change the font.
    Thanking in advance.

  • How to create space between Header text of Hierarchical ALV List.

    hi,
    I am display data using Hierarchical ALV List.
    In Perform of field catalog, I am writing this code:
    PERFORM fill_catalogue USING :
         'CHKBX'      'T_HEADER' 20  'Sess Decision Box'(t19) 'X',
          'SESS_NO'    'T_HEADER' 11  'Session'(t20)           ' ' ,
          'SESS_STAT'  'T_HEADER'  4  'Status'(t39)            ' ',
          'HOLD_STAT'  'T_HEADER'  4  'HOLD'(t52)              ' ',
          'ICON'       'T_HEADER'  9  'Tracking'(t21)          ' ' ,
          'CREATE_DT'  'T_HEADER' 10  'Archiving Date'(t22)    ' '  ,
          'AGING'      'T_HEADER' 50  'Aging'(t23)             ' ',
          'OBJECT'     'T_HEADER' 12  'Archive Obj'(t24)       ' ',
          'HOLD_INFO'  'T_HEADER' 100 'Hold Reason'            ' ' ,
          'YFY_DATA'   'T_HEADER' 4  'Data Fiscal Year'(t48)  ' ' ,
          'COMMENTS'   'T_HEADER' 50  'Session Notes'(t26)     ' ' ,
          'DATATYPE'   'T_HEADER' 50  'Archive Object Description'(t25) ' ',
          'APPR_STAT'    'T_ITEM' 16  'Approval Status'(t29)   ' ',
          'DESTR_DT_REV' 'T_ITEM' 10  'New Date'(t30)          ' ',
          'REJCT_REASON' 'T_ITEM' 60  'Rejection Reason'(t31)  ' '  .
    At output of this program , there are two rows in HEADER details.
    I want text 'Session notes' of 2nd row  under 'Archiving Date' of 1st row.
    For this i have to create space between 'Data Fiscal Year' & 'Session notes' text.
    How i can do this.
    Regards,
    Mamta

    Hi,
    You can use TOP-OF-PAGE event and pass this event to Hierarchical ALV FM.
    Thanks,
    Kartavya Kaushik.

  • My wish list paging control is broken and I can't access my most recent additions; any suggestions?

    My wish list paging control is broken and I can't access my recent additions; any suggestions?  It seems to be stuck on page1 (I have 7 pages with a total of 181 songs saved).

    I Posted this too not long ago and a few people replied it's being looked into. It's a gltch. Fyi wyour ishlist still exist, you just cant scroll down. I cant see it on pc but on ipad i can see entire list.

  • I've been working with documents in pages and recently downloaded word for mac. i open the pages documents and they appear to be corrupt. at least, a lot of the font is now in weird boxed pictures. what do i do?

    I've been working with documents in Pages and recently downloaded Word for Mac. Upon opening Pages documents with Pages, the documents appear corrupt. Much of the font has been replaced with boxed little pictures - yet they are identified as times new roman. What do I do?

    You got the new iphone?????   I have same problem.  I transferred audiobooks to device to find no audiobooks on device (despite it being in iTunes as if it was).  Have you found a solution?????   I even tried to change import settings on format transfer but hasn't worked. 

  • I am running a MacBook Pro with 10.7.5 and I downloaded the OS X 10.10.2 Update Combo, however when I try and open the package the error message "This volume is used for TimeMachine-backups". Which is not true. I´m using TimeCapsule.

    I am running a MacBook Pro with 10.7.5 and I downloaded the OS X 10.10.2 Update Combo.
    When I try and open the package after accepting the lincence-agreement and upon choosing the install-volume the error message appears: "This volume is used for TimeMachine-backups".
    Which is not true. I´m using a timecapsule for backups.
    How can I proceed?

    I am using a MacBook Pro (2010) with 2.53 GHz Intel Core i5, 4GB, 1067 MHz, DDR3, Startvolume Macintosh HD.
    After downloading the package and starting upgrading it asks acceptance of the license-agreement. After that it asks for the volume were to install. And when I click on the Startvolume Macintosh HD (which is the only available on the machine) it says: "The volume is already being used for Time Machine-Backups".
    It doesn´t offer to skip that point or to reconfigure the Time Machine settings.
    The point is that my Time machine is not and has never used the Mac HD for Backups. In the past I have used an external drive and since 05/2014 I am using a Time Capsule which is appropriately addressed in the Time Machine settings.

  • Does 'versions' work with microsoft word, ppt and excel or just pages, keynote and numbers?

    Does 'versions' work with microsoft word, ppt and excel or just pages, keynote and numbers? I tried to do what the videos say but the little icon for versions is not there on word. Does this mean it only works for pages etc... or do i have to activate it somehow? If it is only for pages then this ***** and should be better advertised!!!

    Each application will need to be updated to work with Versions, Full Screen, and other Lion-specific features.

  • ALV list with count of the table

    Dear all,
    My requirement is i want display the output as alv list along with the count of the table .
    i got the count  but unable to diplay the  below the list.
    please suggest me.
    Thanks& Regards,
    RP

    If you are using a custom control on the screen and then a custom container you can easily do this.
    Create a screen(Size 200 x 240), place a custom control on the screen and make it to the max size  200 x 240. Now in the attributes of the custom control, check the Resizing option for both horizontal and vertical, with some minimum numbers there.
    Now, your ALV grid automatically occupies all the space available on the screen irrespective of the size if the screen and you will have only one scroll bar.
    Regards,
    Ravi
    Note - Please mark all the helpful answers

  • ALV  List Layout add new button  and modify Append Row Button Text and Logi

    Hi All,
    I am working on Employee custom development Application in Webdynpro ABAP>
    In my ALV list Layout  I have to add new  two Buttons  Top or Bottom of the ALV List.
    If I am adding I have to add logic for those Buttons. How to add and add logic for those buttons.
    as well as I have to Change the  Text  for  Existing Button ''Append Row''    to  "ADD NEW ROWS"
    and I have to add logic in this button while Append New Row I have to generate ID no for New Rows .
    Kindly help/advice  me to proceed further.
    Thanks in advance.
    Dav

    Hi Dav,
    To Add buttons please refer this thred,
    ALV with user-defined buttons on toolbar in wd abap
    To change or rename text in ALV standard buttons, please refer this ...
    How can i change the text of an standard button in ALV?
    and also see this article on self defined functions...
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2110?quicklink=index&overridelayout=true
    Thanks,
    Kris.
    Edited by: kissnas on Feb 22, 2011 5:59 AM

  • How to display ALV list with more than 1 structure?

    Hello everyone,
    I am using REUSE_ALV_LIST_DISPLAY to generate a report that displays vendor/customer items with purchases/sales total. I have 2 internal table for this. For every vendor/customer i need a total table right after, this have a different structure. I cannot use REUSE_ALV_BLOCK_LIST_ as this is not capable of calculating the subtotal per currency and from the documentation it says do not use.
    Any idea on how to proceed?
    Thanks!

    Call ALV list function module per table structure.
    Closing this thread.

  • ALV list with empty data - What could have gone wrong?

    Dear experts,
    I'm currently working on some codes to display data (the tables involved really do contain data), but when the codes are executed, the ALV list does not contain any data in it (only the column headers are fine).
    What could have gone wrong? I've been staring at the codes for hours now. Please help. Appreciate any help at all. 
    Displaying ALV data with REUSE_ALV_LIST_DISPLAY:
    form display_alv_data .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
    *     I_INTERFACE_CHECK              = ' '
    *     I_BYPASSING_BUFFER             =
    *     I_BUFFER_ACTIVE                = ' '
          I_CALLBACK_PROGRAM             = w_prog
    *     I_CALLBACK_PF_STATUS_SET       = ' '
    *     I_CALLBACK_USER_COMMAND        = ' '
    *     I_STRUCTURE_NAME               =
    *     IS_LAYOUT                      =
          IT_FIELDCAT                    = gt_field_cat[]
    *     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
    *     IR_SALV_LIST_ADAPTER           =
    *     IT_EXCEPT_QINFO                =
    *     I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    *   IMPORTING
    *     E_EXIT_CAUSED_BY_CALLER        =
    *     ES_EXIT_CAUSED_BY_USER         =
        TABLES
          T_OUTTAB                       = gt_final
        EXCEPTIONS
          PROGRAM_ERROR                  = 1
          OTHERS                         = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endform.                    " display_alv_data
    Retrieving data from the database tables into the internal table:
    form retrieve_data .
      " For internal table 1
      SELECT ekbe~ebeln
             mseg~mblnr
             ekbe~belnr
             ekbe~ebelp
             ekbe~matnr
             ekbe~menge
             ekbe~dmbtr
             ekbe~werks
             mseg~lgort
             mseg~lifnr
             lfa1~name1
      FROM ekbe INNER JOIN mseg ON ekbe~ebeln = mseg~ebeln
                INNER JOIN lfa1 ON mseg~lifnr = lfa1~lifnr
      INTO CORRESPONDING FIELDS OF TABLE gt_1
      WHERE mseg~bwart = '101' AND      " Movement type: Goods Receipt
            ekbe~vgabe = '2' AND        " Transaction / event type for Invoice Verification Number
            ekbe~matnr IN s_m_num AND
            mseg~lifnr IN s_v_num.
      " For internal table 2
      SELECT ekbe~ebeln
             makt~maktx
             eket~eindt                 
      FROM ekbe INNER JOIN makt ON ekbe~matnr = makt~matnr
                INNER JOIN eket ON ekbe~ebeln = eket~ebeln
      INTO CORRESPONDING FIELDS OF TABLE gt_2
      WHERE eket~eindt IN s_d_date.
      " For internal table 3
      SELECT ekbe~ebeln
             ekko~bedat
             ekko~ekorg
             ekko~ekgrp
             ekko~bukrs
      FROM ekbe INNER JOIN ekko ON ekbe~ebeln = ekko~ebeln
      INTO CORRESPONDING FIELDS OF TABLE gt_3
      WHERE ekko~bedat IN s_p_date AND
            ekko~ekorg IN s_p_org AND
            ekko~ekgrp IN s_p_grp.
      " For the final internal table
      SORT: gt_1, gt_2, gt_3.
      LOOP AT gt_1.
        MOVE-CORRESPONDING gt_1 TO gt_final.
        READ TABLE gt_2 WITH KEY gfs_ebeln = gt_1-gfs_ebeln BINARY SEARCH.
        MOVE-CORRESPONDING gt_2 TO gt_final.
        READ TABLE gt_3 WITH KEY gfs_ebeln = gt_1-gfs_ebeln BINARY SEARCH.
        MOVE-CORRESPONDING gt_3 TO gt_final.
        APPEND gt_final.
      ENDLOOP.
    endform.                    " retrieve_data

    Dear forumers,
    I apologize for the rather late reply. The SAP server that I've been working on was down since Thursday evening and I wasn't able to debug much into the codes. Nevertheless, I really do appreciate all of your inputs and help here.
    Rob,
    I've just debugged my codes again and found out that in the first place, there is no data contained in the internal table gt_1 at all. My rough guess is because I've misused the INNER JOIN wrongly here (see code comments below):-
      SELECT ekbe~ebeln
             mseg~mblnr
             ekbe~belnr
             ekbe~ebelp
             ekbe~matnr
             ekbe~menge
             ekbe~dmbtr
             ekbe~werks
             mseg~lgort
             mseg~lifnr
             lfa1~name1  " this line should probably be commented out
      FROM ekbe INNER JOIN mseg ON mseg~ebeln = ekbe~ebeln
                        INNER JOIN lfa1 ON lfa1~lifnr = mseg~lifnr   " this line should probably be commented out - the table join here is not based on table ekbe at all
      INTO CORRESPONDING FIELDS OF TABLE gt_1
      WHERE mseg~bwart = '101' AND     
            ekbe~vgabe = '2' AND 
            ekbe~matnr IN s_m_num AND
            mseg~lifnr IN s_v_num.
    Next, I commented out certain lines further and found that there is still no data contained in the internal table gt_1 again, as follows:-
      SELECT ekbe~ebeln
             mseg~mblnr
             ekbe~belnr
             ekbe~ebelp
             ekbe~matnr
             ekbe~menge
             ekbe~dmbtr
             ekbe~werks
             mseg~lgort
             mseg~lifnr
             " lfa1~name1
      FROM ekbe INNER JOIN mseg ON mseg~ebeln = ekbe~ebeln
                        " INNER JOIN lfa1 ON lfa1~lifnr = mseg~lifnr
      INTO CORRESPONDING FIELDS OF TABLE gt_1.
      " WHERE mseg~bwart = '101' AND     
            " ekbe~vgabe = '2' AND 
            " ekbe~matnr IN s_m_num AND
            " mseg~lifnr IN s_v_num.
    There should be data contained in table ekbe here. What could have really gone wrong now?

  • ALV list with 2 header lines

    Dear gurus,
    Need help in displaying ALV list report. the below report is an example of AR aging report. The report output is as below:
    DEC
    NOV
    OCT
    SEP
    0-30
    31-60
    61-90
    90+
    xx
    xx
    xx
    xx
    SUBTOTAL
    The first 2 lines are the list header. While the 'x' is the amount.
    How can i display the above output with 2 header lines? I was thinking of using the  REUSE_ALV_FIELDCATALOG_MERGE function. But it will have 2 lines of body row too. In fact, i only one one row in the body. But if i define the header lines manually, i would not able to do the subtotal at the end of the alv list. I need to have the subtotal too.
    Thanks in advance!

    Hi,
    For this requirement you need to populate the fld catalog using row_pos and col_pos fields specifing proper position.
    See this code snippet ..... this is only possible for ALV list.
    TYPE-POOLS: slis.
    DATA: ld_fieldcat    TYPE slis_fieldcat_alv.
    DATA: t_alv_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv.
    DATA : it_fld TYPE slis_t_fieldcat_alv,
           wa_fld TYPE slis_fieldcat_alv.
    data: BEGIN OF itab OCCURS 0,
            carrid    like sflight-carrid,
            connid    like sflight-connid,
            planetype like sflight-planetype,
            seatsmax  like sflight-seatsmax,
          END OF itab.
    START-OF-SELECTION.
    SELECT carrid connid planetype seatsmax
           FROM sflight
           INTO TABLE itab.
      CLEAR: ld_fieldcat.
      ld_fieldcat-row_pos       = '1'.
      ld_fieldcat-col_pos       = '1'.
      ld_fieldcat-tabname       = 'ITAB'.
      ld_fieldcat-fieldname     = 'CARRID'.
      ld_fieldcat-ref_tabname   = 'SFLIGHT'.
      ld_fieldcat-outputlen     = '10'.
      APPEND ld_fieldcat TO t_alv_fieldcat.
      CLEAR ld_fieldcat.
      CLEAR: ld_fieldcat.
      ld_fieldcat-row_pos       = '1'.
      ld_fieldcat-col_pos       = '2'.
      ld_fieldcat-tabname       = 'ITAB'.
      ld_fieldcat-fieldname     = 'CONNID'.
      ld_fieldcat-ref_tabname   = 'SFLIGHT'.
      ld_fieldcat-outputlen     = '10'.
      APPEND ld_fieldcat TO t_alv_fieldcat.
      CLEAR ld_fieldcat.
      CLEAR: ld_fieldcat.
      ld_fieldcat-row_pos       = '2'.
      ld_fieldcat-col_pos       = '1'.
      ld_fieldcat-tabname       = 'ITAB'.
      ld_fieldcat-fieldname     = 'PLANETYPE'.
      ld_fieldcat-ref_tabname   = 'SFLIGHT'.
      ld_fieldcat-outputlen     = '10'.
      APPEND ld_fieldcat TO t_alv_fieldcat.
      CLEAR ld_fieldcat.
      CLEAR: ld_fieldcat.
      ld_fieldcat-row_pos       = '2'.
      ld_fieldcat-col_pos       = '2'.
      ld_fieldcat-tabname       = 'ITAB'.
      ld_fieldcat-fieldname     = 'SEATSMAX'.
      ld_fieldcat-ref_tabname   = 'SFLIGHT'.
      ld_fieldcat-outputlen     = '10'.
      APPEND ld_fieldcat TO t_alv_fieldcat.
      CLEAR ld_fieldcat.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          it_fieldcat        = t_alv_fieldcat[]
        TABLES
          t_outtab           = ITAB. "internal table
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Regards,
    Amitava

  • ALV List with checkboxes

    Hello experts,
    I'm working on an object where in I need to display an ALV List (using Funct Modules) with checkboxes.
    When I select the checkboxes,and click on a button (Eg.Refresh Button) , I need to get all the details of the selected rows (checked rows) in a seperate ALV List (in a Dailog).
    Could any one of u please suggest me about selecting the row which has been checked(Checkboxes in ALV ).
    Thanks in advance.
    Sanghamitra

    Hi sangha,
    1. To get a taste of it,
       just copy paste this program.
    2. It will display alv (t001)
       It will show CHECKBOXES (besides every row)
       TICK some rows,
      and DOUBLE-CLICK ON any row.
    3.  It will display all the row numbers which have been checked/ticked.
    4.
    report abc.
    TYPE-POOLS : slis.
    Data
    DATA : BEGIN OF itab OCCURS 0.
            INCLUDE STRUCTURE t001.
    DATA : flag tyPE c,
           END OF itab.
    DATA : alvfc TYPE slis_t_fieldcat_alv.
    DATA : alvly TYPE slis_layout_alv.
    Select Data
    SELECT * FROM t001 INTO TABLE itab.
    *------- Field Catalogue
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
        i_program_name         = sy-repid
        i_internal_tabname     = 'ITAB'
        i_inclname             = sy-repid
      CHANGING
        ct_fieldcat            = alvfc
      EXCEPTIONS
        inconsistent_interface = 1
        program_error          = 2
        OTHERS                 = 3.
    Display
    alvly-box_fieldname = 'FLAG'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
        it_fieldcat             = alvfc
        i_callback_program      = sy-repid "<-------Important
        i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important
        is_layout               = alvly
      TABLES
        t_outtab                = itab
      EXCEPTIONS
        program_error           = 1
        OTHERS                  = 2.
    CALL BACK FORM
    FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
    slis_selfield.
      data : msg(100) type c.
      LOOP AT itab.
        if itab-flag = 'X'.
          msg = sy-tabix.
          condense msg.
          concatenate 'Row Number ' msg ' ' into msg
          separated by space.
          message msg type 'I'.
        endif.
      ENDLOOP.
    ENDFORM. "ITAB_user_command
    regards,
    amit m.

Maybe you are looking for

  • Itunes in my Mac does not see my Iphone. It is seen only as camera

    I just bought this Iphone and by mistake I checked "Yes" to a question if I wanted to turn on the automatic updates. After several minutes the Iphone was visible by Itunes in my Mac it disappeared and do not know where to disable such functions to re

  • Ipod music

    My son and daughter currently share one ipod and music library. My son is going to get his own ipod. Question is, how can I transfer music from one library to another?

  • How to show multipe records on a single record

    Hi all, I have a query which can contain 1 or Many records for each S.WAS_NO or APPL_NO even. A new record is created when the APPL_STATUS changes and a timestamp is created in APPL_STATUS_CHANGE_DATE. select distinct        S.APPL_ID,        S.WAS_N

  • CRM to SAP R/3

    Hi experts, My client have a requiremnt that they installed the ADD-On in their SAP R/3 Server and they can access credit management system FD32 from SAP R/3 Server. They have CRM Server and they want to access the SAP R/3 screens from CRM. I created

  • Unable to Launch Photoshop CC 2014 from Dreamweaver CC 2014!

    Although I still have DWCC and DWCS6 still on my PC - and the roundtrip editing from within Dreamweaver works flawlessly - it does not work with DWCC2014 when trying to get PSCC2014 to open an image for editing. All I see is an error message stating: