Function module for USD amount to TWD

Hi,
Any one send me function module for converting USD currency to TWD.
Thanks,
donald

HI,
DATA: gd_fcurr TYPE tcurr-fcurr,
      gd_tcurr TYPE tcurr-tcurr,
      gd_date  TYPE sy-datum,
      gd_value TYPE i.
gd_fcurr = 'USD'.
gd_tcurr = 'TWD'.
gd_date  = sy-datum.
gd_value = 10.
PERFORM currency_conversion USING gd_fcurr
                                  gd_tcurr
                                  gd_date
                         CHANGING gd_value.
* Convert value to Currency value
*&      Form  currency_conversion
*       text
*      -->P_GD_FCURR  text
*      -->P_GD_TCURR  text
*      -->P_GD_DATE   text
*      <--P_GD_VALUE  text
FORM currency_conversion  USING    p_fcurr
                                   p_tcurr
                                   p_date
                          CHANGING p_value.
  DATA: t_er        TYPE tcurr-ukurs,
        t_ff        TYPE tcurr-ffact,
        t_lf        TYPE tcurr-tfact,
        t_vfd       TYPE datum,
        ld_erate(12)   TYPE c.
  CALL FUNCTION 'READ_EXCHANGE_RATE'
    EXPORTING
*       CLIENT                  = SY-MANDT
      date                    = p_date
      foreign_currency        = p_fcurr
      local_currency          = p_tcurr
      TYPE_OF_RATE            = 'M'
*       EXACT_DATE              = ' '
   IMPORTING
      exchange_rate           = t_er
      foreign_factor          = t_ff
      local_factor            = t_lf
      valid_from_date         = t_vfd
*       DERIVED_RATE_TYPE       =
*       FIXED_RATE              =
*       OLDEST_RATE_FROM        =
   EXCEPTIONS
     no_rate_found           = 1
     no_factors_found        = 2
     no_spread_found         = 3
     derived_2_times         = 4
     overflow                = 5
     zero_rate               = 6
     OTHERS                  = 7
  IF sy-subrc EQ 0.
    ld_erate = t_er / ( t_ff / t_lf ).
    p_value = p_value * ld_erate.
  ENDIF.
ENDFORM.                    " currency_conversion
You can use
<b>CONVERT_TO_FOREIGN_CURRENCY</b> Convert local currency to foreign
<b>CONVERT_TO_LOCAL_CURRENCY</b> Convert from foreign currency to local currency currency.

