Output Decimals

I am displaying the data in ALV format, for displaying the iam using the gs-fieldcatalog-cfieldname,  but for one currency it has zero decimals and the data in bseg-RDIF2 is 40.50, but due to the cfieldname it is displaying as 4050. But I need this to be displayed as 40.50 only, I need to use cfieldname also.
Please let me know is there any other solution for this?
Is there any calculations to be done to achieve this?
Thanks,
Pavan

hi,
Customize field catalog,
when 'NETWR'.
  field_cat-edit_mask = '____.__'.
  endif.
  It sets two decimals for the value you passed.
Regards,
Sailaja.

Similar Messages

  • Reducing decimals 3 to 2

    Friends,
    I am strugling with this issue. Need to reduce output decimals from 3 to 2 for field VBDKA-NTGEW. Appreciate if i can get some help or suggestion on this please.
    I tried this but no luck &VBDKA-NTGEW(.2)&.
    Thank you,
    Bobby

    try
    &VBDKA-NTGEW(C7.2)&
    or use decimals 2. in your code

  • Require editable quantity value without Decimals in ALV display

    I'm displaying  the ALV with quantity in editable mode where the end user gives the quantity value.I need to restrict the user to give the value as a whole  number i.e without decimals. How can we do it in ALV. I tried the same by giving the field as type 'N' but still, i can give the value  with decimals. It is showing an error since this being an interactive ALV, on clicking the button,the proceess is taking value. Would you guide me
    Thanks
    Ravindra

    Hi,
    In the fieldcatalog you should have a field decimals_out, you can set the output decimals there, try setting it in 0.
    Hope it helps.

  • Conversion exit: numbers in database, two decimals on screen

    Hi,
    I need to save a numeric value in database containing only numbers. At the same time I need to display the value on a screen with two decimals. For example, the value of "12" should be saved in database as "1200", and it should be displayed on a screen like "12,00" (or "12.00", depending on user decimal settings). Furthermore, when user enters either a value of "12" or "12,00" on the screen and press enter, the program should display the value as "12,00" in both cases.
    Therefore, I created a domain and added a conversion routine to it. This routine performs the conversion from display format to internal format and vice versa.
    However, after trying with several options with MOVE and WRITE input TO output DECIMALS 2 statements and with different data types with different decimals places, I haven't been able to do this conversion.
    I am a bit frustrated, since this task is rather simple. Is there a standard function module doing this conversion? What is the best and most efficient way to do this conversion?
    I have also find the following standard function modules:
    - CONVERSION_EXIT_QUANT_INPUT and CONVERSION_EXIT_QUANT_OUTPUT
    - CONVERSION_EXIT_DEC_3_INPUT and CONVERSION_EXIT_DEC_3_OUTPUT
    Regards,
    Jarmo Tuominen

    Hi Jarmo,
    1. I don't whether i understood ur query properly!
    2. U said u used a conversion routine in domain.
    3. U can use the same routine(xxxxxx)
        (Say xxxxx is the name of conversion routine
         u specified in the domain)
         Now u can use the Function Module
         CONVERSION_EXIT_xxxxx_INPUT 
         CONVERSION_EXIT_xxxxx_OUTPUT
       in your programs for WRITE Purpose.
    I hope it helps.
    Regards,
    Amit M.
    Message was edited by: Amit Mittal

  • Please help finding pre-exsisting methods

    please help find pre-existing methods
    JavaFirstTime Jan 2, 2005 3:21 PM
    please help clever people :)
    how to output decimals in 2 decimal places only?
    how to output large integers using format: 12,376,452
    I've been told there are pre-existing methods for that, but i just can't find it... ideally i need to know the source code...

    Well, there's many ways to do it ... Here's one:
    class NumberFormatDemo {
    public static void main(String[] args) {
    new NumberFormatDemo().go();
    public void go() {
    double decimal = 123.456;
    System.out.println((int) decimal + "." + (int)
    + (int) (decimal * 100 + 0.5) % 100);
    int largeInteger = 12376452;
    System.out.println(recursive(largeInteger));
    public String recursive(int largeInteger) {
    if (largeInteger > 999) {
    return recursive(largeInteger/1000) + ","
    1000) + "," + largeInteger%1000;
    } else {
    return "" + largeInteger;
    yes, that's exactly wot i need...
    how didn't i think of that myself, using mathematics, i was thinking it would be more complicated like converting decimals to string then count letters and so on.
    Thank you for putting me on the right track :)

  • I would like to know about conversion exits.

    i would like to know about conversion exits.

    Hi,
    Under Domain of a data element of a field, Output Characterestics field 'Convers. routine' is used to create conversion routines, system will do the data changes with in these routines while storing the data into table and retriving the data from table.
    Ex: if coversion routine is defined as 'ALPHA' for a standard domain , with this value system will create two function modules.
    CONVERSION_EXIT_ALPHA_INPUT
    CONVERSION_EXIT_ALPHA_OUTPUT
    you can also create your own conversion routines by defining the value in this field. i have defined conversion routine to convert NUMC type data to DEC type data with 'ZCNV'.system will generate two FM's. you need to write the code in those FM's according to your logic.
    see the code for this :
    CONVERSION_EXIT_ZCNV_INPUT
    FUNCTION CONVERSION_EXIT_ZCNV_INPUT.
    ""Local interface:
    *" IMPORTING
    *" VALUE(INPUT)
    *" EXPORTING
    *" VALUE(OUTPUT)
    DATA : ws_output type numc10.
    ws_output = input.
    output = ws_output.
    ENDFUNCTION.
    CONVERSION_EXIT_ZCNV_OUTPUT
    FUNCTION CONVERSION_EXIT_ZCNV_OUTPUT.
    ""Local interface:
    *" IMPORTING
    *" REFERENCE(INPUT)
    *" EXPORTING
    *" REFERENCE(OUTPUT)
    data : ws_value type dec12.
    ws_value = input.
    WRITE: ws_value TO output DECIMALS 0.
    ENDFUNCTION.
    Thanks & Regards,
       Sunil

  • How to avoid to print decimals in the output

    Hi,
    Please suggest me how to avoid getting decimals in the output.
    The variable that i am using is RKMNG. While declaring it i have used it in this manner,  rkmng type p decimals 0.
    but this only avoids fetching the data with decimals, when i am trying to print this value to the output using ALV FM, the decimals are appearing.
    Please can u provide me how to remove these three decimals that are appearing in the output.
    Thanks,

    do this :
    data : lv_var like i.
    move rkmng to lv_var.
    print lv_var.

  • Formatting the output (currency with decimals)

    hi all,
          i want to format the output of the currency field. Right now it displays the exact value like say 23 or 43.5 etc. But my requirement is i need it to display in a standard format as 23.00 , 43.50 , 565.00 etc. i,e if there is no decimals then it should be filled with zero's.
    I have gone through some of the threads which speaks of formatting the output if it is a value node. But here i have directly bounded the table to a model node.
    Domian level datatype of the field is Currency in R/3. After model import in dictionary it is showing as decimal.
    How can i achieve this?I Appreciate if someone can help me on this.
    Regards,
    G Nid

    hi,
    Go thru this link it might helps you.
    column heading -refer to the webdynpro tutorial 34
    Change the currency data type char and specify the length.
    Thanks,
    Lohi.

  • JPY Currency decimals in SQ01 output

    Hi Sap Gurus,
    My SQ01 query output has JPY values with decimals.  In normal report, we can get appropriate values thru function module BAPI_CURRENCY_CONV_TO_EXTERNAL.  But how to achieve this result in ABAP Query?
    Thanks in advance...
    Best regards,
    Madhu

    I've introduced an additional field and added code as below
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
          EXPORTING
            currency        = bkpf-HWAER
            amount_internal = faglflexa-hsl
          IMPORTING
            AMOUNT_EXTERNAL = zhsl.
    It worked.

  • Need output with commas and decimals.

    Hi All,
               I want to print this below no using write statement with commas and decimals .
                                            123,45,67,890.12
    Note :
              It must be declared in parameters and it is currency value
    and my output must also be like this
      123,45,67,890.12
    Can any one suggest me what to or send me some sample program for this,
    (points will be rewarded)
    Thanking you
    vinoth.r

    quote:
    Originally posted by:
    The ScareCrow
    You should redesign your db to have another table
    This table should have the asset id and the category id (I
    call this a bridging table)
    The category column would then be removed from the asset
    table.
    You then do a join on the tables to gain the category
    description.
    But to fix your problem with the existing structure
    Your query
    <cfquery name="qIndex" datasource="#appDSN#">
    SELECT Asset.Reference, Asset.AssetName, Asset.Category
    FROM Asset
    WHERE Category LIKE '%#URL.Category#%'
    </cfquery>
    <cfoutput query="qIndex">
    <cfset catids = ValueList(qIndex.category])>
    <cfquery name="qCat" datasource="#appDSN#">
    Select Category_Name
    From categories
    Where Category_ID IN (#catids#)
    </cfquery>
    #qIndex.Reference#<br />
    #qIndex.AssetName#<br />
    <cfloop query="qCat">
    #qCat.Category#<br>
    </cfloop>
    </cfoutput>
    Ken
    Ken, Thanks. It's really close, but all of the repeating
    records are taking the Category output from the first record in the
    set and repeating it...e.g. if the first record is "Mouse,
    Keyboards, Trackballs", all of the subsequent records show the
    same.
    Also should "ValueList(qIndex.category])", have been
    "ValueList(qIndex.category)"?
    If there's not a way to do this using the current db, i'll
    try using a bridging table.
    thanks.
    paul

  • Report Not able to generate values in output

    hi gurus,
    i am not able to get the output for this report,pls help me in correcting the code and suggest me a sloution.Urgent...............
    *& Report  ZRPP006
    *&  Modification History
    *& Change # | By     | Date     | Purpose of Change
    *& C0001 |pradeep.R  | 20070629 | Total component request for sop&Copa
    *&       |           |          |
    *&       |           |          |
    report  zrpp006 line-size 180 line-count 90
            no standard page heading.
    Class
    *class cl_gui_column_tree definition load.
    *class cl_gui_cfw definition load.
    *data tree1  type ref to cl_gui_alv_tree.
    *data mr_toolbar type ref to cl_gui_toolbar.
    Include
    *include <icon>.
    *include bcalv_toolbar_event_receiver.
    *include bcalv_tree_event_receiver.
    include zipp007.
    selection screen
    selection-screen begin of block selscrb with frame title text-s01.
    parameters: ra_SOP radiobutton group GRP default 'X',
                ra_COPA radiobutton group GRP.
    selection-screen end of block selscrb.
    Data:pa_m_frm(6) type c,
         pa_m_to(6) type c,
         pa_y_frm(4) type c,
         pa_y_to(4) type c,
         ra_mth,
         ra_yea,
         l_mode.
    *parameter: pa_m_frm(6) type c,
              pa_m_to(6) type c,
              pa_y_frm(4) type c,
              pa_y_to(4) type c..
    data: so_matnr,
          so_matkl,
          pa_stprs,
          pa_werks ,
          pa_vrsio .
    selection-screen skip 1.
    initialization.
      clear: ta_vrsio, ta_type.
      refresh: ta_vrsio, ta_type.
    *at selection-screen on value-request for pa_vrsio.
    call function 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
         retfield    = 'VRSIO'
         dynprofield = 'PA_VRSIO'
         dynpprog    = sy-cprog
         dynpnr      = sy-dynnr
         value_org   = 'S'
       TABLES
         value_tab   = ta_vrsio.
    Start-of-selection.
    if ra_SOP eq 'X'.
        submit ZRPP023 via selection-screen and return.
      elseif ra_COPA eq 'X'.
        submit ZRPP026 via selection-screen and return..
      endif.
    select * into corresponding fields of table ta_vrsio
      from p44v
      where gstru = 'S076'.
      sort ta_vrsio by vrsio.
      delete adjacent duplicates from ta_vrsio.
      move 'MONTH' to ta_type-out_type.
      append ta_type.
      move 'YEAR' to ta_type-out_type.
      append ta_type.
    at selection-screen output.
      if ra_mth = 'X'.
        loop at screen.
          if screen-name = 'PA_M_FRM'.
            screen-active = '1'.
            modify screen.
          endif.
          if screen-name = '%C001007_1000'.
            screen-active = '1'.
            modify screen.
          endif.
          if screen-name = '%C002009_1000'.
            screen-active = '1'.
            modify screen.
          endif.
          if screen-name = 'PA_M_TO'.
            screen-active = '1'.
            modify screen.
          endif.
          if screen-name = '%C003012_1000'.
            screen-active = '1'.
            modify screen.
          endif.
          if screen-name = '%C004014_1000'.
            screen-active = '1'.
            modify screen.
          endif.
          if screen-name = 'PA_Y_FRM'.
            screen-active = '0'.
            modify screen.
          endif.
          if screen-name = '%C005017_1000'.
            screen-active = '0'.
            modify screen.
          endif.
          if screen-name = '%C006019_1000'.
            screen-active = '0'.
            modify screen.
          endif.
          if screen-name = 'PA_Y_TO'.
            screen-active = '0'.
            modify screen.
          endif.
          if screen-name = '%C007022_1000'.
            screen-active = '0'.
            modify screen.
          endif.
          if screen-name = '%C008024_1000'.
            screen-active = '0'.
            modify screen.
          endif.
        endloop.
      elseif ra_yea = 'X'.
        loop at screen.
          if screen-name = 'PA_M_FRM'.
            screen-active = '0'.
            modify screen.
          endif.
          if screen-name = '%C001007_1000'.
            screen-active = '0'.
            modify screen.
          endif.
          if screen-name = '%C002009_1000'.
            screen-active = '0'.
            modify screen.
          endif.
          if screen-name = 'PA_M_TO'.
            screen-active = '0'.
            modify screen.
          endif.
          if screen-name = '%C003012_1000'.
            screen-active = '0'.
            modify screen.
          endif.
          if screen-name = '%C004014_1000'.
            screen-active = '0'.
            modify screen.
          endif.
          if screen-name = 'PA_Y_FRM'.
            screen-active = '1'.
            modify screen.
          endif.
          if screen-name = '%C005017_1000'.
            screen-active = '1'.
            modify screen.
          endif.
          if screen-name = '%C006019_1000'.
            screen-active = '1'.
            modify screen.
          endif.
          if screen-name = 'PA_Y_TO'.
            screen-active = '1'.
            modify screen.
          endif.
          if screen-name = '%C007022_1000'.
            screen-active = '1'.
            modify screen.
          endif.
          if screen-name = '%C008024_1000'.
            screen-active = '1'.
            modify screen.
          endif.
        endloop.
      endif.
    End-of-selection.
      perform get_header_data.
      perform get_top_page.
    *&      Form  display_alv
          text
    form display_alv.
    ALV ***
      g_repid = sy-repid.
      perform layout_init using gs_layout.
      perform eventtab_build using gt_events[].
      gs_variant-report = g_repid.
      g_save           = 'A'.
    perform comment_build using gt_list_top_of_page[].
    Display monthly report
      if ra_mth = 'X' and
         pa_m_frm <> 0 and
          pa_m_to <> 0.
        perform fieldcat_init_mth using gt_fieldcat[].
        perform printer_setting using print_set.
        call function 'REUSE_ALV_GRID_DISPLAY'
          exporting
               i_background_id    = 'ALV_BACKGROUND'
               i_buffer_active    = 'X'
               i_callback_program = g_repid
               i_structure_name   = 'ITAB_MSALE'
               is_layout          = gs_layout
               it_fieldcat        = gt_fieldcat[]
               i_save             = g_save
               is_variant         = gs_variant
               it_events          = gt_events[]
               it_sort            = gt_it_sort[]
               is_print           = print_set
         I_SCREEN_START_COLUMN    = 0     "Use coordinates for
         I_SCREEN_START_LINE      = 0     "display as dialog box
         I_SCREEN_END_COLUMN      = 0
         I_SCREEN_END_LINE        = 0
          importing
               e_exit_caused_by_caller = g_exit_caused_by_caller
               es_exit_caused_by_user  = gs_exit_caused_by_user
          tables
               t_outtab = itab_msale
          exceptions
               program_error = 1
               others        = 2.
        if sy-subrc = 0.
          if g_exit_caused_by_caller = 'X'.
    *"  Forced Exit by calling program
    *"  <do_something>.
          else.
    *"  User left list via F3, F12 or F15
            if gs_exit_caused_by_user-back = 'X'.       "F3
    *"    <do_something>.
            else.
              if gs_exit_caused_by_user-exit = 'X'.     "F15
    *"      <do_something>.
              else.
                if gs_exit_caused_by_user-cancel = 'X'. "F12
    *"        <do_something>.
                else.
    *"        should not occur!
    *"        <do_Abnormal_End>.
                endif.
              endif.
            endif.
          endif.
        else.
    "Fatal error callin ALVAXXX(XY) WITH ...
        endif.
    Display yearly report
      elseif ra_yea = 'X' and
              pa_y_frm <> 0 and
              pa_y_to <> 0.
        perform fieldcat_init_yr using gt_fieldcat[].
        perform printer_setting using print_set.
        call function 'REUSE_ALV_GRID_DISPLAY'
          exporting
               i_background_id    = 'ALV_BACKGROUND'
               i_buffer_active    = 'X'
               i_callback_program = g_repid
               i_structure_name   = 'ITAB_YSALE'
               is_layout          = gs_layout
               it_fieldcat        = gt_fieldcat[]
               i_save             = g_save
               is_variant         = gs_variant
               it_events          = gt_events[]
               it_sort            = gt_it_sort[]
               is_print           = print_set
         I_SCREEN_START_COLUMN    = 0     "Use coordinates for
         I_SCREEN_START_LINE      = 0     "display as dialog box
         I_SCREEN_END_COLUMN      = 0
         I_SCREEN_END_LINE        = 0
          importing
               e_exit_caused_by_caller = g_exit_caused_by_caller
               es_exit_caused_by_user  = gs_exit_caused_by_user
          tables
               t_outtab = itab_ysale
          exceptions
               program_error = 1
               others        = 2.
        if sy-subrc = 0.
          if g_exit_caused_by_caller = 'X'.
    *"  Forced Exit by calling program
    *"  <do_something>.
          else.
    *"  User left list via F3, F12 or F15
            if gs_exit_caused_by_user-back = 'X'.       "F3
    *"    <do_something>.
            else.
              if gs_exit_caused_by_user-exit = 'X'.     "F15
    *"      <do_something>.
              else.
                if gs_exit_caused_by_user-cancel = 'X'. "F12
    *"        <do_something>.
                else.
    *"        should not occur!
    *"        <do_Abnormal_End>.
                endif.
              endif.
            endif.
          endif.
        else.
    *"Fatal error callin ALV
    MESSAGE AXXX(XY) WITH ...
        endif.
      else.
      endif.
    endform.                    "display_alv
    *&      Form  get_top_page
          text
    form get_top_page.
      move 'Total Component Requirement by Sales Forecast' to
      gt_list_top_of_page-info.
      gt_list_top_of_page-typ = 'H'.
      append gt_list_top_of_page.
      concatenate 'Plant   :' pa_werks
      into gt_list_top_of_page-info separated by space.
      gt_list_top_of_page-typ = 'S'.
      append gt_list_top_of_page.
      select single vetxt into tp_vetxt
      from p44v
      where gstru = 'S076'
      and vrsio = pa_vrsio.
      concatenate 'Version :' pa_vrsio tp_vetxt
      into gt_list_top_of_page-info separated by space.
      gt_list_top_of_page-typ = 'S'.
      append gt_list_top_of_page.
      call function 'DATUMSAUFBEREITUNG'
        EXPORTING
          idate           = sy-datum
        IMPORTING
          tdat8           = l_date_string
        EXCEPTIONS
          datfm_ungueltig = 1
          datum_ungueltig = 2
          others          = 3.
      concatenate sy-uzeit(2) ':' sy-uzeit2(2) ':' sy-uzeit4(2)
      into l_time.
      concatenate 'Date/Time :' l_date_string l_time
      into gt_list_top_of_page-info separated by space.
      gt_list_top_of_page-typ = 'S'.
      append gt_list_top_of_page.
    endform.                    "get_top_page
    *&      Form  get_header_data
          text
    -->  p1        text
    <--  p2        text
    form get_header_data.
      select pmnux into ta_mat-matnr
       from s076
        where pmnux = so_matnr
        and wenux = pa_werks
        and vrsio = pa_vrsio.
        append ta_mat.
        clear ta_mat.
      endselect.
      if sy-subrc = 0.
        sort ta_mat by matnr .
        delete adjacent duplicates from ta_mat.
        loop at ta_mat.
          select matnr stlnr stlan stlal
           appending corresponding fields of table ta_mat2
           from mast
           where matnr = ta_mat-matnr
                 and werks = pa_werks.
        endloop.
        loop at ta_mat2 into wa_ta_mat.
          select stlst bmeng bmein into (tp_stlst,tp_bmeng,tp_bmein)
           from stko where stlnr = wa_ta_mat-stlnr
             and stlal = wa_ta_mat-stlal.
            wa_ta_mat-stlst = tp_stlst.
            wa_ta_mat-bmeng = tp_bmeng.
            wa_ta_mat-bmein = tp_bmein.
            append wa_ta_mat to ta_header.
          endselect.
        endloop.
        perform checking.        "checking if monthly or yearly report is being selected
      else.
        message i003(zwpp001).
      endif.
    endform.                    " get_header_data
    *&      Form  checking
          text
    form checking.
      data : date1 like vtbbewe-dbervon,
             date2 like vtbbewe-dberbis.
      data : emonths like vtbbewe-atage.
      data : lv_m_frm(6) type n,
             lv_m_to(6) type n,
             lv_y_frm(4) type n,
             lv_y_to(4) type n.
    check if the Display monthly report is being selected *****
      if ra_mth = 'X' and
           pa_m_frm <> 0 and
           pa_m_to <> 0.
    check for correct input format
        lv_m_frm = pa_m_frm.
        lv_m_to = pa_m_to.
        if lv_m_frm ge '200000' and lv_m_to ge '200000'.
    calculate the months in between
          clear date1.
          clear date2.
          concatenate pa_m_frm '01' into date1.
          concatenate pa_m_to '01' into date2.
        concatenate pa_m_to '31' into date2.
          perform months_calculate using date1 date2 changing emonths.
       check if months <= 36.
          if emonths <= 36.
            perform get_sales.
            perform retrieve_bom.
          else.
            message i000(zwpp001).
            exit.                            " error message
          endif.
        else.
          message i002(zwpp001).
        endif.
    check if the Display yearly report is being selected *****
      elseif ra_yea = 'X' and
             pa_y_frm <> 0 and
             pa_y_to <> 0.
        itab_bom-requantity = lp_s076-absat.    "for current year 2006 ."added by pradeep on 4/07/07
        itab_bom-requantity = lp_s076-absat + 1.                "ie 2007.
        itab_bom-requantity = lp_s076-absat + 2.                "ie 2008.
    check for correct input format
        lv_y_frm = pa_y_frm.
        lv_y_to = pa_y_to.
        if lv_y_frm ge '2000' and lv_y_to ge '2000'.
    calculate the months in between
          clear date1.
          clear date2.
          concatenate pa_y_frm '0101' into date1.
          concatenate pa_y_to '1201' into date2.
        concatenate pa_y_to '1231' into date2.
          perform months_calculate using date1 date2 changing emonths.
       check if months <= 36.
          if emonths <= 36.
            perform get_sales.
            perform retrieve_bom.
          else.
            message i001(zwpp001).
            exit.                            " error message
          endif.
        else.
          message i002(zwpp001).
        endif.
      else.
        exit.
      endif.
    added by pradeep on 04/07/07
    if emonths = 4.
       itab_bom-requantity = lp_s076-absat * itab_bom-comp_qty / itab_bom-xmeng.
    endif.
    if emonths = 5.
       tp_totalprice = lp_s076-absat * ta_mat-stprs.
    endif.
    if emonths = 6.
       itab_bom-requantity = lp_s076-absat * itab_bom-comp_qty / itab_bom-xmeng.
    endif.
    if emonths = 7.
       tp_totalprice = lp_s076-absat * ta_mat-stprs.
    endif.
    if emonths = 8.
       itab_bom-requantity = lp_s076-absat * itab_bom-comp_qty / itab_bom-xmeng.
    endif.
    endform.                     " checking
    *&      Form  get_sales
          text
    form get_sales.
      data: iseq type i,
            tp_sales type p decimals 2,
            tp_totalprice type p decimals 2,"added by pradeep on 03/07/07
            tp_maktx like makt-maktx,
            tp_tabix like sy-tabix,
            tp_pmnux like s076-pmnux,
            seq type i.
      data: yr_frm(6) type c,
            yr_to(6) type c.
      data: year_frm(4) type c,
            year_to(4) type c.
      data: month1(2) type c,
            month12(4) type c.
      data: totalsales like zspp003-mth1.
      data: yr_index like sy-subrc.
    check if the Display monthly report is being selected *****
      if ra_mth = 'X' and
          pa_m_frm <> 0 and
          pa_m_to <> 0.
    retrieve months
        perform get_months.
        select * into corresponding fields of table lp_s076 from s076
                                       where pmnux = so_matnr
                                       and wenux = pa_werks
                                       and vrsio = pa_vrsio
                                       and spmon ge pa_m_frm
                                       and spmon le pa_m_to.
        iseq = 1.
        seq = 0.
        loop at lp_s076.
          if sy-tabix = 1.
            write : lp_s076-pmnux to tp_pmnux.
          endif.
          select single maktx into tp_maktx from makt
                      where matnr = lp_s076-pmnux.
          clear wa.
          read table ta_s076 into wa with key
          matnr = lp_s076-pmnux.
          if sy-subrc ne 0.
            wa-seq   = iseq.
            wa-matnr = lp_s076-pmnux.
            wa-maktx = tp_maktx.
          endif.
          move lp_s076-absat to tp_sales.
          case lp_s076-spmon.
            when t_mth1.
              move tp_sales to wa-mth1.
              move t_mth1 to wa-sp1.
              ind1 = '1'.
            when t_mth2.
              move tp_sales to wa-mth2.
              move t_mth2 to wa-sp2.
              ind2 = '1'.
            when t_mth3.
              move tp_sales to wa-mth3.
              move t_mth3 to wa-sp3.
              ind3 = '1'.
            when t_mth4.
              move tp_sales to wa-mth4.
              move t_mth4 to wa-sp4.
              ind4 = '1'.
            when t_mth5.
              move tp_sales to wa-mth5.
              move t_mth5 to wa-sp5.
              ind5 = '1'.
            when t_mth6.
              move tp_sales to wa-mth6.
              move t_mth6 to wa-sp6.
              ind6 = '1'.
            when t_mth7.
              move tp_sales to wa-mth7.
              move t_mth7 to wa-sp7.
              ind7 = '1'.
            when t_mth8.
              move tp_sales to wa-mth8.
              move t_mth8 to wa-sp8.
              ind8 = '1'.
            when t_mth9.
              move tp_sales to wa-mth9.
              move t_mth9 to wa-sp9.
              ind9 = '1'.
            when t_mth10.
              move tp_sales to wa-mth10.
              move t_mth10 to wa-sp10.
              ind10 = '1'.
            when t_mth11.
              move tp_sales to wa-mth11.
              move t_mth11 to wa-sp11.
              ind11 = '1'.
            when t_mth12.
              move tp_sales to wa-mth12.
              move t_mth12 to wa-sp12.
              ind12 = '1'.
            when t_mth13.
              move tp_sales to wa-mth13.
              move t_mth13 to wa-sp13.
              ind13 = '1'.
            when t_mth14.
              move tp_sales to wa-mth14.
              move t_mth14 to wa-sp14.
              ind14 = '1'.
            when t_mth15.
              move tp_sales to wa-mth15.
              move t_mth15 to wa-sp15.
              ind15 = '1'.
            when t_mth16.
              move tp_sales to wa-mth16.
              move t_mth16 to wa-sp16.
              ind16 = '1'.
            when t_mth17.
              move tp_sales to wa-mth17.
              move t_mth17 to wa-sp17.
              ind17 = '1'.
            when t_mth18.
              move tp_sales to wa-mth18.
              move t_mth18 to wa-sp18.
              ind18 = '1'.
            when t_mth19.
              move tp_sales to wa-mth19.
              move t_mth19 to wa-sp19.
              ind19 = '1'.
            when t_mth20.
              move tp_sales to wa-mth20.
              move t_mth20 to wa-sp20.
              ind20 = '1'.
            when t_mth21.
              move tp_sales to wa-mth21.
              move t_mth21 to wa-sp21.
              ind21 = '1'.
            when t_mth22.
              move tp_sales to wa-mth22.
              move t_mth22 to wa-sp22.
              ind22 = '1'.
            when t_mth23.
              move tp_sales to wa-mth23.
              move t_mth23 to wa-sp23.
              ind23 = '1'.
            when t_mth24.
              move tp_sales to wa-mth24.
              move t_mth24 to wa-sp24.
              ind24 = '1'.
            when t_mth25.
              move tp_sales to wa-mth25.
              move t_mth25 to wa-sp25.
              ind25 = '1'.
            when t_mth26.
              move tp_sales to wa-mth26.
              move t_mth26 to wa-sp26.
              ind26 = '1'.
            when t_mth27.
              move tp_sales to wa-mth27.
              move t_mth27 to wa-sp27.
              ind27 = '1'.
            when t_mth28.
              move tp_sales to wa-mth28.
              move t_mth28 to wa-sp28.
              ind28 = '1'.
            when t_mth29.
              move tp_sales to wa-mth29.
              move t_mth29 to wa-sp29.
              ind29 = '1'.
            when t_mth30.
              move tp_sales to wa-mth30.
              move t_mth30 to wa-sp30.
              ind30 = '1'.
            when t_mth31.
              move tp_sales to wa-mth31.
              move t_mth31 to wa-sp31.
              ind31 = '1'.
            when t_mth32.
              move tp_sales to wa-mth32.
              move t_mth32 to wa-sp32.
              ind32 = '1'.
            when t_mth33.
              move tp_sales to wa-mth33.
              move t_mth33 to wa-sp33.
              ind33 = '1'.
            when t_mth34.
              move tp_sales to wa-mth34.
              move t_mth34 to wa-sp34.
              ind34 = '1'.
            when t_mth35.
              move tp_sales to wa-mth35.
              move t_mth35 to wa-sp35.
              ind35 = '1'.
            when t_mth36.
              move tp_sales to wa-mth36.
              move t_mth36 to wa-sp36.
              ind36 = '1'.
          endcase.
         move seq to itab_seq-seq.
         append itab_seq.
          tp_tabix = sy-tabix.
          if sy-subrc = 0.
         modify table ta_s076 from wa.
            modify ta_s076 from wa index tp_tabix.
            if lp_s076-pmnux = tp_pmnux.
              seq = seq + 1.
              move seq to itab_seq.
              append itab_seq.
            endif.
          else.
            append wa to ta_s076.
            if lp_s076-pmnux = tp_pmnux.
              seq = seq + 1.
              move seq to itab_seq.
              append itab_seq.
            endif.
          endif.
          iseq = iseq + 1.
        endloop.                " endloop for lp_s076.
        itb_sales[] = ta_s076[].
    itb_sales12[] = ta_s076[].
    check if the Display yearly report is being selected *****
      elseif ra_yea = 'X' and
               pa_y_frm <> 0 and
               pa_y_to <> 0.
        clear year1.
        clear year2.
        clear year3.
        perform get_years.
        loop at ta_mat.
          loop at ta_yr.
            clear yr_index.
            yr_index = sy-tabix.
            case yr_index.
              when '1'.
                year1 = ta_yr-year.
              when '2'.
                year2 = ta_yr-year.
              when '3'.
                year3 = ta_yr-year.
            endcase.
            clear yr_frm.
            clear yr_to.
            year_frm = ta_yr-year.
            year_to = ta_yr-year.
            month1 = '01'.
            month12 = '12'.
            concatenate year_frm month1 into yr_frm.
            concatenate year_to month12 into yr_to.
            select * into corresponding fields of table lp_s076 from s076
                                     where pmnux = ta_mat-matnr
                                     and wenux = pa_werks
                                     and vrsio = pa_vrsio
                                     and spmon ge yr_frm
                                     and spmon le yr_to.
          calculate total sales.
            totalsales = 0.
            loop at lp_s076.
              at first.
                sum.
                totalsales = lp_s076-absat.
              endat.
              at end of absat."added by pradeep on 4/07/07
                sum.
                tp_totalprice = lp_s076-absat * ta_mat-stprs.
                itab_bom-requantity = lp_s076-absat * itab_bom-comp_qty / itab_bom-xmeng.
              endat.
            endloop.          "endloop for lp_s076
            select single maktx into tp_maktx from makt
               where matnr = ta_mat-matnr.
            read table ta_s076 into wa with key
              matnr = ta_mat-matnr.
            if sy-subrc ne 0.
              wa-matnr = lp_s076-pmnux.
              wa-maktx = tp_maktx.
            endif.
            case yr_index.
              when '1'.
                move totalsales to wa-sales_y1.
                move tp_totalprice to wa-sales_y1."added by pradeep
                move ta_yr-year to wa-year1.
                ind1 = '1'.
              when '2'.
                move totalsales to wa-sales_y2.
                move tp_totalprice to wa-sales_y2.
                move ta_yr-year to wa-year2.
                ind2 = '1'.
              when '3'.
                move totalsales to wa-sales_y3.
                move tp_totalprice to wa-sales_y3.
                move ta_yr-year to wa-year3.
                ind3 = '1'.
            endcase.
            tp_tabix = sy-tabix.
            if sy-subrc = 0.
                     modify table ta_s076 from wa.
              modify ta_s076 from wa index tp_tabix.
            else.
              append wa to ta_s076.
            endif.
          endloop.        "endloop for ta_yr
        endloop.        "endloop for ta_mat
        itb_sales[] = ta_s076[].
      else.
        exit.
      endif.
    endform.                   "get_sales
    *&      Form  get_months
          text
    form get_months.
      move pa_m_frm to t_mth1.
      perform get_next_few_months
      using t_mth1 '1'
      changing t_mth2.
      perform get_next_few_months
      using t_mth2 '1'
      changing t_mth3.
      perform get_next_few_months
      using t_mth3 '1'
      changing t_mth4.
      perform get_next_few_months
      using t_mth4 '1'
      changing t_mth5.
      perform get_next_few_months
      using t_mth5 '1'
      changing t_mth6.
      perform get_next_few_months
      using t_mth6 '1'
      changing t_mth7.
      perform get_next_few_months
      using t_mth7 '1'
      changing t_mth8.
      perform get_next_few_months
      using t_mth8 '1'
      changing t_mth9.
      perform get_next_few_months
      using t_mth9 '1'
      changing t_mth10.
      perform get_next_few_months
      using t_mth10 '1'
      changing t_mth11.
      perform get_next_few_months
      using t_mth11 '1'
      changing t_mth12.
      perform get_next_few_months
      using t_mth12 '1'
      changing t_mth13.
      perform get_next_few_months
      using t_mth13 '1'
      changing t_mth14.
      perform get_next_few_months
      using t_mth14 '1'
      changing t_mth15.
      perform get_next_few_months
      using t_mth15 '1'
      changing t_mth16.
      perform get_next_few_months
      using t_mth16 '1'
      changing t_mth17.
      perform get_next_few_months
      using t_mth17 '1'
      changing t_mth18.
      perform get_next_few_months
      using t_mth18 '1'
      changing t_mth19.
      perform get_next_few_months
      using t_mth19 '1'
      changing t_mth20.
      perform get_next_few_months
      using t_mth20 '1'
      changing t_mth21.
      perform get_next_few_months
      using t_mth21 '1'
      changing t_mth22.
      perform get_next_few_months
      using t_mth22 '1'
      changing t_mth23.
      perform get_next_few_months
      using t_mth23 '1'
      changing t_mth24.
      perform get_next_few_months
      using t_mth24 '1'
      changing t_mth25.
      perform get_next_few_months
      using t_mth25 '1'
      changing t_mth26.
      perform get_next_few_months
      using t_mth26 '1'
      changing t_mth27.
      perform get_next_few_months
      using t_mth27 '1'
      changing t_mth28.
      perform get_next_few_months
      using t_mth28 '1'
      changing t_mth29.
      perform get_next_few_months
      using t_mth29 '1'
      changing t_mth30.
      perform get_next_few_months
      using t_mth30 '1'
      changing t_mth31.
      perform get_next_few_months
      using t_mth31 '1'
      changing t_mth32.
      perform get_next_few_months
      using t_mth32 '1'
      changing t_mth33.
      perform get_next_few_months
      using t_mth33 '1'
      changing t_mth34.
      perform get_next_few_months
      using t_mth34 '1'
      changing t_mth35.
      perform get_next_few_months
      using t_mth35 '1'
      changing t_mth36.
    endform.                    "get_months
    *&      Form  get_years
          text
    form get_years.
      data : tp_yr_frm(4) type n.
      data : tp_yr_to(4) type n.
      data : yr_diff(4) type n.
      move pa_y_frm to tp_yr_frm.
      move pa_y_to to tp_yr_to.
      move tp_yr_frm to ta_yr-year.
      append ta_yr.
      yr_diff = tp_yr_to - tp_yr_frm.
    *number of years = 3
      if yr_diff = 2.
        do 2 times.
          tp_yr_frm = tp_yr_frm + 1.
          move tp_yr_frm to ta_yr-year.
          append ta_yr.
        enddo.
    *number of years = 2
      elseif yr_diff = 1.
        tp_yr_frm = tp_yr_frm + 1.
        move tp_yr_frm to ta_yr-year.
        append ta_yr.
      else.
        exit.
      endif.
    endform.                    "get_years
    *&      Form  get_next_few_months
          text
         -->LV_CURR_MONTH  text
         -->LV_MONTHS      text
         -->LV_TARGET_MTH  text
    form get_next_few_months using lv_curr_month lv_months
                             changing lv_target_mth.
      data : tp_month_curr like sy-datum,
             tp_month_plus like sy-datum.
      concatenate lv_curr_month '01' into tp_month_curr.
      call function 'SG_PS_ADD_MONTH_TO_DATE'
        EXPORTING
          months  = lv_months
          olddate = tp_month_curr
        IMPORTING
          newdate = tp_month_plus.
      move tp_month_plus(6) to lv_target_mth.
    endform.                    " get_months
    *&      Form  months_calculate
          text
         -->P_DATE1  text
         -->P_DATE2  text
         <--P_EMONTHS  text
    form months_calculate  using    p_date1
                                    p_date2
                           changing p_emonths.
      call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
        exporting
          i_date_from          = p_date1
             I_KEY_DAY_FROM       =
          i_date_to            = p_date2
             I_KEY_DAY_TO         =
             I_FLG_SEPARATE       = ' '
       importing
             E_DAYS               =
          e_months             = p_emonths.
             E_YEARS              =
    endform.                    " months_calculate
    *&      Form  retrieve_bom
          text
    -->  p1        text
    <--  p2        text
    form retrieve_bom .
    retrieve BOM components
      sort ta_header by matnr.
      loop at ta_header where stlan = '1' and stlst = '01'.
        tp_bmeng = '1'.
        perform get_bom tables ta_stpo using
                                   ta_header-matnr ta_header-werks  ta_header-stlan ta_header-stlal tp_bmeng.
    requirement quantity calculation for active bom
        perform calculation1.
    retrieve BOM components for pgm
        sort itab_bom2 by idnrk ascending.
        delete adjacent duplicates from itab_bom2 comparing matnr idnrk.
       loop at itab_bom2.         " commented by weihong
        tp_stlan = '1'.
        tp_stlal = '02'.
        perform get_pgm tables ta_stpo12 using
                                   itab_bom2-matnr ta_header-werks  tp_stlan tp_stlal.
       endloop.          " endloop for itab_bom2.(commented by weihong)
    requirement quantity calculation for inactive bom
        perform calculation2.
        refresh : itab_bom1, itab_bom2, itab_pgm, temp_bom1,itab_path.
        clear : itab_bom1, itab_bom2, itab_pgm, temp_bom1,itab_path.
      endloop.      " endloop for ta_header.
    **itab_msale itab_ysale
    *break-point.
      perform display_alv.
    endform.                "retrieve bom
    *&      Form  get_bom
          text
         -->LV_MATNR   text
         -->LV_WERKS   text
         -->LV_STLAN   text
         -->LV_STLAL   text
    form get_bom tables lt_stpo structure stpox
                 using lv_matnr like mast-matnr
                       lv_werks like mast-werks
                       lv_stlan like mast-stlan
                       lv_stlal like stko-stlal
                       lv_emeng like stko-bmeng .
      data: ta_topmat type cstmat,
            tp_dstst like csdata-xfeld,
            ta_matcat type cscmat occurs 0,
            tp_index like sy-tabix,
            tp_stufe like stpox-stufe,
            tp_diff like stpox-stufe,
            tp_indx like sy-tabix,
            tp_date like sy-datum,
            lv_stufe like stpox-stufe,
            lv_wegxx like stpox-wegxx,
            lv_stprs like stpox-stprs,
            lv_waers like stpox-waers,
           lv_cuky_new like cdpos-cuky_new,
           lv_value_new like cdpos-value_new,
            lv_index like sy-tabix,
            lv_datum like sy-datum,"added by pradeep on 02-07-07
            nxt_index like sy-tabix.
    added by weihong.
      data: tp_mtart like mara-mtart,
            tp_matkl like mara-matkl,
            tp_stprs like stpox-stprs,
            tp_bomlv1 like mast-matnr,
            tp_bomlv2 like mast-matnr,
            tp_bomlv3 like mast-matnr,
            tp_bomlv4 like mast-matnr,
            tp_indln type i.
      write : lv_matnr to itab_bom1-matnr.
      write : lv_matnr to itab_bom2-matnr.
      write : lv_matnr to itab_path-matnr.

    Hi gurus,actually this program selecion screen is linked to ..as
    First screen is .Sop
                          .copa
    Again for sop is having a selection screen and in this it is divide based on month and year seperately in two more screens.
    same for copa also....
    so pls tell me a correct solution where to correct and get values.
    Priority is very highhhhhhhhhhhhhh,so pls help me in sorting out this.

  • Sending report output via E-mail (excel pivoted format)

    Hi all,
    i have a written a report where i need to send the report output to somebody via
    E-mail.i am sending this report output via E-mail successfully.The receiver receives, my output in excel format.but this excel is not <b>pivoted</b>.
    i want , the receiver should get my output in pivoted excel format.i.e my output data should be exactly fit in the excel sheet.
    now the columns in excel sheet are overlapping.once i double clicked, the columns are getting separated.i do not want to double click.i want all the columns should come properly i.e excel field  length should be adjusted as per the output field length.
    i am giving my coding below.plz suggest how i can do the above thing .it's urgent.
    any idea will be highly appreaciated.
    Regards
    if not p_email1 is initial.
         perform fill_report_csv.
         perform f_send_internet_mail.
      endif.
    FORM fill_report_csv.
       data :   l_text(232) type c,
               v_matnr1(21) type c,
               v_matnr(21) type c,
               v_matkl(14) type c,
               v_maktx(45) type c,
               v_ttlstk(14) type c,
               v_verpr(14) type c,
               v_werks(14) type c,
               v_lgort(14) type c,
               v_char(10) type c,
               v_stks type p ,
               v_po(40) type c,
               v_qty(13) type c,
                v_qty1 type sy-datum,
               v_date(15) type c,
               v_date1(15) TYPE C,
               v_name(35) type c,
               v_eknam(18) type c,
               v_lifnr(15) type c,
            l_po(40) type c,
            v_matnr(20) type c,
             l_rate(11) type  p decimals 5,
             l_flag type c.
      concatenate c_equal c_colon 'PO no.' c_colon
                    into v_po.
      concatenate c_equal c_colon 'Material no.' c_colon
                    into v_matnr.
      concatenate c_equal c_colon 'Description.' c_colon
                    into v_maktx.
      concatenate c_equal c_colon 'Due Qty.' c_colon
                    into v_qty.
      concatenate c_equal c_colon 'Del Date.' c_colon
                    into v_date.
      concatenate c_equal c_colon 'Vendor.' c_colon
                    into v_name.
      concatenate c_equal c_colon 'Buyer.' c_colon
                    into v_eknam.
      concatenate c_equal c_colon 'Vendor Code.' c_colon
                    into v_lifnr.
    concatenate
             v_po v_matnr v_maktx v_qty
             v_date v_name v_eknam v_lifnr
             into i_download
             SEPARATED BY con_tab.
      append i_download .
    clear : v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
    clear wa_output.
    loop at i_output into wa_output.
       on change of wa_output-ebeln.
         clear v_lines.
         loop at i_eket into wa_eket
                 where ebeln = wa_output-ebeln.
           v_lines = v_lines + 1.
           clear wa_eket.
         endloop.
    **-- Checking of page break
         v_lines = sy-linno + v_lines .
         if 55 < v_lines  .
           write:/0(161) sy-uline.
           new-page.
         endif.
      clear v_lines.
          loop at i_eket into wa_eket
                  where ebeln = wa_output-ebeln.
            v_lines = v_lines + 1.
            clear wa_eket.
          endloop.
    *-- Calculating the due qty.
        wa_output-dumng = wa_output-menge - wa_output-wemng.
    *-- Writing the Line items of the PO.
        read table i_ekpo into wa_ekpo
              with key ebeln = wa_output-ebeln
                       ebelp = wa_output-ebelp.
         l_rate = wa_ekpo-netpr / wa_ekpo-peinh.
    *-- Writing of PO detail
         if wa_output-dumng gt 0 .
         v_qty = wa_output-dumng.
        v_date1 = wa_output-eindt.
        v_maktx = wa_output-maktx.
         if wa_output-maktx+0(1) = '"' .
                concatenate  c_equal wa_output-maktx
                   into v_maktx  .
             else .
                concatenate  c_equal c_colon wa_output-maktx c_colon
                   into v_maktx  .
             endif .
       if wa_output-name1+0(1) = '"' .
                concatenate  c_equal wa_output-name1
                   into v_name  .
             else .
                concatenate  c_equal c_colon wa_output-name1 c_colon
                   into v_name  .
             endif .
        v_name = wa_output-name1.
        v_lifnr = wa_output-lifnr.
         write wa_output-eindt to v_date1 DD/MM/YYYY.
         concatenate '="' wa_output-ebeln '/'
                wa_output-ebelp '"' into v_po .
         concatenate '="' wa_output-matnr '"' into v_matnr .
             concatenate  c_equal c_colon wa_output-maktx c_colon
               into v_maktx  .
              concatenate  c_equal c_colon wa_output-dumng c_colon
               into v_qty1  .
               concatenate  c_equal c_colon wa_output-eindt c_colon
               into v_date1  .
              concatenate  c_equal c_colon wa_output-name1 c_colon
               into v_name  .
                concatenate  c_equal c_colon wa_output-eknam c_colon
                into v_eknam  .
              concatenate  c_equal c_colon wa_output-lifnr c_colon
               into v_lifnr  .
              concatenate  c_equal c_colon wa_mard-werks '/'
               wa_mard-lgort c_colon
               into v_lgort .
                 concatenate '="' wa_output-lifnr '"' into v_lifnr .
    condense:v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
         concatenate
             v_po v_matnr v_maktx v_qty
             v_date1 v_name v_eknam v_lifnr
             into i_download
             SEPARATED BY con_tab.
        concatenate con_cret i_download INTO i_download .
        append i_download .
      endif.
    clear : v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
    endloop.
    ENDFORM.                    " fill_report_csv
    *&      Form  f_send_internet_mail
          text
    -->  p1        text
    <--  p2        text
    FORM f_send_internet_mail.
    Variables
    data:   it_packing_list like sopcklsti1 occurs 0 with header line,
            it_contents like solisti1 occurs 0 with header line,
            it_receivers like somlreci1 occurs 0 with header line,
            it_attachment like solisti1 occurs 0 with header line,
            gd_cnt type i,
            gd_sent_all(1) type c,
            gd_doc_data like sodocchgi1,
            gd_error type sy-subrc.
    data:   it_message type standard table of SOLISTI1 initial size 0
                    with header line.
    data : found_receiver type c,
           v_title(80) type c,
           l_text(180) type c.
    Fill the document data.
      gd_doc_data-doc_size = 1.
    Adds text to email text table
      append 'Pls see attached open purchase order report.' to it_message.
      append '' to it_message.
      concatenate 'Note: This is system generated report'
                  ', figures may subject to actual physical count.'
                  into l_text separated by space.
      append l_text to it_message.
    Populate the subject/generic message attributes
      CLEAR gd_doc_data.
      READ TABLE i_download INDEX w_cnt.
      gd_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( i_download ).
      gd_doc_data-obj_langu  = sy-langu.
      gd_doc_data-obj_name   = 'SAPRPT'.
    if p_asdate is initial .
         concatenate p_title ' '
                  sy-datum sy-uzeit into v_title separated by space.
    else .
        concatenate p_title ' '
                 p_bldat p_cputm into v_title separated by space.
    endif .
      gd_doc_data-obj_descr  = v_title .
      gd_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = i_download[].
    Describe the body of the message
      clear it_packing_list.
      refresh it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      describe table it_message lines it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      append it_packing_list.
    Create attachment notification
      it_packing_list-transf_bin = 'X'.
      it_packing_list-head_start = 1.
      it_packing_list-head_num   = 1.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES it_packing_list-body_num.
      it_packing_list-doc_type   =  'XLS'.
      it_packing_list-obj_descr  =  'OPEN PURCHASE ORDER' .
      it_packing_list-obj_name   =  'PO.XLS' .
      it_packing_list-doc_size   =  it_packing_list-body_num * 255.
      APPEND it_packing_list.
    assign SAP user smtp address from successful retrieval.
      loop at p_email.
    Add the recipients email address
         found_receiver = 'X' .
         it_receivers-receiver = p_email-low.
         it_receivers-rec_type = 'U'.
         it_receivers-com_type = 'INT'.
         it_receivers-notif_del = ''.
         it_receivers-notif_ndel = 'X'.
         append it_receivers .
      endloop .
    Add default recipient email when unable to locate purc group email
       if found_receiver is initial .
           it_receivers-receiver = p_email.
           it_receivers-rec_type = 'U'.
           it_receivers-com_type = 'INT'.
           it_receivers-notif_del = ''.
           it_receivers-notif_ndel = 'X'.
          append it_receivers.
       endif .
    Call the FM to post the message to SAPMAIL
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           exporting
                document_data              = gd_doc_data
                put_in_outbox              = 'X'
                commit_work                = 'X'
           importing
                sent_to_all                = gd_sent_all
           tables
                packing_list               = it_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = it_receivers
           exceptions
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                others                     = 8.
    Store function module return code
      gd_error = sy-subrc.
    Get it_receivers return code
      loop at it_receivers.
      endloop.
    Instructs mail send program for SAPCONNECT to send email.
      wait up to 2 seconds.
      if gd_error eq 0.
          submit rsconn01 with mode = 'INT'
                        with output = ' '
                        and return.
      endif.
    ENDFORM.                    " f_send_internet_mail

    Hi,
    go through this link,
    http://www.sapdevelopment.co.uk/reporting/email/emailhome.htm
    you have some sample programs.
    Regards,
    Raghavendra

  • Report output via E-mail

    Hi all,
    i have a written a report where i need to send the report output to somebody via
    E-mail.i am sending this report output via E-mail successfully.The receiver receives, my output in excel format.but this excel is not <b>pivoted</b>.
    i want , the receiver should get my output in pivoted excel format.i.e my output data should be exactly fit in the excel sheet.
    now the columns in excel sheet are overlapping.once i double clicked, the columns are getting separated.i do not want to double click.i want all the columns should come properly i.e excel field  length should be adjusted as per the output field length.
    i am giving my coding below.plz suggest how i can do the above thing .it's urgent.
    any idea will be highly appreaciated.
    Regards
    if not p_email1 is initial.
         perform fill_report_csv.
         perform f_send_internet_mail.
      endif.
    FORM fill_report_csv.
       data :   l_text(232) type c,
               v_matnr1(21) type c,
               v_matnr(21) type c,
               v_matkl(14) type c,
               v_maktx(45) type c,
               v_ttlstk(14) type c,
               v_verpr(14) type c,
               v_werks(14) type c,
               v_lgort(14) type c,
               v_char(10) type c,
               v_stks type p ,
               v_po(40) type c,
               v_qty(13) type c,
                v_qty1 type sy-datum,
               v_date(15) type c,
               v_date1(15) TYPE C,
               v_name(35) type c,
               v_eknam(18) type c,
               v_lifnr(15) type c,
            l_po(40) type c,
            v_matnr(20) type c,
             l_rate(11) type  p decimals 5,
             l_flag type c.
      concatenate c_equal c_colon 'PO no.' c_colon
                    into v_po.
      concatenate c_equal c_colon 'Material no.' c_colon
                    into v_matnr.
      concatenate c_equal c_colon 'Description.' c_colon
                    into v_maktx.
      concatenate c_equal c_colon 'Due Qty.' c_colon
                    into v_qty.
      concatenate c_equal c_colon 'Del Date.' c_colon
                    into v_date.
      concatenate c_equal c_colon 'Vendor.' c_colon
                    into v_name.
      concatenate c_equal c_colon 'Buyer.' c_colon
                    into v_eknam.
      concatenate c_equal c_colon 'Vendor Code.' c_colon
                    into v_lifnr.
    concatenate
             v_po v_matnr v_maktx v_qty
             v_date v_name v_eknam v_lifnr
             into i_download
             SEPARATED BY con_tab.
      append i_download .
    clear : v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
    clear wa_output.
    loop at i_output into wa_output.
       on change of wa_output-ebeln.
         clear v_lines.
         loop at i_eket into wa_eket
                 where ebeln = wa_output-ebeln.
           v_lines = v_lines + 1.
           clear wa_eket.
         endloop.
    **-- Checking of page break
         v_lines = sy-linno + v_lines .
         if 55 < v_lines  .
           write:/0(161) sy-uline.
           new-page.
         endif.
      clear v_lines.
          loop at i_eket into wa_eket
                  where ebeln = wa_output-ebeln.
            v_lines = v_lines + 1.
            clear wa_eket.
          endloop.
    *-- Calculating the due qty.
        wa_output-dumng = wa_output-menge - wa_output-wemng.
    *-- Writing the Line items of the PO.
        read table i_ekpo into wa_ekpo
              with key ebeln = wa_output-ebeln
                       ebelp = wa_output-ebelp.
         l_rate = wa_ekpo-netpr / wa_ekpo-peinh.
    *-- Writing of PO detail
         if wa_output-dumng gt 0 .
         v_qty = wa_output-dumng.
        v_date1 = wa_output-eindt.
        v_maktx = wa_output-maktx.
         if wa_output-maktx+0(1) = '"' .
                concatenate  c_equal wa_output-maktx
                   into v_maktx  .
             else .
                concatenate  c_equal c_colon wa_output-maktx c_colon
                   into v_maktx  .
             endif .
       if wa_output-name1+0(1) = '"' .
                concatenate  c_equal wa_output-name1
                   into v_name  .
             else .
                concatenate  c_equal c_colon wa_output-name1 c_colon
                   into v_name  .
             endif .
        v_name = wa_output-name1.
        v_lifnr = wa_output-lifnr.
         write wa_output-eindt to v_date1 DD/MM/YYYY.
         concatenate '="' wa_output-ebeln '/'
                wa_output-ebelp '"' into v_po .
         concatenate '="' wa_output-matnr '"' into v_matnr .
             concatenate  c_equal c_colon wa_output-maktx c_colon
               into v_maktx  .
              concatenate  c_equal c_colon wa_output-dumng c_colon
               into v_qty1  .
               concatenate  c_equal c_colon wa_output-eindt c_colon
               into v_date1  .
              concatenate  c_equal c_colon wa_output-name1 c_colon
               into v_name  .
                concatenate  c_equal c_colon wa_output-eknam c_colon
                into v_eknam  .
              concatenate  c_equal c_colon wa_output-lifnr c_colon
               into v_lifnr  .
              concatenate  c_equal c_colon wa_mard-werks '/'
               wa_mard-lgort c_colon
               into v_lgort .
                 concatenate '="' wa_output-lifnr '"' into v_lifnr .
    condense:v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
         concatenate
             v_po v_matnr v_maktx v_qty
             v_date1 v_name v_eknam v_lifnr
             into i_download
             SEPARATED BY con_tab.
        concatenate con_cret i_download INTO i_download .
        append i_download .
      endif.
    clear : v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
    endloop.
    ENDFORM.                    " fill_report_csv
    *&      Form  f_send_internet_mail
          text
    -->  p1        text
    <--  p2        text
    FORM f_send_internet_mail.
    Variables
    data:   it_packing_list like sopcklsti1 occurs 0 with header line,
            it_contents like solisti1 occurs 0 with header line,
            it_receivers like somlreci1 occurs 0 with header line,
            it_attachment like solisti1 occurs 0 with header line,
            gd_cnt type i,
            gd_sent_all(1) type c,
            gd_doc_data like sodocchgi1,
            gd_error type sy-subrc.
    data:   it_message type standard table of SOLISTI1 initial size 0
                    with header line.
    data : found_receiver type c,
           v_title(80) type c,
           l_text(180) type c.
    Fill the document data.
      gd_doc_data-doc_size = 1.
    Adds text to email text table
      append 'Pls see attached open purchase order report.' to it_message.
      append '' to it_message.
      concatenate 'Note: This is system generated report'
                  ', figures may subject to actual physical count.'
                  into l_text separated by space.
      append l_text to it_message.
    Populate the subject/generic message attributes
      CLEAR gd_doc_data.
      READ TABLE i_download INDEX w_cnt.
      gd_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( i_download ).
      gd_doc_data-obj_langu  = sy-langu.
      gd_doc_data-obj_name   = 'SAPRPT'.
    if p_asdate is initial .
         concatenate p_title ' '
                  sy-datum sy-uzeit into v_title separated by space.
    else .
        concatenate p_title ' '
                 p_bldat p_cputm into v_title separated by space.
    endif .
      gd_doc_data-obj_descr  = v_title .
      gd_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = i_download[].
    Describe the body of the message
      clear it_packing_list.
      refresh it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      describe table it_message lines it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      append it_packing_list.
    Create attachment notification
      it_packing_list-transf_bin = 'X'.
      it_packing_list-head_start = 1.
      it_packing_list-head_num   = 1.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES it_packing_list-body_num.
      it_packing_list-doc_type   =  'XLS'.
      it_packing_list-obj_descr  =  'OPEN PURCHASE ORDER' .
      it_packing_list-obj_name   =  'PO.XLS' .
      it_packing_list-doc_size   =  it_packing_list-body_num * 255.
      APPEND it_packing_list.
    assign SAP user smtp address from successful retrieval.
      loop at p_email.
    Add the recipients email address
         found_receiver = 'X' .
         it_receivers-receiver = p_email-low.
         it_receivers-rec_type = 'U'.
         it_receivers-com_type = 'INT'.
         it_receivers-notif_del = ''.
         it_receivers-notif_ndel = 'X'.
         append it_receivers .
      endloop .
    Add default recipient email when unable to locate purc group email
       if found_receiver is initial .
           it_receivers-receiver = p_email.
           it_receivers-rec_type = 'U'.
           it_receivers-com_type = 'INT'.
           it_receivers-notif_del = ''.
           it_receivers-notif_ndel = 'X'.
          append it_receivers.
       endif .
    Call the FM to post the message to SAPMAIL
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           exporting
                document_data              = gd_doc_data
                put_in_outbox              = 'X'
                commit_work                = 'X'
           importing
                sent_to_all                = gd_sent_all
           tables
                packing_list               = it_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = it_receivers
           exceptions
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                others                     = 8.
    Store function module return code
      gd_error = sy-subrc.
    Get it_receivers return code
      loop at it_receivers.
      endloop.
    Instructs mail send program for SAPCONNECT to send email.
      wait up to 2 seconds.
      if gd_error eq 0.
          submit rsconn01 with mode = 'INT'
                        with output = ' '
                        and return.
      endif.
    ENDFORM.                    " f_send_internet_mail

    ans

  • Decimals upto 2 in alv report

    Hi to all abapers,
    I have to show only upto 2 decimals in the field of an alv report but it is of type p and decimals 4.I dont want to change its type to 2 decimals due to some calculations.So can we show upto 2 decimals in the report?
    Thanks in Advance,
    Salish

    Hi,
    Here is the code
    <b>Here act_pckeff is of type p decimals 4 and i want it upto 2 decimals in the output.</b>
    PERFORM fldcat  USING i_fieldcat 'ACT_PCKEFF'       'DEC'       'Actual Efficiency "Packed"'    ''."13
    FORM fldcat USING p_ifieldcat TYPE lvc_t_fcat
                          value(p_name)
                          value(p_type)
                          value(p_desc)
                          value(p_key).
      DATA: w_fldcat TYPE LINE OF lvc_t_fcat.
      CLEAR w_fldcat.
      w_fldcat-fieldname = p_name.
      w_fldcat-datatype = p_type.
      w_fldcat-reptext = p_desc.
      w_fldcat-key     = p_key.
      IF w_fldcat-fieldname = 'AUFNR'.
        w_fldcat-no_zero = 'X'.
      ENDIF.
      IF p_type = 'CURR' OR p_type = 'QUAN'..
        w_fldcat-do_sum = 'X'.
      ENDIF.
      <b>IF p_name = 'ACT_PCKEFF'.
        w_fldcat-decimals = 2.
        w_fldcat-do_sum = 'C'.
      ENDIF</b>.
      APPEND w_fldcat TO p_ifieldcat.
    ENDFORM.                    " fldcat
    Regards,
    Salish.

  • ALV Output

    Hi Experts,
    In an ALV Report's Output Iam getting a field values in a strange manner. For some records it showing the values with decimals and for some it is not showing.
    Can you please let me know what is the reason? Thanks for your help.
    (The reference field is: EKBE-MENGE)
    For eg:
    0.000
    1200
    154,560
    0
    0.000

    Hi,
    Here's the fieldcatalog:
    form init_field_catalog.
    data: l_colpos type i.
      refresh i_fieldcat.
      clear i_fieldcat.
    *--- Data fields.
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
           exporting
                i_program_name         = w_repid
                i_internal_tabname     = 'I_OUTPUT'
                i_inclname             = w_repid
           changing
                ct_fieldcat            = i_fieldcat[]
           exceptions
                inconsistent_interface = 1
                program_error          = 2
                others                 = 3.
    *--- Modify field catalog.
      loop at i_fieldcat.
        case i_fieldcat-fieldname.
          when 'MATNR'.
            i_fieldcat-col_pos = 1.
            i_fieldcat-key     = 'X'.                          
          when 'MAKTX'.
            i_fieldcat-col_pos = 2.
            i_fieldcat-ddic_outputlen = 40.
          when 'LIFNR'.
            i_fieldcat-col_pos = 3.
          when 'MEINS'.
            i_fieldcat-col_pos = 4.
            i_fieldcat-reptext_ddic = 'UoM'.
          when 'WAERS'.
            i_fieldcat-col_pos = 5.
          when 'SPAMT'.
            i_fieldcat-col_pos = 6.
            i_fieldcat-ddic_outputlen = 20.
            i_fieldcat-seltext_l    = 'Spend to Crnt Dt'.
            i_fieldcat-reptext_ddic = 'Spend to Crnt Dt'.
          when 'SPQTY'.
            i_fieldcat-col_pos = 7.
            i_fieldcat-ref_tabname = 'EKBE'.
            i_fieldcat-ref_fieldname = 'MENGE'.
            i_fieldcat-reptext_ddic = 'QTY to Current Dt'.
            i_fieldcat-seltext_l    = 'QTY to Current Dt'.
          when others.
            i_fieldcat-no_out = 'X'.
            i_fieldcat-col_pos = 0.
        endcase.
        modify i_fieldcat.
      endloop.

Maybe you are looking for

  • Mac pro keeps rebooting

    My Mac Pro 2.1 Keeps rebooting ramdomly. It seems to be more common when editing video. Any ideas anybody? Thanks in advance.

  • Installing Photoshop Elements 1.01 on Windows 8

    To Whom it May Concern, I'm trying to install Photoshop Elements 1.01 on Windows 8, but the system won't let me. Please let me know how i can install this version.  Thank you. RON

  • Imac g3 Early 2001 - Indigo cd drive replace

    hi, i have a imac g3 early 2001. It's cd drive is broken is there a cd drive that will fit it and work without and drivers you can read about it here http://everymac.com/systems/apple/imac/specs/imac_400_indigo.html thanks DM1000

  • HOW CAN I SEE SUBTITLES WHILE WATCHING A MOVIE?

    HOW CAN I SEE SUBTITLES WHILE WATCHING A MOVIE?

  • How to add extra labels into Bridge CS5?

    Hi folks, nice to meet you all. I do not want to edit or rename the existing 5 existing labels into Bridge CS5. I just want to create new labels. So, I want to add extra labels to have more than 5 labels. Does anybody know how to add extra labels int