Download dynamic fields (based on changed layout) from ALV

Hello All,
Currently i am displaying 28 firelds in my ALV output.
I have created my own button for downloading the contents displayed using GUI_DOWNLOAD.
Say if user changes the layout and say now we have 35 fields in the layout.
Now when we click the DOWNLOAD button, i want to download these 35 fields instead of 28 fields.
Can anyone please help me on this...
Thanks in advance....
Regards,
Tarun

Hi Tarun,
As the frontend layout is directly connected to this output table, standard excel download would work here (because it already knows which column to display and download).
But as you want custom solution I think the following might work:
- get fieldcatalog using GET_FRONTEND_FIELDCATALOG
- loop through it and check if field is in displayed mode ( NO_OUT ne 'X' ).
- create (or just copy above entries) to new fieldcatalog table
- use class CL_ALV_TABLE_CREATE to generate dynamic table with structure of displayed fields only (based on that new fieldcatalog)
- loop through output table and copy corresponding fields to your dynamic table appending to it
- download dynamic table using GUI_DOWNLOAD (parameter DATA_TAB here is generic so you can pass any table structure).
Regards
Marcin

Similar Messages

  • How can i create a dynamic structure based on my input from a select-option

    Hello,
    This is to develop a custom report in FI for G/L Balance based on company code.
    I have an input select-option for Company code.
    Based on the range of company code my output layout should be modified.
    I am not very much sure to create a dynamic internal based on the input from a select-option.
    Can any one please let me know how can i do this.
    I would appreciate for anyone who turns up quickly.
    Thank you,
    With regs,
    Anitha Joss.

    See the following program, it builds a dynamic internal table based on the company codes from the select option. 
    report zrich_0001 .
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>.
    data: alv_fldcat type slis_t_fieldcat_alv,
          it_fldcat type lvc_t_fcat.
    data: it001 type table of t001 with header line.
    selection-screen begin of block b1 with frame title text-001.
    select-options: s_bukrs for it001-bukrs.
    selection-screen end of block b1.
    start-of-selection.
      select * into table it001 from t001
                     where bukrs in s_bukrs.
      perform build_dyn_itab.
    *  Build_dyn_itab
    form build_dyn_itab.
      data: index(3) type c.
      data: new_table type ref to data,
            new_line  type ref to data,
            wa_it_fldcat type lvc_s_fcat.
      clear wa_it_fldcat.
      wa_it_fldcat-fieldname = 'PERIOD' .
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 6.
      append wa_it_fldcat to it_fldcat .
      loop at it001.
        clear wa_it_fldcat.
        wa_it_fldcat-fieldname = it001-bukrs .
        wa_it_fldcat-datatype = 'CHAR'.
        wa_it_fldcat-intlen = 4.
        append wa_it_fldcat to it_fldcat .
      endloop.
    * Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = it_fldcat
                   importing
                      ep_table        = new_table.
      assign new_table->* to <dyn_table>.
    * Create dynamic work area and assign to FS
      create data new_line like line of <dyn_table>.
      assign new_line->* to <dyn_wa>.
    endform.
    Regards,
    Rich Heilman

  • Change layout from Dreamweaver CC to CS6 (Was: layout...)

    how do i change the layout from dreamweaver cc to dreamweaver cs6. i need to use cs6 for class. thx.

    DW CC = ver 13. DW CS6 = ver 12.  You need to download & install CS6 alongside CC.
    CS6 Direct Downloads.  Be sure to follow the VERY IMPORTANT INSTRUCTIONS or it won't work.
    http://prodesigntools.com/adobe-cs6-direct-download-links.html
    Nancy O.

  • From where can we give the details of change layout in alv

    Hi,
    I am executing an ALV Grid report, and output is coming fine , if i see the print preview for some particular fields some digits or missing
    so i used the button change layout there i can see that length is not sufficient i have changed that and its working fine but each and every
    time i need to change the layout  and then take the print............if i wanted to save my changes in chnage layout or else pls tell me from where we are getting all those details in change layout so that i can go there and change.........
    thanks

    Hi,
    You can save the changes done in the layout.
    First you change the layout , then save it by giving a name. Use / as first character if you want to make the changes global, otherwise for a user specific layout save it with A-Z as first character. Make it default so you need not have to change/choose the layout each time you print.
    Regards,
    Alok

  • Changing layout of ALV to excel and displaying the data there

    Dear All,
    My requirement is that I have to develop an ALV report, and also plot the graphs for the same.
    I need different types of graphs, so I have searched on SDN, and I found out a blg:-
    "Report with a Graph.. An Approach!"
    Here is what the person has done:-
    I developed a simple ABAP report using ALV and just dumped all my data on it.
    After this I downloaded the Standard Excel template available in the ALV.
    Defined my own worksheets in this template, wrote some macros to pick up the data from the “RawHeader” sheet, which is available by default and will contain the ALV data.
    I inserted 1 chart in this Excel template. In this chart I used the same chart type as was being used by the user for his graph. Just right clicked on the Graph area and made the changes in the source data and made it point to the sheet containing the final data.
    That’s it my job is almost done.
    After this uploaded this template back into the report output through
    the layout settings->Change Layout Tab.
    Save it as a variant and made it a default. (Do not default it if you have more than 1 user and more than 1 template…. Select the appropriate variant for the appropriate user and then display)
    Well, this also was not that easy as I had thought. I landed up into 1 trouble.
    In my report the number of columns displayed was not constant and kept changing based on the input. This fact was taken care by designing a variable field catalogue. But now I had gone past the simple ALV display and was giving the output in an Excel sheet using a pre-defined template. Well, I immediately found a solution to this with the set_frontend_fieldcatalogue method of CL_GUI_ALV_GRID class and fixed the field catalogue every time after calling the set_table_for_first_display method. This solved most of my problems, which were not many though.
    Now here are my issues:-
    I have developed the ALV report, and I have also changed the layout to excel.
    But, I am unable to get the ALV Report data in the RawHeader Sheet, which is available by default.
    Could anyone please guide me through this method??
    It is urgent.
    Points are assured for helpful answers.
    Thanks and regards,
    Prerna

    Hi Satya Priya,
    Do I have to create my own template, or the Standard ones available will do?
    HEre is what I do:-
    Once I get my ALV output, I goto Change LAyout->View tab.->Prefered view->Microsoft Excel.
    Here I get a list of available excel templates There are 2:-
    sap_mm.xls, and sap_om.xls
    I select one of these, and the excel spreadsheet is displayed on the ALV screen.
    But the re is another button, "Upload Document to BDS".
    Do I have to upload one of the above templated to BDS?
    And please tell me in detail, what is BDS???
    Thanks for your help, and waiting for reply,
    Prerna

  • Problem in changing layout of ALV to excel

    Hello everyone,
    I have developed an ALV program, wherein I need to show the graphs for the same.
    For this, I need my data in excel format, so that I can write some macros ,and do the further processing on it(I am using an appraoch I found on SDN, "Report with graph").
    I got to know, that I need <b>SAP R/3: Add On:Interactive Excel</b>.
    I asked the BASIS guys to install it, but even after installing it, I am unable to view the data in Excel layout, when I do Change LAyout->View->Microsoft Excel.
    Could anyone let me know if there is any other setting which is required to view the data in excel?On the excel side, we can change the security level(Tools->Macro->Security) to either low, medium or high.
    Is there any such provision in SAP?
    Kindly suggest your answers, as it is important for me to get the data in excel.
    Points will be rewarded.
    Thanks and regards,
    Prerna

    Hi,
    I have already tried what you have just mentioned.
    I searched the entire SDN, for this, and this was one of the replies   
    But still we don't get the data(Even you didn't get it, right?).
    when we change the layout to excel(Excel Inplace), there are 2 sheets by default:-
    Rawheader and Rawdata.The data comes in RAwheader sheet.
    But there is some setting on the BASIS side, which need to be done, in order for it to work.
    I have asked my BASIS colleagues and some of my senior consultants to look into the same.
    They will let me know.
    I would also suggest you try your program on another PC.
    I will let you know as soon as I get any replies from my colleagues.
    Thanks and regards,
    Prerna

  • Not able to download all the rows to excel sheet from alv grid display

    Hi experts,
    I am not able to download all the rows which are displayed in alv grid display for some material numbers.
    for some materials i am able to download, i used two ways to download 1) from icon(local file) on grid 2) menu list->export.
    i checked in debugging till selecting the spread sheet pop up window, i am able to see all the data in internal table.
    Can you suggest me what will be the problem....
    thanks in advance,

    hi sandeep,
    sorry for didnt specify clearly.
    note: EX: "asaasdada  in this sentence i said  " this symbol is special character not the text.
    building final internal table code
    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
        EXPORTING
          capid                 = p_capid
          datuv                 = sy-datum
          ehndl                 = '1'
          mktls                 = 'X'
          mehrs                 = 'X'
          mmory                 = '1'
          mtnrv                 = p_matnr
          stlal                 = '1'
          stpst                 = 0
          svwvo                 = 'X'
          werks                 = p_werks
          vrsvo                 = 'X'
        TABLES
          stb                   = i_stb
        EXCEPTIONS
          alt_not_found         = 1
          call_invalid          = 2
          material_not_found    = 3
          missing_authorization = 4
          no_bom_found          = 5
          no_plant_data         = 6
          no_suitable_bom_found = 7
          conversion_error      = 8
          OTHERS                = 9.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      i_stb1[] = i_stb[].
      IF NOT i_stb1[] IS INITIAL.
        SORT i_stb1 BY idnrk.
        DELETE ADJACENT DUPLICATES FROM i_stb1 COMPARING idnrk.
        SELECT bmatn ematn FROM ampl INTO TABLE i_ampl
          FOR ALL ENTRIES IN i_stb1
          WHERE bmatn = i_stb1-idnrk AND
                datuv LE sy-datum AND                          
                datub GE sy-datum.                              
        SELECT
        matnr
        bwkey
        verpr
        stprs
        bwprh
        FROM mbew
        INTO TABLE i_mbew
        FOR ALL ENTRIES IN i_stb1
        WHERE
            matnr EQ i_stb1-idnrk AND
            bwkey EQ i_stb1-werks.
        IF NOT i_stb1[] IS INITIAL.
          SELECT matnr werks beskz
                 dzeit webaz plifz                              
                 ekgrp                                         
          INTO TABLE i_marc
          FROM marc
          FOR ALL ENTRIES IN i_stb1
          WHERE matnr = i_stb1-idnrk
          AND werks = i_stb1-werks.
          SORT i_marc BY matnr werks.
        ENDIF.
        CLEAR i_ekpo.
        CLEAR i_vend.
        IF NOT i_stb1[] IS INITIAL.
          SELECT ebeln ebelp matnr werks loekz aedat
                 netpr peinh                                   
          INTO TABLE i_ekpo
          FROM ekpo
                FOR ALL ENTRIES IN i_stb1
                WHERE matnr = i_stb1-idnrk
                AND werks = i_stb1-werks.
          SORT i_ekpo BY matnr ASCENDING
                         aedat DESCENDING
                         ebeln DESCENDING
                         ebelp DESCENDING.
          IF NOT i_ekpo IS INITIAL.
            SELECT k~ebeln k~lifnr l~name1
            INTO TABLE i_vend
            FROM ekko AS k INNER JOIN lfa1 AS l
            ON k~lifnr EQ l~lifnr
            FOR ALL ENTRIES IN i_ekpo
            WHERE ebeln = i_ekpo-ebeln.
            SORT i_vend BY ebeln.
          ENDIF.
        ENDIF.
      ENDIF.
      i_ampl1[] = i_ampl[].
      IF NOT i_ampl1[] IS INITIAL.
        SORT i_ampl1 BY ematn.
        DELETE ADJACENT DUPLICATES FROM i_ampl1 COMPARING ematn.
        SELECT matnr mfrpn mfrnr FROM mara INTO TABLE i_mara
          FOR ALL ENTRIES IN i_ampl1
           WHERE matnr = i_ampl1-ematn.
      ENDIF.
      SORT i_ampl BY bmatn.
      IF NOT i_stb[] IS INITIAL.
        SELECT stlty stlnr stlkn stpoz idnrk potx1 potx2
        INTO TABLE i_stpo
        FROM stpo
        FOR ALL ENTRIES IN i_stb
        WHERE stlty = i_stb-stlty
          AND stlnr = i_stb-stlnr
          AND stlkn = i_stb-stlkn
          AND stpoz = i_stb-stpoz
          AND idnrk = i_stb-idnrk.
        SORT i_stpo BY stlty stlnr stlkn stpoz idnrk.
      ENDIF.
      LOOP AT i_stb INTO wa_stb.
        READ TABLE i_marc INTO wa_marc
        WITH KEY     matnr = wa_stb-idnrk
                     werks = wa_stb-werks
                     BINARY SEARCH.
        IF sy-subrc = 0.
          wa_outtab-beskz = wa_marc-beskz.
          wa_outtab-dzeit = wa_marc-dzeit.                      
          wa_outtab-webaz = wa_marc-webaz.                     
          wa_outtab-plifz = wa_marc-plifz.                     
          wa_outtab-ekgrp = wa_marc-ekgrp.                     
        ENDIF.
        READ TABLE i_ekpo INTO wa_ekpo
            WITH KEY matnr = wa_stb-idnrk.
        IF sy-subrc = 0.
          wa_outtab-netpr = wa_ekpo-netpr.                     
          wa_outtab-peinh = wa_ekpo-peinh.                     
          READ TABLE i_vend INTO wa_vend
          WITH KEY ebeln = wa_ekpo-ebeln
                   BINARY SEARCH.
          IF sy-subrc = 0.
            wa_outtab-lifnr = wa_vend-lifnr.
            wa_outtab-name_sup = wa_vend-name1.
          ENDIF.
        ENDIF.
        READ TABLE i_stpo INTO wa_stpo
        WITH KEY stlty = wa_stb-stlty
                 stlnr = wa_stb-stlnr
                 stlkn = wa_stb-stlkn
                 stpoz = wa_stb-stpoz
                 idnrk = wa_stb-idnrk
                 BINARY SEARCH.
        IF sy-subrc = 0.
          wa_outtab-potx1 = wa_stpo-potx1.
          wa_outtab-potx2 = wa_stpo-potx2.
        ENDIF.
        READ TABLE i_mbew INTO wa_mbew
        WITH KEY
        matnr = wa_stb-idnrk
        bwkey = wa_stb-werks.
        IF sy-subrc IS INITIAL.
          MOVE:
          wa_mbew-verpr TO wa_outtab-verpr,
          wa_mbew-stprs TO wa_outtab-stprs,
          wa_mbew-bwprh TO wa_outtab-bwprh.
        ENDIF.
        wa_outtab-matnr = p_matnr.
        wa_outtab-posnr = wa_stb-posnr.
        wa_outtab-stufe = wa_stb-stufe.
        wa_outtab-idnrk = wa_stb-idnrk.
        wa_outtab-ojtxb = wa_stb-ojtxp.
        wa_outtab-menge = wa_stb-menge.
        wa_outtab-meins = wa_stb-meins.
        MOVE: wa_stb-zzitem_draw_no TO wa_outtab-zzitem_draw_no.
        IF wa_stb-upskz = 'X'.
          SELECT * FROM stpu INTO TABLE i_stpu
                   WHERE  stlty = wa_stb-stlty AND
                          stlnr = wa_stb-stlnr AND
                          stlkn = wa_stb-stlkn AND
                          stpoz = wa_stb-stpoz.
        ENDIF.
        LOOP AT i_stpu INTO wa_stpu.
          wa_outtab-upmng = wa_stpu-upmng.
          wa_outtab-ebort = wa_stpu-ebort.
          wa_outtab-uposz = wa_stpu-uposz.
          CONCATENATE v_ebort wa_stpu-ebort      INTO v_ebort
          SEPARATED BY space.
        ENDLOOP.
        MOVE strlen( v_ebort ) TO v_len.
        MOVE: 0 TO x,
          128 TO y.
        DATA : lt_tab TYPE TABLE OF swastrtab.
        DATA : ls_tab LIKE LINE OF lt_tab.
        DATA : lv_ebort TYPE string.
        CLEAR lv_ebort. CLEAR lt_tab.
        MOVE v_ebort TO lv_ebort.
        CALL FUNCTION 'SWA_STRING_SPLIT'
          EXPORTING
            input_string                 = lv_ebort
            max_component_length         = 128
          TABLES
            string_components            = lt_tab
          EXCEPTIONS
            max_component_length_invalid = 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.
        IF lt_tab[] IS NOT INITIAL.
          LOOP AT lt_tab INTO ls_tab.
            CLEAR lv_ebort.
            MOVE: ls_tab-str TO lv_ebort.
            CONDENSE lv_ebort.
            MOVE lv_ebort TO wa_outtab-ebort.
            APPEND wa_outtab TO i_outtab.
            CLEAR:
            wa_outtab-matnr,
            wa_outtab-posnr,
            wa_outtab-zzitem_draw_no,
            wa_outtab-ojtxb,
            wa_outtab-menge,
            wa_outtab-meins,
            wa_outtab-uposz,
            wa_outtab-upmng,
            wa_outtab-verpr,
            wa_outtab-stprs,
            wa_outtab-bwprh,
            wa_outtab-lifnr,
            wa_outtab-name_sup,
            wa_outtab-potx1,
            wa_outtab-potx2,
            wa_outtab-netpr,
            wa_outtab-peinh.
    *        wa_outtab-idnrk.
          ENDLOOP.
        ELSE.
          APPEND wa_outtab TO i_outtab.
        ENDIF.
        CLEAR v_ebort.
        CLEAR: wa_stpu.
        REFRESH: i_stpu.
        LOOP AT i_ampl INTO wa_ampl WHERE bmatn = wa_stb-idnrk.
        READ TABLE i_mara INTO wa_mara WITH TABLE KEY matnr = wa_ampl-ematn.
          IF sy-subrc = 0.
            LOOP AT i_outtab INTO wa_outtab
            WHERE
            idnrk = wa_stb-idnrk AND
            flag NE 'X'.
              wa_outtab-mfrpn = wa_mara-mfrpn.
              wa_outtab-mfrnr = wa_mara-mfrnr.
              SELECT SINGLE name1 FROM lfa1 INTO wa_outtab-name1 WHERE lifnr = wa_mara-mfrnr.
              MOVE 'X' TO wa_outtab-flag.
              MODIFY i_outtab FROM wa_outtab
              TRANSPORTING mfrpn mfrnr name1 flag.
              EXIT.
            ENDLOOP.
            IF sy-subrc <> 0.
              CLEAR:
              wa_outtab-matnr,
              wa_outtab-posnr,
              wa_outtab-zzitem_draw_no,
              wa_outtab-ojtxb,
              wa_outtab-ebort,
    *          wa_outtab-idnrk,
              wa_outtab-menge,
              wa_outtab-meins,
              wa_outtab-uposz,
              wa_outtab-upmng,
              wa_outtab-verpr,
              wa_outtab-stprs,
              wa_outtab-bwprh,
              wa_outtab-lifnr,                                 
              wa_outtab-name_sup,                              
              wa_outtab-potx1,                                 
              wa_outtab-potx2,                                 
              wa_outtab-netpr,                                 
              wa_outtab-peinh.                                 
              wa_outtab-mfrpn = wa_mara-mfrpn.
              wa_outtab-mfrnr = wa_mara-mfrnr.
              SELECT SINGLE name1 FROM lfa1 INTO wa_outtab-name1 WHERE lifnr = wa_mara-mfrnr.
              APPEND wa_outtab TO i_outtab.
            ENDIF.
          ENDIF.
          REFRESH i_stpu.
          CLEAR i_stpu.
        ENDLOOP.    CLEAR: wa_matnr1, wa_mfrnr, wa_outtab.
      ENDLOOP.
    Edited by: srinivasareddy j on Mar 9, 2011 7:16 AM
    Edited by: srinivasareddy j on Mar 9, 2011 7:20 AM

  • Save Changed layout of ALV

    Hello All,
    I am using the class 'cl_salv_table' to create an ALV. In the application toolbar I have the option to change the layout displayed in tha ALV but I am not able to save my changed layout. Please suggest how do I enable the save layout button in the toolbar.
    Thanks,
    Anju

    This demo example creates a PF status for displaying the buttons, Can  I not get the buttons using the standard functions available with the ALV. I am getting the change layout on its own I am not reqd to create a PF status for it. Can I not enable the button save layout also. Also if I create the PF status I would have to add all the buttons reqd in the ALV in the PF status manually
    thanks,
    Anju

  • Create Change Layout in ALV list report

    Hi,
    i have create my own change layout button at my alv list report, my problem is i don't know what coding can be used to activate the change layout function in my own button. Who have sample programming for this function please share it....
    tq.

    Hi,
    By default if you're using the ALV List Display function module, there's no need for you to code the 'Change Layout' function, the standard function will be there, unless there's something you want and the standard 'Change Layout' function could not provide.
    Go to Abap Editor and look for program with 'BALV*'. You'll get a whole list of DEMO program on ALV.

  • Change Layout in ALV

    HI,
    In my alv report(developed using ABAP OO), i need to exclude few buttons .
    Here i need to exclude Change Layout button.
    Can anyone pls help whats the attribut for change layout icon.
    Like for Print we have MC_FC_PRINT?.  what will be for "Change Layout"?
    Pls help
    Thanks

    Hi,
    Check the constants in the public attributes of the class ..where you can find the focde for the change layout button..
    Thanks
    Naren

  • Sum Fields based on change in another field

    I have data that looks like this
    <Records>
    <VBLEN>123</VBLEN>
    <MATNR>012356</MATNR>
    <ZSPR>1.02</VBLEN>
    </Records>
    <Records>
    <VBLEN>123</VBLEN>
    <MATNR>568954</MATNR>
    <ZSPR>2.05</ZSPR>
    </Records>
    <Records>
    <VBLEN>856</VBLEN>
    <MATNR>259865</MATNR>
    <ZSPR>5.98</ZSPR>
    </Records>
    <Records>
    <VBLEN>856</VBLEN>
    <MATNR>359874</MATNR>
    <ZSPR>4.12</ZPSR>
    </Records>
    <Records>
    <VBLEN>856</VBLEN>
    <MATNR>985698</MATNR>
    <ZSPR>1.06</ZSPR>
    </Records>
    In my output, I have a field on every line that is a total. So My output needs to look like this.
    <Records>
    <VBLEN>123</VBLEN>
    <MATNR>012356<MATNR>
    <ZSPR_TOTAL>3.07</ZSPR_TOTAL>
    </Records>
    <Records>
    <VBELN>123</VBLEN>
    <MATNR>568954</MATNR>
    <ZSPR_TOTAL>3.07<ZSPR_TOTAL>
    </Records>
    <Records>
    <VBLEN>856</VBLEN>
    <MATNR>259865</MATNR>
    <ZSPR_TOTAL>11.16</ZPSR_TOTAL>
    </Records>
    <VBLEN>856</VBLEN>
    <MATNR>359874</MATNR>
    <ZSPR_TOTAL>11.16</ZSPR_TOTAL>
    </Records>
    <Records>
    <VBLEN>856</VBLEN>
    <MATNR985698</MATNR>
    <ZSPR_TOTAL>11.16</ZSPR_TOTAL>
    So I need the sum of ZSPR on each line, but it has to be the sum of ZSPR for each instance of VBLEN.

    Hi Dave,
    If you are using below graphical mapping logic , you have to apply some logic (shown below ) for remaining fields of output.
    For getting Total sum  value based on VBLEN :
    For arranging remaining fields of output xml :
    Note : ZSPR_TOTAL is mentioned as Total.
    Thanks
    Hari.

  • Compute total on a field based on change in values in 2 other fields

    I have the following requirement
    ITAB has fields 
    PO#     PO_LINE# ............  PRICE
    100              1                          500
    100               2                         100
    200               1                          300
    300               1                         200
    300               2                         700
    300               3                         100
    and my required output in ALV is
    PO#     PO_LINE# ............  PRICE
    100              1                          500
    100               2                         100
                                     Total        600
    200               1                          300
                                     Total        300
    300               1                         200
    300               2                         700
    300               3                         100
                                      Total      1000
    i want to compute the total price for each PO#.
    Can someone please suggest how ?
    Thank u so much.

    Hello Asha,
    It appears that you are looking for the subtotal functionality that is built into ALV. The "sort" table that is accepted by the ALV FM has a field named "subtot" that can be used to flag a field for subtotals. In your case you would flag the PO# field for subtotals.
    A bare bones example of entering this information can be seen in the following:
    " Fill out the field catalog, layout, etc.
    " Now we will populate the sort information
    ls_sort-fieldname = 'PONUMBER'.
    ls_sort-up = 'X'.
    ls_sort-subtot = 'X'. "This is the field that will allow subtotals
    APPEND ls_sort TO gt_sort.
    " Call the the display ALV FM
    Now this comes with a number of conditions:
    1. For simple cases, the field you want to subtotal over must be the left-most column. In your example it looks like you meet this requirement as PO# is the first column.
    2. You also need to make sure that there is a column that allows totals. In your example you need to make sure price has the proper data type to allow for totals.
    If you are still having trouble, I would recommend looking at the following code example: [Display subtotal text in ALV grid|http://wiki.sdn.sap.com/wiki/display/Snippets/DisplaysubtotaltextinALV+grid]. It contains a more complete example of how to use subtotals in ALV.

  • How do I use Javascript to populate a text field based on a selection from a drop down box?

    Greetings,
    I have virtually no experience with JavaScript and I am trying to figure out how to add some basic automation features to an Adobe form.  I have a drop down box called "Hospital_Name" that will contain approximately 7 possible selections.  When the user makes a selection, I would like to have the text field (called "Hospital_Address") below the drop down box populate with the corresponding address for the selection.  I have the "Hospital_Address" text field configured for multiple lines and would like the address to have a line break between the street address and the city/state/zip.
    For example, if the user selected "Hospital 1", the text field would display:
    123 Main St
    Anytown, CA 12345
    Any help or examples you can provide would be greatly appreciated.

    You have the element names within the object within brackets.
    Make sure your brackets are properly placed and matched.
    // Place all pre-population data into a single data structure
    var Location = {
    "--Hospital--":{ line1: " ", line2: " " },
    "Bellevue Medical Center":{ line1: "2500 BMC Drive", line2: "Bellevue, NE 68123" },
    "CHI Bergan Mercy":{ line1: "7500 Mercy Road", line2: "Omaha, NE 68124" }, 
    "CHI Immanuel":{ line1: "6901 N. 72nd Street", line2: "Omaha, NE 68122" }, 
    "CHI Lakeside":{ line1: "16901 Lakeside Hills Court", line2: "Omaha, NE 68130" }, 
    "CHI Midlands":{ line1: "11111 S. 84th Street", line2: "Papillion, NE 68046" },
    "Creighton University Medical Center":{ line1: "601 N. 30th Street", line2: "Omaha, NE 68131" },
    "Nebraska Medical Center":{ line1: "4400 Emile Drive", line2: "Omaha, NE 68105" }
    // some debugging code to see location names;
    console.show();console.clear():
    for(I in Location) {
    console.println(I);
    // end debugging code;
    function SetFieldValues(Hospital_Name) {
        this.getField("AddLine1").value = Location[Hospital_Name].line1;
        this.getField("AddLine2").value = Location[Hospital_Name].line2;
    This is not a beginners task but requires a fair amount of knowledge about the structure of objects, defining strings, and structure of arrays.
    Are you sure you have all the field names correctly spelled and capitalized?
    Do you get any error in the JavaScript console?
    Just trying the line that defines the "Location", I get the following error:
    SyntaxError: invalid property id
    1:Console:Exec
    undefined
    All the form field in a PDF are processed by using JavaScript and any error in any script will stop JavaScript processing.
    It might help to have a link to the problem form.
    Make sure your brackets are properly placed and matched.
    // Place all pre-population data into a single data structure
    var Location = {
    "--Hospital--":{ line1: " ", line2: " " },
    "Bellevue Medical Center":{ line1: "2500 BMC Drive", line2: "Bellevue, NE 68123" },
    "CHI Bergan Mercy":{ line1: "7500 Mercy Road", line2: "Omaha, NE 68124" }, 
    "CHI Immanuel":{ line1: "6901 N. 72nd Street", line2: "Omaha, NE 68122" }, 
    "CHI Lakeside":{ line1: "16901 Lakeside Hills Court", line2: "Omaha, NE 68130" }, 
    "CHI Midlands":{ line1: "11111 S. 84th Street", line2: "Papillion, NE 68046" },
    "Creighton University Medical Center":{ line1: "601 N. 30th Street", line2: "Omaha, NE 68131" },
    "Nebraska Medical Center":{ line1: "4400 Emile Drive", line2: "Omaha, NE 68105" }
    function SetFieldValues(Hospital_Name) {
        this.getField("AddLine1").value = Location[Hospital_Name].line1;
        this.getField("AddLine2").value = Location[Hospital_Name].line2;

  • Disable fields based on value selected from first list box.

    Hi All,
    I am facing a problem in module pool programing. My scenario is there will be around 50 fields in the screen  , within that first field is a drop down list box. In the list box there will be electricuty , gas and csw. If user select gas then the fields corresponding to gas will only be editable other fields not relevent to gas will be non editable(Disable).... Same case for electriciy andcsw also.
    Can any one guide me regarding this....
    Thanks in advance.
    Regards
    Ajoy

    Hi Asaha,
    This link will be of great help for you if you are new to Module pool.
    [Module Pool Notes|http://wiki.sdn.sap.com/wiki/display/Snippets/ModulePoolNotes]
    For [DYNP_VALUES_READ|http://wiki.sdn.sap.com/wiki/display/ABAP/FilteringF4HelpvaluesinTablecontrol,basedonotherfield+value] refer this link.
    For [DYNP_VALUE_UPDATE|http://wiki.sdn.sap.com/wiki/display/ABAP/GettingainputfieldpopulatedonenteringthevalueinoneInputfield]
    Regards
    Abhii

  • Changing layout of ALV to excel

    Hello,
    I am developing an ALV report.
    I want my data in the excel format, and not in the standard ALV format.
    Is there any method to do so?
    I have used the CL_GUI_ALV_GRID class, and I found out a method:-
    Maintain_Variant.
    Also ,there is an attirbute:- MMC_FC_VIEW_EXCEL.
    But I am unable to implement them in my program.
    Kindly help me.
    Points assured for helpful answers.
    Thanks and regards,
    Prerna

    Hi Prerna,
    Good .. Check out the example code - Important
    <b>Multi-colored output of ALV in EXCEL
    There would be many situations where we need to highlight some of the records in bold or different color depending on some value. In this document, we showcase how this can be achieved. Look at the screenshot of an excel sheet with different colors and bold in some cells.
    Following is a demo program in achieving the same:
    Report ZMULTICOLOR_TEST no standard page heading.
    this report demonstrates how to send some ABAP data to an
    EXCEL sheet using OLE automation.
    include ole2incl.
    handles for OLE objects
    data: h_excel type ole2_object,        " Excel object
          h_mapl type ole2_object,         " list of workbooks
          h_map type ole2_object,          " workbook
          h_zl type ole2_object,           " cell
          h_f type ole2_object,            " font
          h_c type ole2_object.            " color
    DATA: FILENAME LIKE RLGRAP-FILENAME.
    tables: spfli.
    data  h type i.
    table of flights
    data: it_spfli like spfli occurs 10 with header line.
    *&   Event START-OF-SELECTION
    start-of-selection.
    read flights
      select * from spfli into table it_spfli.
    display header
      uline (61).
      write: /     sy-vline no-gap,
              (3)  'Flg'(001) color col_heading no-gap, sy-vline no-gap,
              (4)  'Nr'(002) color col_heading no-gap, sy-vline no-gap,
              (20) 'Von'(003) color col_heading no-gap, sy-vline no-gap,
              (20) 'Nach'(004) color col_heading no-gap, sy-vline no-gap,
              (8)  'Zeit'(005) color col_heading no-gap, sy-vline no-gap.
      uline /(61).
    display flights
      loop at it_spfli.
        write: / sy-vline no-gap,
                 it_spfli-carrid color col_key no-gap, sy-vline no-gap,
                 it_spfli-connid color col_normal no-gap, sy-vline no-gap,
                 it_spfli-cityfrom color col_normal no-gap, sy-vline no-gap,
                 it_spfli-cityto color col_normal no-gap, sy-vline no-gap,
                 it_spfli-deptime color col_normal no-gap, sy-vline no-gap.
      endloop.
      uline /(61).
    tell user what is going on
      call function 'SAPGUI_PROGRESS_INDICATOR'
         exporting
              PERCENTAGE = 0
               text       = text-007
           exceptions
                others     = 1.
    start Excel
      create object h_excel 'EXCEL.APPLICATION'.
    PERFORM ERR_HDL.
      set property of h_excel  'Visible' = 1.
    CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'  .
    PERFORM ERR_HDL.
    tell user what is going on
      call function 'SAPGUI_PROGRESS_INDICATOR'
         exporting
              PERCENTAGE = 0
               text       = text-008
           exceptions
                others     = 1.
    get list of workbooks, initially empty
      call method of h_excel 'Workbooks' = h_mapl.
      perform err_hdl.
    add a new workbook
      call method of h_mapl 'Add' = h_map.
      perform err_hdl.
    tell user what is going on
      call function 'SAPGUI_PROGRESS_INDICATOR'
         exporting
              PERCENTAGE = 0
               text       = text-009
           exceptions
                others     = 1.
    output column headings to active Excel sheet
      perform fill_cell using 1 1 1 200 'Carrier id'(001).
      perform fill_cell using 1 2 1 200 'Connection id'(002).
      perform fill_cell using 1 3 1 200 'City from'(003).
      perform fill_cell using 1 4 1 200 'City to'(004).
      perform fill_cell using 1 5 1 200 'Dep. Time'(005).
      loop at it_spfli.
    copy flights to active EXCEL sheet
        h = sy-tabix + 1.
        if it_spfli-carrid cs 'AA'.
          perform fill_cell using h 1 0 000255000 it_spfli-carrid.
        elseif it_spfli-carrid cs 'AZ'.
          perform fill_cell using h 1 0 168000000 it_spfli-carrid.
        elseif it_spfli-carrid cs 'JL'.
          perform fill_cell using h 1 0 168168000 it_spfli-carrid.
        elseif it_spfli-carrid cs 'LH'.
          perform fill_cell using h 1 0 111111111 it_spfli-carrid.
        elseif it_spfli-carrid cs 'SQ'.
          perform fill_cell using h 1 0 100100100 it_spfli-carrid.
        else.
          perform fill_cell using h 1 0 000145000 it_spfli-carrid.
        endif.
        if it_spfli-connid lt 400.
          perform fill_cell using h 2 0 255000255 it_spfli-connid.
        elseif it_spfli-connid lt 800.
          perform fill_cell using h 2 0 077099088 it_spfli-connid.
        else.
          perform fill_cell using h 2 0 246156138 it_spfli-connid.
        endif.
        if it_spfli-cityfrom cp 'S*'.
          perform fill_cell using h 3 0 155155155 it_spfli-cityfrom.
        elseif it_spfli-cityfrom cp 'N*'.
          perform fill_cell using h 3 0 189111222 it_spfli-cityfrom.
        else.
          perform fill_cell using h 3 0 111230222 it_spfli-cityfrom.
        endif.
        if it_spfli-cityto cp 'S*'.
          perform fill_cell using h 4 0 200200200 it_spfli-cityto.
        elseif it_spfli-cityto cp 'N*'.
          perform fill_cell using h 4 0 000111222 it_spfli-cityto.
        else.
          perform fill_cell using h 4 0 130230230 it_spfli-cityto.
        endif.
        if it_spfli-deptime lt '020000'.
          perform fill_cell using h 5 0 145145145 it_spfli-deptime.
        elseif it_spfli-deptime lt '120000' .
          perform fill_cell using h 5 0 015215205 it_spfli-deptime.
        elseif it_spfli-deptime lt '180000' .
          perform fill_cell using h 5 0 000215205 it_spfli-deptime.
        else.
          perform fill_cell using h 5 0 115115105 it_spfli-deptime.
        endif.
      endloop.
    EXCEL FILENAME
      CONCATENATE SY-REPID '_' SY-DATUM6(2) '_' SY-DATUM4(2) '_'
                  SY-DATUM(4) '_' SY-UZEIT '.XLS' INTO FILENAME.
      CALL METHOD OF H_MAP 'SAVEAS' EXPORTING #1 = FILENAME.
      free object h_excel.
      perform err_hdl.
          FORM FILL_CELL                                                *
          sets cell at coordinates i,j to value val boldtype bold       *
    form fill_cell using i j bold col val.
      call method of h_excel 'Cells' = h_zl
        exporting
          #1 = i
          #2 = j.
      perform err_hdl.
      set property of h_zl 'Value' = val .
      perform err_hdl.
      get property of h_zl 'Font' = h_f.
      perform err_hdl.
      set property of h_f 'Bold' = bold .
      perform err_hdl.
      set property of h_f 'Color' = col.
      perform err_hdl.
    endform.                    "FILL_CELL
    *&      Form  ERR_HDL
          outputs OLE error if any                                       *
    -->  p1        text
    <--  p2        text
    form err_hdl.
      if sy-subrc <> 0.
        write: / 'OLE-Automation Error:'(010), sy-subrc.
        stop.
      endif.
    endform.                    " ERR_HDL</b>
    Good Luck and thanks
    AK

Maybe you are looking for

  • Cant get Security Mode to work on WRT54G

    I have everything set up fine.. internet working etc but I cannot get security mode to work.. I go to click on WEP, WPA.. whatever and it just autos back to DISABLED.. Anyone to fix this?

  • This computer is not authorized to play or burn...

    I just installed Windows XP in my computer and I downloaded music from Apple store. When I try to sync my iPod, it says that I am not authorized to play the music. I can't even seem to burn it into a CD. Does anybody know what I need to do? Thanks.

  • Can i airplay to apple tv3 from my iphone4?

    I am thinking buying an apple tv, but I just wandering if it can airplay from my Iphone4 (seems all the website on apple are using ipad or 4s as airplay example). anyone can help out a little here?

  • Errors on upgrade

    hi! I've got some troubles on updating my system... I can't understand the matter and I really have no time to try to understand what's going on.. so I post the error message hopefull  someone can help me! Thanks! Ah.. I've italian pacman... if you g

  • CF admin not accessible now..

    Hello, I am using CFMX 9 and while playing with the settings in Sandbox Security now I cannot get access to CF Admin. I get the following error: Security: The requested template has been denied access to createobject. Please help....it's urgent