Date into Mon and year

Dear All,
I have date column.I have to display Month name and Year.
E.g
NOV 2011
DEC 2011
How will get this could you pls send me Syntex
Thanks

Hi Govind,
There are many ways to do,
1. you can use evaluate function to do that.
2. simple and better way is to overide the date formate of thet coloumn with the custom and then type MMM YYYY
Hope this helps you...

Similar Messages

  • Fiscal date DD-MON and year end looking forward

    Trying to figure out the best way to look forward to the new year and back to the old year when comparing sysdate to a table column fiscal that is formatted DD-MON. The process works perfectly during the year, since is uses current year when comparing data. But at the end of the year, we do not see anything past 12/31 or before 1/1 in a new year. Any ideas? I was thinking of declaring a couple of values and based on sysdate Sep, Oct, Nov, Dec to add 1 year to Fiscal months Jan, Feb, Mar, Apr so they appear as the next year and vice versa for the first months of a new year, subtract one year from the fiscals to indicate previous year. Has anyone worked on something like this in the past?

    Look in to this, i am substituting values for the year, so you will get idea.
    The fisccal date you have is month end all the time or it is all the dates?
    SQL> ed
    Wrote file afiedt.buf
      1  WITH T AS
      2    (SELECT '01-DEC' dt  FROM dual
      3     UNION ALL
      4    SELECT  '05-JUL'   FROM dual
      5     UNION ALL
      6    SELECT  '10-JAN'     FROM dual
      7     UNION ALL
      8    SELECT  '30-MAR'    FROM dual
      9     )
    10  --ens of data
    11  SELECT TO_DATE(dt||'-'||&y,'DD-MON-YYYY') fisc_date,
    12         TO_DATE(dt||'-'||&y,'DD-MON-YYYY')+180 NEW_DATE,
    13      ADD_MONTHS(TO_DATE(dt||'-'||&y,'DD-MON-YYYY'),6)
    14* FROM T
    SQL> /
    Enter value for y: 2008
    old  11: SELECT TO_DATE(dt||'-'||&y,'DD-MON-YYYY') fisc_date,
    new  11: SELECT TO_DATE(dt||'-'||2008,'DD-MON-YYYY') fisc_date,
    Enter value for y: 2008
    old  12:        TO_DATE(dt||'-'||&y,'DD-MON-YYYY')+180 NEW_DATE,
    new  12:        TO_DATE(dt||'-'||2008,'DD-MON-YYYY')+180 NEW_DATE,
    Enter value for y: 2008
    old  13:     ADD_MONTHS(TO_DATE(dt||'-'||&y,'DD-MON-YYYY'),6)
    new  13:     ADD_MONTHS(TO_DATE(dt||'-'||2008,'DD-MON-YYYY'),6)
    FISC_DATE NEW_DATE  ADD_MONTH
    01-DEC-08 30-MAY-09 01-JUN-09
    05-JUL-08 01-JAN-09 05-JAN-09
    10-JAN-08 08-JUL-08 10-JUL-08
    30-MAR-08 26-SEP-08 30-SEP-08

  • I want to keep date special month and year.

    I want to keep date special month and year.
    Example in sqlplus
    insert into area(input_time) values(to_date('MAR-04','MON-YY'));
    and select
    select input_time from area;
    the result
    01 MAR 2004
    in Oracle
    01-MAR-2004 12:00:00 AM
    I don't keep day, but I want to keep month and year.
    Can you do?
    Thanks.

    An Oracle date column must contain a date down to the second. If you don't specify a day or a time, it will default to the first of the month and midnight.
    If you want a column to only contain values at the beginning of a particular month, you can create a CHECK constraint that verifies that
    input_time = trunc( input_time, 'MM' )Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Select-options split date into month and assign to low and high

    Hi,
       In my select-options i am giving BEDAT (01.04.2004 TO 30.10.2005).I need to split month and
    year in separate fields.that is
    select-option_low-month in one field
    select-option_high-month in second field
    select-option_low-year in third field
    select-option_high-year in fourth field.
    Finally i need to move these four fields to it_final.
    select * from mbewh into corresponding fields of table it_mbewh
               for all entries in it_final where matnr = it_final-matnr and
               bwkey = it_final-werks and lpmon = ? and lfgja = ?
               and  bklas <> ' '.
    what input i have to give in lpmon and lfgja in select query to get for lfmon (04 to 10)
    and lfgja (2004 to 2005).
    suggest some ideas.

    Hi ,
    Can you please check the following code.
    Hi ,
    data :  l_low_yr(4),
              l_high_yr(4),
              l_low_mon(2),
              l_high_mon(2).
    Splitting the select option date to month and year into low and higher values
    l_low_yr        =   s_date-low+00(04). "  Year low value from the date range
    l_low_mon    =   s_date-low+04(02). "  Month low value from the date range
    l_high_yr      =   s_date-high+00(04)."  Year high value from the date range
    l_high_mon   =   s_date-high+04(02)." Month high value from the date range
    selecting the data from the table mbewh based on some conditions.
    select * from mbewh into corresponding fields of table it_mbewh
               for all entries in it_final where matnr = it_final-matnr and
               bwkey = it_final-werks and lfmon BETWEEN  l_low_mon and l_high_mon
    and lfgja BETWEEN l_low_yr and l_high_yr   and  bklas EQ  ' '.
    This select will retrive the desired data records from the table MBEWH.
    Please let me know if this works according to your requirement.
    Thanks and Regards
    Saritha

  • How to put the data into cache and distribute to nodeusing oracle coherence

    Hi Friends,
    i am having some random number data writing into file,from that file i am reading the data and i want to put into cache,how can i put the data into cache and partition this data into different nodes ( machines) to caluculate like S.D,variance..etc..like that.(or how can i implement montecarlo using oracle coherence) if any one know plz suggest me with flow.
    Thank you.
    regards
    chandra

    Hi robert,
    i have some bulk data in some arraylist or object format,i want to put into cache.
    i am not able to put into cache.i am using put method like cache.put(object key ,object value) ,but its not allowing to put into cache.
    can you please help me.i m sending my code.plz go thru and tel me whr i did mistake.
    package lab3;
    import com.tangosol.net.CacheFactory;
    import com.tangosol.net.NamedCache;
    import com.tangosol.net.cache.NearCache;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.PrintWriter;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Random;
    import java.util.Scanner;
    import javax.naming.Name;
    public class BlockScoleData {
         * @param args
         * s=The spot market price
         * x=the exercise price of the option
         * v=instantaneous standard deviation of s
         * r=risk free instantaneous rate of interest
         * t= time to expiration of the option
         * n – Number of MC simulations.
         private static String outputFile = "D:/cache1/sampledata2.txt";
    private static String inputFile = "D:/cache1/sampledata2.txt";
    NearCache cache;
    List<Credit> creditList = new ArrayList<Credit>();
         public void writeToFile(int noofsamples) {
              Random rnd = new Random();
              PrintWriter writer = null;
              try {
                   writer = new PrintWriter(outputFile);
                   for (int i = 1; i <= noofsamples; i++) {
                        double s = rnd.nextInt(200) * rnd.nextDouble();
                        //double x = rnd.nextInt(250) * rnd.nextDouble();
                        int t = rnd.nextInt(5);
                        double v = rnd.nextDouble() ;
                        double r = rnd.nextDouble() / 10;
                        //int n = rnd.nextInt(90000);
                        writer.println(s + " " + t + " " + v + " "
                                  + r );
              } catch (FileNotFoundException e) {
                   e.printStackTrace();
              } finally {
                   writer.close();
                   writer = null;
    public List<Credit> readFromFile() {
    Scanner scanner = null;
    Credit credit = null;
    // List<Credit> creditList = new ArrayList<Credit>();
    try {
    scanner = new Scanner(new File(inputFile));
    while (scanner.hasNext()) {
    credit = new Credit(scanner.nextDouble(), scanner.nextInt(),
    scanner.nextDouble(), scanner.nextDouble());
    creditList.add(credit);
    System.out.println("read the list from file:"+creditList);
    } catch (FileNotFoundException e) {
    e.printStackTrace();
    } finally {
    scanner.close();
    credit = null;
    scanner = null;
    return creditList;
    // public void putCache(String cachename,List<Credit> list){
    // cache = CacheFactory.getCache ( "VirtualCache");
    // List<Credit> rand = new ArrayList<Credit>();
    public Object put(Object key, Object value){
    cache = (NearCache)CacheFactory.getCache("mycache");
    String cachename = cache.getCacheName();
    List<Credit> cachelist=new ArrayList<Credit>();
    // Object key;
    //cachelist = (List<Credit>)cache.put(creditList,creditList);
    cache.put(creditList,creditList);
    System.out.println("read to the cache list from file:"+cache.get(creditList));
    return cachelist;
         public static void main(String[] args) throws Exception {
         NearCache cache = (NearCache)CacheFactory.getCache("mycache");
              new BlockScoleData().writeToFile(20);
         //new BlockScoleData().putCache("Name",);
              System.out
                        .println("New file \"myfile.csv\" has been created to the current directory");
         CacheFactory.ensureCluster();
         new BlockScoleData().readFromFile();
    System.out.println("data read from file successfully");
         List<Credit> creditList = new ArrayList<Credit>();
    new BlockScoleData().put(creditList,creditList);
         System.out.println("read to the cache list from file:"+cache.get(creditList));
    //cache=CacheFactory.getCache("mycache");
    //mycacheput("Name",new BlockScoleData());
    //     System.out.println("name of cache is :" +mycache.getCacheName());
    //     System.out.println("value in cache is :" +mycache.get("Name"));
    //     System.out.println("cache services are :" +mycache.getCacheService());
    regards
    chandra

  • Determining last date if period and year are given

    hi,
    what is the code if  the period and year are given and  to  print the  last date of that particular period and
    year.

    suppos period is perio = '2006002'
    Data sdate type sy-datum.
    Data edate type sy-datum.
    mm = perio+5(2).
    yy   = perio+0(4).
      concatenate yy mm '01' into sdate.
      call function 'SG_PS_GET_LAST_DAY_OF_MONTH'
        exporting
          day_in            = sdate
        importing
          last_day_of_month = edate.
    edate is your lst day of that period month.
    \[removed by moderator\]
    Regards
    Rajesh
    Edited by: Jan Stallkamp on Jul 21, 2008 2:35 PM

  • Adding Data into text and graphic frames - PLEASE CAN SOMEONE HELP?

    Hello Script buddies,
    Here is my script and I want to place data into the frames which I set up already in the inDesign template which loads correctly but unable to place the data into the frames, please refer to comments and if anyone can help me I will be very grateful.
    strFile = "C:\Users\dean.brooks\Documents\PoolSigns.xlsx"
    Set objExcel = CreateObject("Excel.Application")
    objExcel.Workbooks.Open strFile
    intRow = 2
    Set objSheet = objExcel.ActiveWorkbook.WorkSheets(1)
    ' Cycle through cells in Pool Sign Schedule to retreive data
    Do Until objSheet.Cells(intRow, 3).Value = ""
    PoolSignScheduleSignNo = Trim(objSheet.Cells(intRow, 1).Value)
    PoolSignScheduleTemplate = Trim(objSheet.Cells(intRow, 3).Value)
    PoolSignScheduleDepth = Trim(objSheet.Cells(intRow, 5).Value)
    PoolSignScheduleWarningFile = Trim(objSheet.Cells(intRow, 7).Value)
    PoolSignScheduleWarningText = Trim(objSheet.Cells(intRow, 8).Value)
    PoolSignScheduleRegFile = Trim(objSheet.Cells(intRow, 10).Value)
    PoolSignScheduleRegText = Trim(objSheet.Cells(intRow, 11).Value)
    ' Open InDesign Template that corresponds to PoolSignScheduleTemplate
    Set myInDesign = CreateObject("InDesign.Application.CS3")
    Set myDocument = myInDesign.Open(PoolSignScheduleTemplate)
    'Frames, these commands won't work, can someone please help??
    Set DepthMarker = myDocument.Textframes.Item
    DepthMarker.Contents = PoolSignScheduleDepth
    Set WarningText = myDocument.Textframes.Item
    WarningText.Contents = PoolSignScheduleWarningText
    Set WarningSymbol = myDocument.Graphicframes.Item
    WarningSymbol.Contents = PoolSignScheduleWarningFile
    Set RegText = myDocument.Textframes.Item
    RegText.Contents= PoolSignScheduleRegText
    ' Save InDesign File to C:\ to be moved manually later to appropriate location
    myDocument.Save("C:\Pools\PoolSign\PoolSignScheduleSignNo.indd")
    myDocument.Close
    intRow = intRow + 1
    Loop
    objExcel.Quit
    WScript.Quit

    Hi Robert,
    Your problem starts here:
    Set DepthMarker = myDocument.Textframes.Item
    ...which item? Item takes either an integer (the index of the item) or a string (the contents of the label property, if any).
    Next, however, is that you should be more specific about *where* the text frame is in the document. What page or spread is it on? Let's say that the frame "DepthMarker" is on page 1:
    Set DepthMarker = myDocument.Pages.Item(1).TextFrames.Item(1)
    If there's only one frame on that page, you're in great shape. If not, you need to come up with some way to differentiate one frame from another. Script labels are a great way to do this. Let's say you've used the Script Label panel to add the label "DepthMarker" to the relevant frame on page 1, and added the label "WarningText" to another frame. In that case, you'd use something like this:
    Set DepthMarker = myDocument.Pages.Item(1).TextFrames.Item("DepthMarker")(0)
    Set WarningText = myDocument.Pages.Item(1).TextFrames.Item("WarningText")(0)
    ...When you use a string to refer to a page item by its label, InDesign returns an array, so you need to get the first item in the array (assuming that there's only one page item on the page with that label).
    Hope this makes sense! I'm typing it off the top of my head because I have to go speak at a conference tomorrow and am short on time--but it should get you pointed in the right direction.
    Thanks,
    Ole

  • How to convert excel data into OTF and FAX

    Hi All,
    We have a requirement where in we have a smartform output (OTF data) converted into PDF, and an excel sheet, both being sent as email attachments.
    Now, we need to send the content of both the attachments as FAX.
    Since smartform output was OTF convertible, FAX was being sent using 'CONVERT_OTF_AND_FAX' FM.
    Can you let me know, if there is a possible way for manipulating the data that is converted to EXCEL, as OTF, and then FAX it?
    Or else, please suggest me an alternative way to FAX normal data (other than using 'CONVERT_OTF_AND_FAX').
    Thanks in advance,
    RAVI

    Hi All,
    We have a requirement where in we have a smartform output (OTF data) converted into PDF, and an excel sheet, both being sent as email attachments.
    Now, we need to send the content of both the attachments as FAX.
    Since smartform output was OTF convertible, FAX was being sent using 'CONVERT_OTF_AND_FAX' FM.
    Can you let me know, if there is a possible way for manipulating the data that is converted to EXCEL, as OTF, and then FAX it?
    Or else, please suggest me an alternative way to FAX normal data (other than using 'CONVERT_OTF_AND_FAX').
    Thanks in advance,
    RAVI

  • Sort date by week AND year

    How do I sort a bunch of date by week number and year? I have a bunch of date in the format IW-YYYY such as
    45-2010
    46-2010
    47-2010
    48-2010
    49-2010
    50-2010
    51-2010
    52-2010
    01-2011
    02-2011
    If I sort by week, I get the following which is not what I want. I want the above.
    01-2011
    02-2011
    45-2010
    46-2010
    47-2010
    48-2010
    49-2010
    50-2010
    51-2010
    52-2010
    Thanks,
    SM

    do you happen to have the underlying dates as well as the iw-yyyy format? If so, then it's just a matter of:
    order by trunc(actual_date_col, 'iw')If not, then you're going to have to do:
    order by to_number(substr(date_in_iw_format_col, 4)), to_number(substr(date_in_iw_format_col, 1, 2))eg:
    with sample_data as (select '45-2010' date_in_iw_format_col from dual union all
                         select '46-2010' date_in_iw_format_col from dual union all
                         select '47-2010' date_in_iw_format_col from dual union all
                         select '48-2010' date_in_iw_format_col from dual union all
                         select '49-2010' date_in_iw_format_col from dual union all
                         select '50-2010' date_in_iw_format_col from dual union all
                         select '51-2010' date_in_iw_format_col from dual union all
                         select '52-2010' date_in_iw_format_col from dual union all
                         select '01-2011' date_in_iw_format_col from dual union all
                         select '02-2011' date_in_iw_format_col from dual)
    select *
    from   sample_data
    order by to_number(substr(date_in_iw_format_col, 4)),
             to_number(substr(date_in_iw_format_col, 1, 2));
    DATE_IN_IW_FORMAT_COL
    45-2010             
    46-2010             
    47-2010             
    48-2010             
    49-2010             
    50-2010             
    51-2010             
    52-2010             
    01-2011             
    02-2011             

  • How to Convert internal table data into xml and xml data into internal tab

    Hi Guys,
          I have a requirement  that  i have to convert the internal table data into xml format and viceversa . for my requirement  i came to know that i have to use Transformations concept.  i done the converting the data from internal table into xml data by using standard Tranformations. My Question is 
    1) Can i use same Transformation to convert the xml data into abap internal table. if it is possible then how ???
    2) Is it possible using the standard Transformation  or I have to go for XSLT approach
    Please help me out from this guys,
    Thanks and Regards
    Koti

    Hi Koti,
    This is possible. There is a link. With the help of this link you can convert ABAP data to XML and vice versa.
    Link: http://www.heidoc.net/joomla/index.php?option=com_content&view=article&id=15:sapxslt&catid=22:sap-xslt&Itemid=31

  • Aggregated data for quatrter and year

    Hi,
         I have created a input schedule by using any by any template, I have account on row and time dimension on column, I input some test data for each month for some accounts, it work ok and I send the data successfully.
        I create another report using Evdre with the  row and column structure, I set both member set as "SELF AND DEP", however, when I run the report, I notice that the Quarter data and the year data is not correct, For example, Q1 data should the  summary of Jan,FEB and MAR, instead it show the same data as MAR, while the year data show the same data as Q4.
       Anybody know hot to fix this?
    Thanks

    I did another test as following:
    I copy a appshell from SAP standard AppShell, I generated some test data for each month using input schedule, then I build a evdre report, it work perfect,if i  choose PERIODIC, I get the quarter and year data summary the month or quarter, if I choose YTD, I get the year to date data,
    then I copy the my master data to  replace the orginal master data, I generated some test data, this time the report only show the YTD data no mater I choose PERIODC OR YTD for measure in CV.   This is verystrange.

  • Query for inserting data into table and incrementing the PK.. pls help

    I have one table dd_prohibited_country. prohibit_country_key is the primary key column.
    I have to insert data into dd_prohibited_country based on records already present.
    The scenario I should follow is:
    For Level_id 'EA' and prohibited_level_id 'EA' I should retreive the
    max(prohibit_country_key) and starting from the maximum number again I have to insert them
    into dd_prohibited_country. While inserting I have to increment the prohibit_country_key and
    shall replace the values of level_id and prohibited_level_id.
    (If 'EA' occurs, I have to replace with 'EUR')
    For Instance,
    If there are 15 records in dd_prohibited_country with Level_id 'EA' and prohibited_level_id 'EA', then
    I have to insert these 15 records starting with prohibit_country_key 16 (Afetr 15 I should start inserting with number 16)
    I have written the following query for this:
    insert into dd_prohibited_country
    select     
         a.pkey,
         b.levelid,
         b.ieflag,
         b.plevelid
    from
         (select
              max(prohibit_country_key) pkey
         from
              dd_prohibited_country) a,
         (select
    prohibit_country_key pkey,
              replace(level_id,'EA','EUR') levelid,
              level_id_flg as ieflag,
              replace(prohibited_level_id,'EA','EUR') plevelid
         from
              dd_prohibited_country
         where
              level_id = 'EA' or prohibited_level_id = 'EA') b
    My problem here is, I am always getting a.pkey as 15, because I am not incrementing it.
    I tried incrementing it also, but I am unable to acheive it.
    Can anyone please hepl me in writing this query.
    Thanks in advance
    Regards
    Raghu

    Because you are not incrementing your pkey. Try like this.
    insert
       into dd_prohibited_country
    select a.pkey+b.pkey,
         b.levelid,
         b.ieflag,
         b.plevelid
       from (select     max(prohibit_country_key) pkey
            from dd_prohibited_country) a,
         (select     row_number() over (order by prohibit_country_key)  pkey,
              replace(level_id,'EA','EUR') levelid,
              level_id_flg as ieflag,
              replace(prohibited_level_id,'EA','EUR') plevelid
            from     dd_prohibited_country
           where level_id = 'EA' or prohibited_level_id = 'EA') bNote: If you are in multiple user environment you can get into trouble for incrementing your PKey like this.

  • Date to Month and Year

    Hi Guru's
    We have a requirement of taking the input in date/month/year format in the DSO and the output to be displayed in the report is in month/year in the report.
    We dont want to do any changes/modification in the DSO level.
    Any ideas on how to do it.
    Thanks
    Krishna

    Hi,
    Using the following code you can do it, but in columns you want to display the month, it is mot possible, i.e. JAN-08, FEB-08 like that it is not possible without adding new InfoObject in DSO. It works for Text variables.
    'ZDATE_U' =   Normal Variable for Calday user entry.
    'ZMONTH_E'. = Customet Exit for Calmonth
    when 'ZMONTH_E'.
    DATA: zdtt(8) TYPE c,
                w_mnth(3) TYPE c.
          LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDATE_U'.
            CLEAR l_s_range.
            w_day = loc_var_range-low+6(2).
            w_mon  = loc_var_range-low+4(2).
            w_year = loc_var_range-low+0(4).
            CASE w_mon.
              WHEN '01'.
                w_mnth = 'JAN'.
              WHEN '02'.
                w_mnth = 'FEB'.
              WHEN '03'.
                w_mnth = 'MAR'.
              WHEN '04'.
                w_mnth = 'APR'.
              WHEN '05'.
                w_mnth = 'MAY'.
              WHEN '06'.
                w_mnth = 'JUN'.
              WHEN '07'.
                w_mnth = 'JUL'.
              WHEN '08'.
                w_mnth = 'AUG'.
              WHEN '09'.
                w_mnth = 'SEP'.
              WHEN '10'.
                w_mnth = 'OCT'.
              WHEN '11'.
                w_mnth = 'NOV'.
              WHEN '12'.
                w_mnth = 'DEC'.
            ENDCASE.
           CONCATENATE w_day '-' w_mnth '-' w_year INTO zdtt.
           CONCATENATE w_mnth '-' w_year INTO zdtt.
            CONCATENATE w_mnth '-' w_year+2(2) INTO zdtt.
            l_s_range-low = zdtt.
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
          ENDLOOP.
    Thanks
    Reddy

  • Converting binary data into pdf and placing into application server

    Hi Friends,
    I am able to get PO details in binary format and then using GUI_DOWNLOAD  with file type with 'bin' and file name with 'sample.pdf' extension , got  PO in pdf  format.
    But i need to get with pdf extension in application server without using GUI_DOWNLOAD.
    Is there any functional modules for it?
    With Warm Regards,
    Madhu!!!

    Hi Madhu,
    Check this code.
    *& Report  ZSPOOLTOPDF                                                 *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_sender LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Write statement to represent report output. Spool request is created
    if write statement is executed in background. This could also be an
    ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    Alternative way could be to submit another program and store spool
    id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
           to sap-spool
           spool parameters   %_print
           archive parameters %_print
           without spool dynpro
           and return.
    Get spool id from program called above
    IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        PERFORM convert_spool_to_pdf.
        PERFORM process_email.
        if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
        IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
          FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_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.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    Hope this resolves your query.
    <b>Reward all the helpful answers.</b>
    Regards

  • LOADING x12 834 data into database and 999 generation for received x12 file

    Hi All,
    I'm New to BizTalk, Im using BizTalk 2010 developer edition....I need to load the x12 834 enrollment data (few details) into database. I want to know the step by step procedure to do this. kindly help me.
    Also i need to know the 999 ackknowledgement generation for the received x12 file
    Thanks in advance.
    Rengaraj

    You need to Generate individual 834 enrollment message through de batching in EDIReceive pipeline .
    Once you get disassembled message you need map it with   insert stored procedure schema for inserting data in to SQL .
    For this first you need to create a table in SQL server with required columns and create a simple stored procedure to insert  data in to Table . Use Add Generate Item --> consume adapter service-->SQL binding -->Outbound operation and then
    select the Stored Procedure created to generate schema for it . Use the same schema while mapping from Debatched EDI message to SQL stored Procedure request.
    Thanks
    Abhishek

Maybe you are looking for

  • TS1369 since downloading updates for itunes I get MSVCR80.dll error message every time I try to access itunes?

    Since downloading updates for itunes I get MSVCR80.dll error message every time I try to start i-tunes. can anybody help please.

  • Determinating CPU patch version in 8.1.7.4. database

    How can I determinate currently installed CPU patch version in oracle 8.1.7.4 database (HP True64UNIX). (some alternativ for "opatch inventory" from higher versions of databases) Thanks.

  • 5800 Connection Manager is not working correctly

    I have my preferred connections setup with my home WLAN as priority, then my cell phone provider (ATT) as the last priority. The connection manager switches from my WLAN to ATT everytime I go out of range of my WLAN fully automatically. So that part

  • IDES Remote Access

    Hi there - I am a new member.  I have looked through FAQs and some of the forums but the volume/granularity of information is pretty daunting and I can't seem to find an answer to the simple question I have. I am looking to become a self-taught Certi

  • Java.exe capped at 50% CPU usage

    Hi forum, I have written a program that uses Java2D to draw an image. Each pixel in the image is determined by an equation. When I execute the program, java.exe seems to be capped at 50% CPU usage. It takes a long time to draw these images, so I woul