Similar Messages

  • Function Module for Dollar Amount

    Hi All,
    I have a requirement where a REFX contract once created has to go through a series of approvals. How do I get the dollar amount on the contract so that it can be routed to the proper level for approval? Is there a function module for this?
    Thanks a lot in advance.

    Hi Amlan,
    For the condition (amount) on contract you can get using..
    BAPI_RE_CN_GET_DETAIL or
    API_RE_CN_GET_DETAIL
    And if you doing currency conversion there are lot of FM.
    Thanks
    Veman

  • ABAP Function module for Display amount in word

    Dear all,
                Suppose amount is 100 and currency is USD then text display like 0ne hundred dollar. and suppose amount is 100
    and currency is INR then text display like One hundred rupees.can you please suggest me what is the function module to used in smart forms.
    Thanks and Regards,
    Raheem.
    Moderator Message: THE MOST FAQ question in SCN forums. And you never bothered to search.
    Edited by: kishan P on Mar 1, 2012 2:19 PM

    fm SPELL_AMOUNT

  • Function module for updating amount in VL02N transaction

    Hi All,
         I have a requirement , to update Amount in Conditions tab of the header (VL02N transaction) beside parcel tracking .
    I have to update condition type 'ZF01' & the amount here ..
    I will get  file from a third party system to update the amount & tracking no..
    i have successfully updated tracking no.. by using FM XSI_TRACKING_DATA_SAVE.., unable to find FM for amount & condition type update..
    I have tried searching in FM 'WS_DELIVERY_UPDATE', didnt find anything related.
    If anyone has done any similar update in VL02N transaction, can you please suggest me appropriate FM?
    Regards
    Chaithanya

    fm SPELL_AMOUNT

  • Need Function Module for convertion of  Foreign currency to Indian currency

    hi friends,
    i need function module for converting amount from
    Foreign currency to Indian currency
    thanks

    hi Venkat,
    Please use the function module CONVERT_TO_LOCAL_CURRENCY
    <b><u>Sample code:</u></b>
          call function 'CONVERT_TO_LOCAL_CURRENCY'
            exporting
              date             = p_alv_tab-begda
              foreign_amount   = p_alv_tab-kkost_p_person
              foreign_currency = p_alv_tab-kwaer                 " foreign currency
              local_currency   = l_ev_waer                           " Indian currency
            importing
              local_amount     = p_alv_tab-kkost_p_person
            exceptions
              no_rate_found    = 1
              overflow         = 2
              no_factors_found = 3
              no_spread_found  = 4
              others           = 5.
    Hope this helps,
    Sajan Joseph.

  • Function Module to convert  amount to  amount in words

    Dear Guru ,
    I want to know is there any sap standard Function Module to convert  amount value   to  amount in words
    Thanks & Regards

    Hi..
    Use FM SPELL_AMOUNT.
    This function module converts an amount or number into words. It can be used as follows:
    Convert a number into words
    To do this, the transfer parameters LANGUAGE and AMOUNT have to be entered.
    Convert an amount into words
    To do this, the fields LANGUAGE, CURRENCY, and AMOUNT have to be entered.
    Program RF_SPELL contains a sample call of the function module. You can use it for test purposes.
    REPORT ZSPELL.
    TABLES SPELL.
    DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.
    DATA : PAMOUNT LIKE SPELL-NUMBER  VALUE '1234510'.
    SY-TITLE = 'SPELLING NUMBER'.
    PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.
    WRITE: 'NUMBERS', T_SPELL-WORD, 'DECIMALS ', T_SPELL-DECWORD.
    FORM SPELL_AMOUNT USING PWRBTR PWAERS.
      CALL FUNCTION 'SPELL_AMOUNT'
           EXPORTING
                AMOUNT    = PAMOUNT
                CURRENCY  = PWAERS
                FILLER    = SPACE
                LANGUAGE  = 'E'
           IMPORTING
                IN_WORDS  = T_SPELL
           EXCEPTIONS
                NOT_FOUND = 1
                TOO_LARGE = 2
                OTHERS    = 3.
    ENDFORM.                               " SPELL_AMOUNT
    I hope it helps.
    Reward pts if helpful
    Regards
    - Rishika Bawa

  • Function module for converting the foreign currency to words

    hi,
    can anybody tell me about the function module for converting the foreign currency to words format.
    Like 25.50 USD
    should be "Twenty Five Dollar & Fifty Sents."
    foreign currency can be anyone like USD, JPY, EUR etc.
    Regards
    Nitin Varshney

    Hi,
    Try using the FM SPELL_AMOUNT
    Check this wiki
    [SPELL_AMOUNT|https://wiki.sdn.sap.com/wiki/display/Snippets/SpelltheAmountenteredin+words]
    Regards
    Sarves

  • Standard BAPI or Function Module for FB01posting

    Hi Experts,
    My requirement is as follows.
    Invoice details would be sent across from Middleware to SAP and for which I have developed a Custom Remote Enabled Function Module. The Function Module needs to post the data using FB01 Transaction.
    I had planned for recording a BDC for FB01 and post the data, however, we are on the verge of getting upgraded from 4.7 to ECC 6.0. To avoid problems that we might face for change of screens in ECC 6.0, I would prefer using a BAPI or Function Module for FB01 posting, if available, instead of BDC.
    Data coming from Middleware are as follows.
    HEADER:
    BKPF-BLDAT :  Document Date
    BKPF-BUDAT : Posting Date
    BKPF-XBLNR: Reference (Invoice#)
    BKPF-BLART : Document Type
    BKPF-BUKRS : Company Code
    BKPF-BKTXT : DocHeader Text
    BKPF-WAERS : Currency
    LINE ITEM:
    BSEG-LIFNR : Vendor no
    BSEG-WRBTR - Total amt -Debit/Credit -Vendor
    BSEG-ZUONR : Assignment field
    BSEG-EMPFB : Alternative Payee
    BSEG-UZAWE : Payment Method Supplement
    BSEG-ZTERM : Pmt terms
    BSEG-KOSTL : Costcenter
    BSEG-HKONT : GL AccountNumber
    BSEG-WRBTR : Amount for GL
    BSEG-SGTXT : Line item text
    The Vendor Line Item would be one where as GL line items could me more than one.
    Can any of you suggest me a standard BAPI or Func Mod?
    Points will be awarded for valuable inputs.
    Thanks to all!!!!

    You can use RFBIBL00 program for FB01 postings. Go through the program help on how to use this program.
    This program requires a file to be on application server in a certain format.
    You may also refer the program RFBIBLT0 on how the file format should be.
    Hope this helps.
    Thanks,
    SKJ

  • Function Module for Excise and VAT Calculation

    Dear All,
    I required one Function module for calculation of Excise % and amount of Invoice Verification Document.
    We are use TAXINN tax procedure. I am try to make Purchases Register where we required the Break up of Full tax amount as basic excise duty, Education Cess, S&H Education Cess and VAT Amount.
    Thanks
    Mukesh

    Hi,
    Locks are usually appliend on Tables. So you could find the table names affecting.
    Then you could goto SE11 and n Lock objects search for table name
    Once you identify the lock object. Display. Goto->Lock Modules.
    You will get 2 module names one for enqueue and 1 for dequeue.
    e.g. Lock object EBKK_ACCNT.
    and FMs are DEQUEUE_EBKK_ACCNT and ENQUEUE_EBKK_ACCNT
    Hope this helps.
    Regards
    Megha

  • Function module for translation

    Hi friends,
               Is there any Function module for translating the unit of currency (WAERS) to other languages. I've a requirement where I need the value EUR or USD to be printed in russian.
    Thanks,
    Sharmila

    Hi
    Please check the FM
    <b>CURRENCY_GETLIST</b>
    It basically takes the values from the table TCURT
    Hope this helps..

  • Function module for assigned wage types

    Hi experts,
    We need wage type wise count and sum of the amount for each wage type defined in infotype '0008' for the given from and to dates. Is there any function module available for the same.
    Please suggest.
    Regards,
    Kaustubh Kabre.

    Hi,
    <li>I do not look for function module for this case as i know that we can or have to read wage types and corresponding amount in the program. LDB PNP should be given in program attributes.
    REPORT RPABAP06.
    TABLES:PERNR.
    INFOTYPES:0008.
    DATA: BEGIN OF WAGETYPES,
       LGA LIKE P0008-LGA01,
       BET LIKE P0008-BET01,
       ANZ LIKE P0008-ANZ01,
       EIN LIKE P0008-EIN01,
       OPK LIKE P0008-OPK01,
      END OF WAGETYPES.
    DATA:total type P0008-BET01.
    GET PERNR.
    RP_PROVIDE_FROM_LAST P0008 SPACE PN-BEGDA PN-ENDDA.
    DO 20 TIMES VARYING WAGETYPES-LGA FROM P0008-LGA01 NEXT P0008-LGA02
                VARYING WAGETYPES-BET FROM P0008-BET01 NEXT P0008-BET02.
    IF WAGETYPES-LGA IS INITIAL.
    EXIT.
    ELSE.
    TOTAL = TOTAL + WAGETYPES-BET.
    WRITE: / WAGETYPES-LGA, WAGETYPES-BET.
    ENDIF.
    ENDDO.
    WRITE TOTAL.
    Thanks
    Venkat.O

  • Z function modules for OLE

    Hi all,
    Is there any Z function modules for OLE, which will download the data directly to Excel with 2 sheets.
    Regards,
    Shalini

    Hi Shalini Reddy
    there is no FM  but code is there... u can see...
    *& Report  YOLE_FOR_EXCEL
    REPORT  yole_for_excel.
    *REPORT ZTEST_BYW.
    OLE specific include file
    INCLUDE ole2incl.
    INCLUDE excel__c.
    data definitions of OLE objects with type ole2_object
    PARAMETERS: p_filenm(80) LOWER CASE OBLIGATORY
    DEFAULT 'd:\temp\report_tsl.xls'.
    DATA: g_tmp_workbook TYPE ole2_object.
    DATA: g_tmp_worksheets TYPE ole2_object.
    DATA: g_tmp_worksheet1 TYPE ole2_object.
    DATA: g_tmp_worksheet2 TYPE ole2_object.
    DATA: g_pc_template LIKE rcgfiletr-ftappl
    VALUE 'd:\temp\mmr_rpt_tsl_tmp.xls'.
    DATA: g_excel TYPE ole2_object.
    DATA: g_workbooks TYPE ole2_object.
    DATA: g_workbook TYPE ole2_object.
    DATA: g_worksheets TYPE ole2_object.
    DATA: g_worksheet TYPE ole2_object.
    DATA: g_cell TYPE ole2_object.
    DATA: g_cell1 TYPE ole2_object.
    DATA: g_cell2 TYPE ole2_object.
    DATA: g_cellrange TYPE ole2_object.
    DATA: g_font TYPE ole2_object.
    DATA: g_interior TYPE ole2_object.
    DATA: g_borders TYPE ole2_object.
    DATA: g_first_ws VALUE 'Y'.
    DATA: g_row TYPE i.
    DATA: g_col TYPE i.
    definition of loop counter
    DATA: i TYPE i VALUE '5'.
    DATA: BEGIN OF t_sheet1 OCCURS 1,
    col1(10),
    col2(20),
    END OF t_sheet1.
    DATA: BEGIN OF t_sheet2 OCCURS 1,
    col1(10),
    col2(20),
    END OF t_sheet2.
    START-OF-SELECTION.
      PERFORM prepare_data.
      PERFORM download_to_excel.
    END-OF-SELECTION.
    call method of excel 'QUIT'.
    it is now possible to leave the EXCEL application
    remark: you have to go to the EXCEL application and answer the
    popup dialog screen
    *& Form PREPARE_DATA
    FORM prepare_data.
      t_sheet1-col1 = 'A1'.
      t_sheet1-col2 = 'A2'.
      APPEND t_sheet1.
      t_sheet1-col1 = 'B1'.
      t_sheet1-col2 = 'B2'.
      APPEND t_sheet1.
      t_sheet2-col1 = 'Y1'.
      t_sheet2-col2 = 'Y2'.
      APPEND t_sheet2.
      t_sheet2-col1 = 'Z1'.
      t_sheet2-col2 = 'Z2'.
      APPEND t_sheet2.
    ENDFORM. " PREPARE_DATA
    *& Form DOWNLOAD_TO_EXCEL
    FORM download_to_excel.
      PERFORM open_excel.
      PERFORM add_worksheet1.
      PERFORM add_worksheet2.
      PERFORM open_template_file.
      PERFORM close_excel.
      WRITE: / 'End of program'.
    ENDFORM. " DOWNLOAD_TO_EXCEL
    *& Form FILL_CELL
    *& FORM routine, which fills the specified cell in the EXCEL sheet
    *& with the given value
    FORM fill_cell USING i_row TYPE i
    i_col TYPE i
    i_value
    i_fontbold
    i_digit
    i_wraptext
    i_horizon_align
    i_vertical_align.
      DATA: l_str TYPE string.
      CALL METHOD OF g_excel 'CELLS' = g_cell
        EXPORTING #1 = i_row
        #2 = i_col.
      SET PROPERTY OF g_cell 'VALUE' = i_value.
      IF i_fontbold = 'X'.
        GET PROPERTY OF g_cell 'Font' = g_font.
        SET PROPERTY OF g_font 'Bold' = 1.
      ENDIF.
      IF NOT i_wraptext IS INITIAL.
        SET PROPERTY OF g_cell 'WrapText' = 1.
      ENDIF.
      IF NOT i_horizon_align IS INITIAL.
        IF i_horizon_align = 'L'.
          SET PROPERTY OF g_cell 'HorizontalAlignment' = xlleft.
        ELSEIF i_horizon_align = 'R'.
          SET PROPERTY OF g_cell 'HorizontalAlignment' = xlright.
        ELSEIF i_horizon_align = 'C'.
          SET PROPERTY OF g_cell 'HorizontalAlignment' = xlcenter.
        ENDIF.
      ENDIF.
      IF NOT i_vertical_align IS INITIAL.
        IF i_vertical_align = 'T'.
          SET PROPERTY OF g_cell 'VerticalAlignment' = xltop.
        ELSEIF i_vertical_align = 'B'.
          SET PROPERTY OF g_cell 'VerticalAlignment' = xlbottom.
        ELSEIF i_vertical_align = 'C'.
          SET PROPERTY OF g_cell 'VerticalAlignment' = xlcenter.
        ENDIF.
      ENDIF.
    To set number format for cell
      IF i_digit <> ''.
        IF i_value IS INITIAL AND i_digit <> '%'.
          SET PROPERTY OF g_cell 'VALUE' = ''.
        ELSE.
    Set number format for cell with number
          IF i_digit = '1'.
            SET PROPERTY OF g_cell 'NumberFormat' = '#,###.0 '.
          ELSEIF i_digit = '2'.
            SET PROPERTY OF g_cell 'NumberFormat' = '#,##0.00 '.
          ELSEIF i_digit = '%'.
            SET PROPERTY OF g_cell 'NumberFormat' = '#,##0.00% '.
          ELSE.
            SET PROPERTY OF g_cell 'NumberFormat' = '#,### '.
          ENDIF.
        ENDIF.
      ENDIF.
      ADD 1 TO i_col.
    ENDFORM.                    "FILL_CELL
    *& Form OPEN_EXCEL
    FORM open_excel.
      DATA: l_cnt TYPE i.
    create object excel of OLE class 'EXCEL.APPLICATION'
      CREATE OBJECT g_excel 'EXCEL.APPLICATION'.
      CALL METHOD OF g_excel 'WORKBOOKS' = g_workbooks.
      CALL METHOD OF g_workbooks 'ADD' = g_workbook.
      GET PROPERTY OF g_workbook 'Worksheets' = g_worksheets.
      GET PROPERTY OF g_excel 'ACTIVESHEET' = g_worksheet.
      SET PROPERTY OF g_excel 'DISPLAYALERTS' = 0.
      GET PROPERTY OF g_worksheets 'Count' = l_cnt.
      l_cnt = l_cnt - 1.
    Delete unwanted worksheets
      DO l_cnt TIMES.
        GET PROPERTY OF g_excel 'ACTIVESHEET' = g_worksheet.
        CALL METHOD OF g_worksheet 'DELETE'.
      ENDDO.
    ENDFORM. " OPEN_EXCEL
    *& Form CLOSE_EXCEL
    FORM close_excel.
      SET PROPERTY OF g_excel 'VISIBLE' = 1.
      CALL METHOD OF g_workbook 'SAVEAS'
        EXPORTING #1 = p_filenm.
    quit Excel and free all OLE objects
    call method of g_excel 'QUIT'.
      FREE OBJECT g_interior.
      FREE OBJECT g_borders.
      FREE OBJECT g_font.
      FREE OBJECT g_cell.
      FREE OBJECT g_cell1.
      FREE OBJECT g_cell2.
      FREE OBJECT g_cellrange.
      FREE OBJECT g_excel.
      FREE OBJECT g_workbooks.
      FREE OBJECT g_workbook.
      FREE OBJECT g_worksheets.
      FREE OBJECT g_worksheet.
    ENDFORM. " CLOSE_EXCEL
    *& Form ADD_WORKSHEET
    FORM add_worksheet USING i_name.
    Add new worksheet
      IF g_first_ws <> 'N'.
        g_first_ws = 'N'.
        GET PROPERTY OF g_excel 'ACTIVESHEET' = g_worksheet.
      ELSE.
        CALL METHOD OF g_worksheets 'Add' = g_worksheet.
      ENDIF.
      SET PROPERTY OF g_worksheet 'NAME' = i_name.
      g_row = 1.
      g_col = 1.
    ENDFORM. " ADD_WORKSHEET
    *& Form ADD_WORKSHEET1
    FORM add_worksheet1.
      PERFORM add_worksheet USING 'Test 1'.
    fill line in EXCEL sheet with headerlines of table columns
      g_col = 1.
      PERFORM fill_cell USING g_row g_col 'My First Worksheet' 'X' ''
      PERFORM merge_cell USING g_row 1 g_row 4.
      PERFORM set_border USING g_row 1 g_row 4 4 ''.
      ADD 1 TO g_row.
      g_col = 1.
      PERFORM fill_cell USING g_row g_col 'ID'(001) 'X' '' '' '' ''.
      PERFORM fill_cell USING g_row g_col 'Name'(002) 'X' '' '' '' ''.
      PERFORM fill_cell USING g_row g_col 'Telephon'(003) 'X' '' '' '' ''.
      PERFORM fill_cell USING g_row g_col 'Rabatt'(004) 'X' '' '' '' ''.
    loop at customr table and print values into EXCEL sheet
      ADD 1 TO g_row.
      LOOP AT t_sheet1.
        g_col = 1.
        PERFORM fill_cell USING g_row g_col t_sheet1-col1 '' '' '' '' ''.
        PERFORM fill_cell USING g_row g_col t_sheet1-col2 '' '' '' '' ''.
        ADD 1 TO g_row.
      ENDLOOP.
      g_col = 4.
      PERFORM set_border USING 1 1 g_row g_col '' 4.
    ENDFORM. " ADD_WORKSHEET1
    *& Form ADD_WORKSHEET2
    FORM add_worksheet2.
      PERFORM add_worksheet USING 'Test 2'.
    fill line in EXCEL sheet with headerlines of table columns
      g_col = 1.
      PERFORM fill_cell USING g_row g_col 'My Second Worksheet' 'X' ''
      PERFORM merge_cell USING g_row 1 g_row 4.
      PERFORM set_border USING g_row 1 g_row 4 1 'X'.
      PERFORM set_color USING g_row 1 g_row 4 'LT'.
      ADD 1 TO g_row.
      g_col = 1.
      PERFORM fill_cell USING g_row g_col 'ID'(001) 'X' '' '' '' ''.
      PERFORM fill_cell USING g_row g_col 'Name'(002) 'X' '' '' '' ''.
      PERFORM fill_cell USING g_row g_col 'Telephon'(003) 'X' '' '' '' ''.
      PERFORM fill_cell USING g_row g_col 'Rabatt'(004) 'X' '' '' '' ''.
    loop at customr table and print values into EXCEL sheet
      ADD 1 TO g_row.
      LOOP AT t_sheet2.
        g_col = 1.
        PERFORM fill_cell USING g_row g_col t_sheet2-col1 '' '' '' '' ''.
        PERFORM fill_cell USING g_row g_col t_sheet2-col2 '' '' '' '' ''.
        ADD 1 TO g_row.
      ENDLOOP.
      g_col = 4.
      PERFORM set_border USING 1 1 g_row g_col 2 'X'.
      ADD 4 TO g_row.
      g_col = 1.
      PERFORM fill_cell USING g_row g_col 'This is a wrap text' 'X' ''
      'X' 'C' 'T'.
      PERFORM fill_cell USING g_row g_col 'Vertical - Bottom' 'X' ''
      '' 'L' 'T'.
      ADD 4 TO g_row.
      g_col = 1.
      PERFORM fill_cell USING g_row g_col 'Amount 1' 'X' '' '' '' ''.
      PERFORM fill_cell USING g_row g_col '100.04' '' 'X' '' '' ''.
      ADD 1 TO g_row.
      g_col = 1.
      PERFORM fill_cell USING g_row g_col 'Amount 2' 'X' '' '' '' ''.
      PERFORM fill_cell USING g_row g_col '200.01' '' 'X' '' '' ''.
      ADD 1 TO g_row.
      g_col = 1.
      PERFORM fill_cell USING g_row g_col 'Total' 'X' '' '' '' ''.
      PERFORM fill_cell USING g_row g_col '=SUM(B13:B14)' 'X' 'X' '' '' ''.
      PERFORM fill_cell USING g_row g_col '0.00' 'X' 'X' '' '' ''.
      PERFORM copy_cell USING g_row 2 17 5 25 8.
    ENDFORm. " ADD_WORKSHEET2
    *& Form MERGE_CELL
    FORM merge_cell USING i_row1 i_col1
    i_row2 i_col2.
      CALL METHOD OF g_excel 'Cells' = g_cell1
        EXPORTING #1 = i_row1
        #2 = i_col1.
      CALL METHOD OF g_excel 'Cells' = g_cell2
        EXPORTING #1 = i_row2
        #2 = i_col2.
      CALL METHOD OF g_excel 'Range' = g_cellrange
        EXPORTING #1 = g_cell1
        #2 = g_cell2.
      CALL METHOD OF g_cellrange 'Merge'.
    ENDFORM. " MERGE_CELL
    *& Form SET_BORDER
    FORM set_border USING i_row1 i_col1
    i_row2 i_col2
    i_thickness
    i_allborders.
      CALL METHOD OF g_excel 'Cells' = g_cell1
        EXPORTING #1 = i_row1
        #2 = i_col1.
      CALL METHOD OF g_excel 'Cells' = g_cell2
        EXPORTING #1 = i_row2
        #2 = i_col2.
      CALL METHOD OF g_excel 'Range' = g_cellrange
        EXPORTING #1 = g_cell1
        #2 = g_cell2.
      IF i_allborders IS INITIAL.
        CALL METHOD OF g_cellrange 'BorderAround'
        EXPORTING #1 = 1 "Continuous line
        #2 = i_thickness. "Thickness: 1 - Normal, 4 - Thick
      ELSE.
        GET PROPERTY OF g_cellrange 'Borders' = g_borders.
        SET PROPERTY OF g_borders 'LineStyle' = '1'.
        SET PROPERTY OF g_borders 'Weight' = i_thickness.
      ENDIF.
    ENDFORM. " SET_BORDER
    *& Form SET_COLOR
    FORM set_color USING i_row1 i_col1
    i_row2 i_col2
    i_color.
      DATA: l_colorindex TYPE i.
      CASE i_color.
        WHEN 'BK'.
          l_colorindex = 1. "Black
        WHEN 'BR'.
          l_colorindex = 53. "Brown
        WHEN 'OG'.
          l_colorindex = 52. "Olive Green
        WHEN 'DG'.
          l_colorindex = 51. "Dark Green
        WHEN 'DT'.
          l_colorindex = 49. "Dark Teal
        WHEN 'DB'.
          l_colorindex = 11. "Dark Blue
        WHEN 'ID'.
          l_colorindex = 55. "Indigo
        WHEN 'G4'.
          l_colorindex = 56.                                    "Gray 80%
        WHEN 'DR'.
          l_colorindex = 9. "Dark Red
        WHEN 'OR'.
          l_colorindex = 46. "Orange
        WHEN 'DY'.
          l_colorindex = 12. "Dark Yellow
        WHEN 'GR'.
          l_colorindex = 10. "Green
        WHEN 'TL'.
          l_colorindex = 14. "Teal
        WHEN 'BL'.
          l_colorindex = 5. "Blue
        WHEN 'BY'.
          l_colorindex = 47. "Blue Gray
        WHEN 'G3'.
          l_colorindex = 16.                                    "Gray 50%
        WHEN 'RD'.
          l_colorindex = 3. "Red
        WHEN 'LO'.
          l_colorindex = 45. "Light Orange
        WHEN 'LI'.
          l_colorindex = 43. "Lime
        WHEN 'SG'.
          l_colorindex = 50. "Sea Green
        WHEN 'AQ'.
          l_colorindex = 42. "Aqua
        WHEN 'LB'.
          l_colorindex = 41. "Light Blue
        WHEN 'VL'.
          l_colorindex = 13. "Violet
        WHEN 'G2'.
          l_colorindex = 48.                                    "Gray 40%
        WHEN 'PK'.
          l_colorindex = 7. "Pink
        WHEN 'GD'.
          l_colorindex = 44. "Gold
        WHEN 'YL'.
          l_colorindex = 6. "Yellow
        WHEN 'BG'.
          l_colorindex = 4. "Bright Green
        WHEN 'TQ'.
          l_colorindex = 8. "Turquoise
        WHEN 'SB'.
          l_colorindex = 33. "Sky Blue
        WHEN 'PL'.
          l_colorindex = 54. "Plum
        WHEN 'G1'.
          l_colorindex = 15.                                    "Gray 25%
        WHEN 'RS'.
          l_colorindex = 38. "Rose
        WHEN 'TN'.
          l_colorindex = 40. "Tan
        WHEN 'LY'.
          l_colorindex = 36. "Light Yellow
        WHEN 'LG'.
          l_colorindex = 35. "Light Green
        WHEN 'LT'.
          l_colorindex = 34. "Light Turquoise
        WHEN 'PB'.
          l_colorindex = 37. "Pale Blue
        WHEN 'LV'.
          l_colorindex = 39. "Lavender
        WHEN 'WH'.
          l_colorindex = 2. "White
        WHEN OTHERS.
          l_colorindex = 2. "White
      ENDCASE.
      CALL METHOD OF g_excel 'Cells' = g_cell1
        EXPORTING #1 = i_row1
        #2 = i_col1.
      CALL METHOD OF g_excel 'Cells' = g_cell2
        EXPORTING #1 = i_row2
        #2 = i_col2.
      CALL METHOD OF g_excel 'Range' = g_cellrange
        EXPORTING #1 = g_cell1
        #2 = g_cell2.
      GET PROPERTY OF g_cellrange 'Interior' = g_interior.
      SET PROPERTY OF g_interior 'ColorIndex' = l_colorindex.
    ENDFORM. " SET_COLOR
    *& Form COPY_CELL
    FORM copy_cell USING i_crow i_ccol
    i_prow1 i_pcol1
    i_prow2 i_pcol2.
      CALL METHOD OF g_excel 'Cells' = g_cell
        EXPORTING #1 = i_crow
        #2 = i_ccol.
      CALL METHOD OF g_cell 'Copy'.
      CALL METHOD OF g_excel 'Cells' = g_cell1
        EXPORTING #1 = i_prow1
        #2 = i_pcol1.
      CALL METHOD OF g_excel 'Cells' = g_cell2
        EXPORTING #1 = i_prow2
        #2 = i_pcol2.
      CALL METHOD OF g_excel 'Range' = g_cellrange
        EXPORTING #1 = g_cell1
        #2 = g_cell2.
      CALL METHOD OF g_worksheet 'Paste'
        EXPORTING #1 = g_cellrange.
    ENDFORM. " COPY_CELL
    *& Form OPEN_TEMPLATE_FILE
    FORM open_template_file.
      CALL METHOD OF g_workbooks 'Open' = g_tmp_workbook
        EXPORTING #1 = g_pc_template
        #2 = 2
        #3 = 0
        #4 = 1
        #5 = 0
        #6 = 0
        #7 = 1.
      CALL FUNCTION 'FLUSH'
        EXCEPTIONS
          OTHERS = 0.
      GET PROPERTY OF g_tmp_workbook 'Worksheets' = g_tmp_worksheets.
      GET PROPERTY OF g_tmp_worksheets 'Item' = g_tmp_worksheet1
      exporting #1 = 1.
      GET PROPERTY OF g_tmp_worksheets 'Item' = g_tmp_worksheet2
      exporting #1 = 2.
      CALL METHOD OF g_tmp_worksheet1 'Copy'
        EXPORTING #1 = g_worksheet.
      CALL METHOD OF g_tmp_worksheet2 'Copy'
        EXPORTING #1 = g_worksheet.
    call method of g_tmp_workbook 'Close'.
      CALL FUNCTION 'FLUSH'
        EXCEPTIONS
          OTHERS = 0.
    ENDFORM. " OPEN_TEMPLATE_FILE

  • Function Module for Sales items condition types

    Hi,
    I would like to get Sales item amount details based on condition types tax or discount.
    Is there any function module to output amount for sales item and condition type.
    Thanks in advance for your help.
    Thanks,
    Ramana

    hi
    i have vbeln and posnr
    my requirement is to calculate repricing for sales order.
    i am having problem with function pricing means what parameters to be passed in komp and komk structure.
    can you plz send me sample code if possible?
    thankx in advance.

  • Functional module for automatic creation of pur requisition & pur order

    hello,
    what is the functional module for automatic creation of puchase requisition and automatic creation of purchase order which we will assign in action box in service order processing management.
    please let me know as early as possible
    regards,
    rajesh kumar raju

    Hi,
             Please check with following.
    IDOC_INPUT_ACC_PURCHASE_REQUI
    IDOC_INPUT_ACC_PURCHASE_ORDER
    /ISDFPS/OR_PURCHASE_ORDER_CR
    BS01_PURCHASE_DOCUMENT_CREATE
    CO_MP_CREATE_PURCHASE_ORDER
    Thanks & Regards
    Sadhu Kishore

  • Function module for calculating planned and actual cost of production order

    Hi ,
    Do we have any standard function module for calculating planned and actual cost for production order?
    i need to implement this in a Z-report.
    Thanks
    Srini

    Hi,
    try below function module
    CRMCO_GET_PLAN_ACTUAL_COSTS
    CO_IH_GET_PLANNED_COSTS_TOTAL
    Regards,
    Sankaran

Maybe you are looking for