Converting date problem

hi,
I have a text filed.the textfield must take date value.for that I used the following code.
<h:inputText id="joiningdate" binding="#{Employee.field}" value="#{Employee.joiningDate}" valueChangeListener="#{Employee.dateChanged}" >
<f:convertDateTime pattern="yyyy/MM/dd" />
</h:inputText>
and I wrote the error messages in managed bean only.
If I give month value greater than 12 then it must show error.is it possible to show error message

Instead of what you are currently doing, why not write a custom converter or validator. This way, you are not subjected to one single date form (because you can validate many in one method) and you are not limited by the awkward Java date rules if you don't want to be.

Similar Messages

  • A Full DTP is converted into delta DTP and facing some data problem

    Recently Full DTP(DSO to DSO) is converted into delta DTP , we are facing some data problem in first request.Some data in D2 are not updated properly after just converted in full to delta. Please let me know if you have any idea.
    Example :
    DSO : D1
    DSO : D2
    Previously FULL DTP D1->D2
    Now Delta DTP D1->D2

    Hi,
    First time run of delta DTP will extract all the records from the source...
    As u have already run the Full load and followed by delta,i guess u can use direct change log option...
    rgds,

  • Problem with converting data types

    Hi Experts,
    I am stuck up with a little problem, i need your help
    i am converting all the data types to CHAR but i am not getting the expected data out.........
    My code is as below...where do i go wrong...
    LOOP AT <T_ITAB> ASSIGNING <FIELD>.
    DO.
       ASSIGN COMPONENT SY-INDEX OF STRUCTURE <FIELD> TO <RECORD>.
       IF SY-SUBRC = 0.
          LV_FIELD = <RECORD>.
          N = STRLEN( LV_FIELD ).
          IF N = '8'.
               IF LV_FIELD IS NOT INITIAL.
                      LV_DATE = LV_FIELD.
                      CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
                              EXPORTING
                              DATE                     = LV_DATE
                             EXCEPTIONS
                                    PLAUSIBILITY_CHECK_FAILED = 1
                                    OTHERS                     = 2.
                             IF SY-SUBRC <> 0.
                                     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
                             ENDIF.
                         IF SY-SUBRC EQ 0.
                            CONCATENATE LV_FIELD+6(2) LV_FIELD+4(2) LV_FIELD+0(4) INTO LV_FIELD SEPARATED BY '.'.
                        ENDIF.
                ENDIF.
             ENDIF.
                IF LV_RECORD IS INITIAL.
                         LV_RECORD = LV_FIELD.
                ELSE.
                       CONCATENATE LV_RECORD LV_FIELD INTO LV_RECORD SEPARATED BY '  * '.
               ENDIF.
           ELSE.
         EXIT." DO
        ENDIF.
       ENDDO.
      APPEND LV_RECORD TO LT_OUTPUT.
    CLEAR LV_RECORD.
    ENDLOOP.
    THE TABLE LT_OUTPUT     LIKE     THENV(CHAR 255)
    My output looks some thing like this:
    04  36876   15.09.2011  39600   1999
    06  36960   15.09.2011  39600   2632
    07  36874   15.09.2011  39541   9232
    My expected output
    04    36.876  15.09.2011    39.600  1.999
    06    36.960  15.09.2011    39.600  2.632
    07    36.874  15.09.2011    39.541  9.232
    Regards
    sam

    At run time you can see all the data........ like what i have shown...
    but if you clearly see, DATE will be in the internal format..but if you print it, it will be in dd:mm:yyyy
    can you suggest me if i have a dynamic field symbol (table data) ,,,, How can i convert data types dynamically..
    if it is a static internal table i am achieving with WRITE TO statement.....but i have huge data in field symbols...
    Instead of all these , please specify the exact problem your are facing . What is it with date field ? . In SAP while printing the internal format will be converted to external. What is your requirement with this date field?
    My output looks some thing like this:
    04 36876 15.09.2011 39600 1999
    06 36960 15.09.2011 39600 2632
    07 36874 15.09.2011 39541 9232
    My expected output
    04 36.876 15.09.2011 39.600 1.999
    06 36.960 15.09.2011 39.600 2.632
    07 36.874 15.09.2011 39.541 9.232
    I dont see any problems mentioned in your date field. Both your actual and expected outputs reflects the same in date field.
    In SCN you will only get solutions if your question is precise.
    Kesav

  • LSMW problem during display converted data

    Dear Expert,
    We have problem in LSMW during display converted data.
    When using display converted data, the output will show many of rows based on data content.
    For example, contains 6 rows. But when we want to see details of the data for one row (example row 2) by double clicking on it, the problem occurs, the output will show the details of the data from the last row (row 6).
    Please your advice.
    Thanks and Regards

    Hi,
    There seems to be sorting issue. Do you have dependency on data while executing the script?
    how about reading the data , is it getting uploaded correctly?
    Regards

  • Problem in LSMW using IDOC in convert data step

    Hi,
    I am getting a Run-time error in CONVERT DATA step of LSMW using IDOC. The error diplayed is a syntax error. I am not able to figure out the error. Anybody having idea about this, please help me...
    The data is read successfully.
    Edited by: majualex on Nov 4, 2009 9:23 AM

    Error in the ABAP Application Program
    The current ABAP program "/SAPDMC/SAPLLSMW_OBJ_070" had to be terminated
      because it has
    come across a statement that unfortunately cannot be executed.
    The following syntax error occurred in program "/1CADMC/SAP_LSMW_CONV_00000051
      " in include "/1CADMC/SAP_LSMW_CONV_00000051 " in
    line 25:
    ""." expected after "DATA"."
    I think the pgm is standard ABAP program.....

  • Problems with converting date in one calendar into another.

    I am trying to convert, say, today's date into a Hebrew or Japanese calendar and put it into a form so it can be printed. I can convert date components but I can't get it so that I can use it with NSDateFormatter to print the date - it comes out as a Gregorian date even though printed from an NSDate object derived from a Hebrew calendar object.
    Is there any sample code I can look at?

    I have a compaq 3900 which I sync with ical. I use PocketmacPro.
    It is the smoothest sync give it a try.
    Isync all my callendars, contacts, transfer word and excell docs.
    There tech support is good to

  • How can I convert date in FOX (from DEC to date[DEC])

    Hi everyone!
    In my planning layout I have a field called "MYDATE" of the date-type "DEC: Calculation or amount field with comma and +/- sign" (-> BPS does not allow using DATS as date-type).
    Since I import that date from a different system, I have to use a temporary workaround field "WADATE" (WorkaroundDate) of type DEC (alternatively integer or float) which contains the date in a format YYYYMMDD (e.g. 20070604).
    How can I transfer the date from WADATE to MYDATE? I tried using FOX, but for some reason it does not work. When I use the following function, MYDATE remains empty:
    DATA TMPDATE TYPE F.
    DATA MYPROJECTS TYPE B906_PROJ.
    FOREACH MYPROJECTS.
    "MYDATE" is the field I want my date in
    "WADATE" is my workaround field that contains the date
    TMPDATE = {WADATE,000,0000000001,0000000001,001}.
    BREAK-POINT.
    {MYDATE,000,0000000001,0000000001,001} = TMPDATE.
    ENDFOR.
    Is it possible to solve my problem with FOX? Or do I have to work with an EXIT function?
    Best regards, Daniel

    Daniel,
    The better approach is the one Marc said but if you have tomake a work around work, I think you might need to try and define your temporary date variable as String and another for the converted date as of type of the final date.  I would not define any date type as float unless you can have part days and it is very important to have part days, integer might work by I would try String first myself.
    It has been a while but on a BW 3.5 project I had to do some manipulation to read the attribute value of material master data to get the launch date and use it to derive the start period (definited as type 0FISCPER) and proportion of month based on number of days remaining after launch date vs the # of days for the month.  I think I used string type function in FOX to derive some of the component...
    Hope this helps,
    mary

  • Error "Conversion failed when converting date and/or time from character string" to execute one query in sql 2008 r2, run ok in 2005.

    I have  a table-valued function that run in sql 2005 and when try to execute in sql 2008 r2, return the next "Conversion failed when converting date and/or time from character string".
    USE [Runtime]
    GO
    /****** Object:  UserDefinedFunction [dbo].[f_Pinto_Graf_P_Opt]    Script Date: 06/11/2013 08:47:47 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE   FUNCTION [dbo].[f_Pinto_Graf_P_Opt] (@fechaInicio datetime, @fechaFin datetime)  
    -- Declaramos la tabla "@Produc_Opt" que será devuelta por la funcion
    RETURNS @Produc_Opt table ( Hora datetime,NSACOS int, NSACOS_opt int)
    AS  
    BEGIN 
    -- Crea el Cursor
    DECLARE cursorHora CURSOR
    READ_ONLY
    FOR SELECT DateTime, Value FROM f_PP_Graficas ('Pinto_CON_SACOS',@fechaInicio, @fechaFin,'Pinto_PRODUCTO')
    -- Declaracion de variables locales
    DECLARE @produc_opt_hora int
    DECLARE @produc_opt_parc int
    DECLARE @nsacos int
    DECLARE @time_parc datetime
    -- Inicializamos VARIABLES
    SET @produc_opt_hora = (SELECT * FROM f_Valor (@fechaFin,'Pinto_PRODUC_OPT'))
    -- Abre y se crea el conjunto del cursor
    OPEN cursorHora
    -- Comenzamos los calculos 
    FETCH NEXT FROM cursorHora INTO @time_parc,@nsacos
    /************  BUCLE WHILE QUE SE VA A MOVER A TRAVES DEL CURSOR  ************/
    WHILE (@@fetch_status <> -1)
    BEGIN
    IF (@@fetch_status = -2)
    BEGIN
    -- Terminamos la ejecucion 
    BREAK
    END
    -- REALIZAMOS CÁLCULOS
    SET @produc_opt_parc = (SELECT dbo.f_P_Opt_Parc (@fechaInicio,@time_parc,@produc_opt_hora))
    -- INSERTAMOS VALORES EN LA TABLA
    INSERT @Produc_Opt VALUES (@time_parc,@nsacos, @produc_opt_parc)
    -- Avanzamos el cursor
    FETCH NEXT FROM cursorHora INTO @time_parc,@nsacos
    END
    /************  FIN DEL BUCLE QUE SE MUEVE A TRAVES DEL CURSOR  ***************/
    -- Cerramos el cursor
    CLOSE cursorHora
    -- Liberamos  los cursores
    DEALLOCATE cursorHora
    RETURN 
    END

    You can search the forums for that error message and find previous discussions - they all boil down to the same problem.  Somewhere in your query that calls this function, the code invoked implicitly converts from string to date/datetime.  In general,
    this works in any version of sql server if the runtime settings are correct for the format of the string data.  The fact that it works in one server and not in another server suggests that the query executes with different settings - and I'll assume for
    the moment that the format of the data involved in this conversion is consistent within the database/resultset and consistent between the 2 servers. 
    I suggest you read Tibor's guide to the datetime datatype (via the link to his site below) first - then go find the actual code that performs this conversion.  It may not be in the function you posted, since that function also executes other functions. 
    You also did not post the query that calls this function, so this function may not, in fact, be the source of the problem at all. 
    Tibor's site

  • How to Convert Date to Month in Database which is pointing to EBS, Not DWH.

    Hi Friends,
    We are planning to create reports in OBIEE and the Source is EBS. That means, we don’t want to depends on Datawarehouse and Informatica and OBIApps. We just create some reports and they are pointing to EBS database.
    For testing purpose, we have taken one HR Report and it containsthe below columns:
    Month (Dim)
    Revenue Per Employee Headcount (Fact)
    Average Cost per Active Workforce Headcount (Fact)
    In my little investigation, we found that Revenue column is coming from EBS: GL_BALANCES. And we configured W_Day_D base table in DAC as there is no Month column in EBS (Not sure).
    *** Coming to my problem, how can I call Month column in my database pointed to EBS. How to convert Date to Month in my database.
    I could be wrong but anyone please look into this issue.. How can I create columns for that exact OBI report in EBS database instead of DwH.
    Thanks in Advance..
    Raghu Nagadasari

    Hi Veeresh,
    You are right. Here, no need of using W_DAY_D table, but, we need all the stuff from the table and to explain my problem i have taken that table as an example. Now, we ran scripts for W_MONTH_D and W_DAY_D tables with EBS columns. So, we are getting data for the tables. In the same manner we have to create scripts for the below tables.
    W_GL_ACCOUNT_D
    W_GL_OTHER_F
    W_STATUS_D
    W_MCAL_DAY_D
    W_EMPLOYMENT_STAT_CAT_D
    W_WRKFC_BAL_A
    W_DAY_D (Completed)
    W_MONTH_D (Completed)
    But, we are not aware of EBS Tables and their columns much. So, we are back tracing from RpD --> DAC --> Info --> EBS for each and every column and its taking much time.
    So, if anyone of you facing the same issue, please share the EBS tables for the corresponding OBI tables, which are mentioned above.

  • Need help in converting date format

    Hi,
    Need help in converting date format from 'DD-MON-YYYY' to 'YYYY-MM-DD' in an .rtf template as I believe xml publisher supports the date format as 'YYYY-MM-DD' only.
    Thanks,
    Raj.

    I got the same problem, anyone know how to solve this problem? I allready found some date functions on http://blogs.oracle.com/xmlpublisher/2008/09/date_functions.html . I also tried <?xdoxslt:month_name(xdoxslt:get_month(xdofx:substr(NEED_BY_DATE, 4,3)), $_XDOLOCALE), 0, 'nl-NL')?>, but then it returns a namespace error (Caused by: oracle.xdo.parser.v2.XPathException: Namespace prefix 'xdofx' used but not declared.). Anyone know how to fix this?
    Edited by: user11165753 on 7-dec-2009 23:50

  • LSMW -File Name 'Converted Data': Max. 45 Characters. Remaining data saved

    Hi to all,
    I am facing the error message while specifying the file(7th step) in LSMW as below
    <b>File Name 'Converted Data': Max. 45 Characters. Remaining data saved.
    Message no. /SAPDMC/LSMW_OBJ_060028</b>
    Diagnosis
    Some import interfaces only accept file names (including path) that have a maximum of 45 characters.
    System Response
    All data except the file name of the converted data is saved.
    Procedure
    Adjust the file name for the converted data.
    I am not able proceed further steps in LSMW..
    please give your valuable suggation and solutions.
    Thanks in advance..
    Amar.

    HI
    Even I am facing this error. I tried from the root directory also. But I am getting the same error. (D:\LSMW\t.txt).
    Also,  another text file with the path name C:\Documents and Settings\Desktop\testmass.txt was uploaded without any problem.
    Can anyone please help in solving this?
    Regards

  • Convert data to MSWORD, MSEXCEL or PDF

    Hi,
    I have a requirement of sending SAP std report output as an attachment via email. I am thinking of using SUBMIT TO MEMORY or SPOOL and then get the data from there and convert and send as file attachment using SO_DOCUMENT_SEND_API1 or class CL_BCS. The file is required to be sent as MSWORD or MSEXCEL or PDF which can be decided by having a parameter on selection screen..
    But I am not sure on how to convert data after retrieving it back from Memory or spool. There are a few function modules to convert. Can anyone give me the names please in each case like
    For Spool to PDF function CONVERT_ABAPSPOOLJOB_2_PDF can be used
    For Spool to Excel ?
    For Spool to Word ?
    For memory to PDF ?
    For memory to Word ?
    For memory to Excel ?
    Regards,
    Vin

    Hi,
    I just had the same reuirement and i did it few days back . here is the code ...juz modify it accordingly.
    The program will send my ABAP report as a PDF attachment to the USER>
    REPORT  ZRMM0055  NO STANDARD PAGE HEADING
                      MESSAGE-ID ZZ
                      LINE-SIZE 255
                      LINE-COUNT 65.
                        TABLES DECLARATION                               *
    TABLES : MARD,          " Storage Location Data for Material
             MARC,          " Plant Data for Material
             MSEG,
             SSCRFIELDS.    " Fields on selection screens
                       Internal Tables declaration.                      *
    *---Internal Table to hold the MARD table data
    DATA : BEGIN OF IT_MARD OCCURS 0,
           MATNR LIKE MARD-MATNR,          " Material Number
           WERKS LIKE MARD-WERKS,          " Plant
           LGORT LIKE MARD-LGORT,          " Storage Location
           LMINB LIKE MARD-LMINB,          " Reorder Point
           LABST LIKE MARD-LABST,          " Stock at storage loc
           END OF IT_MARD.
    *---Internal table to hold data from MSEG, MKPF, MAKT
    DATA : BEGIN OF IT_MSEG OCCURS 0,
           MATNR LIKE MARD-MATNR,          " Material Number
           WERKS LIKE MARD-WERKS,          " Plant
           LGORT LIKE MARD-LGORT,          " Storage Location
           MENGE LIKE MSEG-MENGE,          " Quantity
           MEINS LIKE MSEG-MEINS,          " UOM
           LIFNR LIKE MSEG-LIFNR,          " Account Number of Vendor
           SHKZG LIKE MSEG-SHKZG,          " Credit/Debit Indicator
           EBELN LIKE EKPO-EBELN,
           MENGE1 LIKE EKPO-MENGE,         " Open PO qty
           EINDT LIKE EKET-EINDT,
           DISPO LIKE MARC-DISPO,          " MRP controller
           EKGRP LIKE MARC-EKGRP,          " Purchasing Group
           MAKTX LIKE MAKT-MAKTX,
           END OF IT_MSEG.
    *----Internal table to hold the data from EKPO and EKET table
    DATA : BEGIN OF IT_EKPO OCCURS 0,
           EBELN LIKE EKPO-EBELN,          " PO document
           EBELP LIKE EKPO-EBELP,          " Item
           MATNR LIKE MARD-MATNR,          " Material Number
           WERKS LIKE MARD-WERKS,          " Plant
           LGORT LIKE MARD-LGORT,          " Storage Location
           MENGE LIKE EKPO-MENGE,          " Quantity
           EINDT LIKE EKET-EINDT,          " Delivery Date
           END OF IT_EKPO.
    *--Internal Table to hold the final data
    DATA : BEGIN OF IT_FINAL OCCURS 0,
           MATNR LIKE MARD-MATNR,          " Material Number
           MAKTX LIKE MAKT-MAKTX,          " Material Description
           LMINB LIKE MARD-LMINB,          " Reorder Point
           MEINS LIKE MSEG-MEINS,          " UOM
           LABST LIKE MARD-LABST,          " On hand inventory at storageloc
           TOT_LABST LIKE MARD-LABST,      " Total On hand at plant
           ISSUE LIKE MSEG-MENGE,          " YTD issue
           RECEIPT LIKE MSEG-MENGE,        " YTD receipts
           DISPO LIKE MARC-DISPO,          " MRP controller
           EKGRP LIKE MARC-EKGRP,          " Purchasing Group
           MENGE LIKE EKPO-MENGE,          " Open PO Quantity
           EINDT LIKE EKET-EINDT,          " Next Delivery Date
           LIFNR LIKE MSEG-LIFNR,          " Vendor
           EBELN LIKE MSEG-EBELN,          " PO number
           END OF IT_FINAL.
    *----Internal table to hold YTD data
    DATA : BEGIN OF IT_YTD OCCURS 0,
           MENGE LIKE MSEG-MENGE,
           MEINS LIKE MSEG-MEINS,
           SHKZG LIKE MSEG-SHKZG,
           END OF IT_YTD.
    DATA : BEGIN OF X_MSEG,
           MBLNR LIKE MSEG-MBLNR,
           MJAHR LIKE MSEG-MJAHR,
           MATNR LIKE MARD-MATNR,          " Material Number
           WERKS LIKE MARD-WERKS,          " Plant
           LGORT LIKE MARD-LGORT,          " Storage Location
           MENGE LIKE MSEG-MENGE,          " Quantity
           MEINS LIKE MSEG-MEINS,          " UOM
           LIFNR LIKE MSEG-LIFNR,          " Account Number of Vendor
           SHKZG LIKE MSEG-SHKZG,          " Credit/Debit Indicator
           EBELN LIKE EKPO-EBELN,
           MENGE1 LIKE EKPO-MENGE,         " Open PO Qty
           EINDT LIKE EKET-EINDT,
           DISPO LIKE MARC-DISPO,          " MRP controller
           EKGRP LIKE MARC-EKGRP,          " Purchasing Group
           MAKTX LIKE MAKT-MAKTX,
           END OF X_MSEG.
    DATA: V_LMINB(16) TYPE C,
          S_LABST(16) TYPE C,
          V_TOT_LABST(16) TYPE C,
          S_ISSUE(16) TYPE C,
          S_RECEIPT(16) TYPE C,
          V_MENGE(16) TYPE C,
          V_EINDT(8) TYPE C.
    DATA: T_PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
                    VARIABLES DECLARATION                                *
    DATA : V_SUM TYPE MSEG-MENGE,      " Variable for adding GI's to Stock
           V_TEMP TYPE MSEG-MENGE,      " Variable for adding GI's to Stock
           V_TABIX TYPE SY-TABIX,      " Loop count
           V_ISSUE LIKE MSEG-MENGE,    " Variable for calculating YTD issues
           V_RECEIPT LIKE MSEG-MENGE,  " Var for Calculating YTD Receipts
           V_LABST LIKE MARD-LABST,    " Var for Total On hand inv at plant
           V_MJAHR LIKE MSEG-MJAHR,    " Variable for holding the Year
           f_color.
    *----Declaration to send Email
    DATA: IT_PDF          LIKE TLINE      OCCURS 10 WITH HEADER LINE,
          IT_XI_PDF       LIKE TLINE      OCCURS 0  WITH HEADER LINE,
          IT_HTML         LIKE SOLISTI1   OCCURS 0  WITH HEADER LINE,
          IT_XI_TEMP      LIKE BAPIQCMIME OCCURS 0  WITH HEADER LINE,
          IT_XI_MIME(255) TYPE C          OCCURS 0  WITH HEADER LINE.
    DATA:
       LS_DOCDATA    TYPE SODOCCHGI1,
       LT_OBJPACK    TYPE TABLE OF SOPCKLSTI1 WITH HEADER LINE,
       LT_OBJHEAD    TYPE TABLE OF SOLISTI1   WITH HEADER LINE,
       LT_OBJTXT     TYPE TABLE OF SOLISTI1   WITH HEADER LINE,
       LT_OBJBIN     TYPE TABLE OF SOLISTI1   WITH HEADER LINE,
       LT_RECLIST    TYPE TABLE OF SOMLRECI1  WITH HEADER LINE,
       LT_LISTOBJECT TYPE TABLE OF ABAPLIST   WITH HEADER LINE,
       LT_LISTOBJECTLN(1000) TYPE C,
       L_TAB_LINES TYPE I,
       L_ATT_TYPE  LIKE SOODK-OBJTP.
    DATA: IT_OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
    Internal table for Single List with Column Length 255
    DATA : IT_OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    Internal table for Single List with Column Length 255
    DATA : IT_OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    Internal table for Structure of the API Recipient List
    DATA : IT_RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
    Structure of the API Recipient List
    DATA: X_DOC_CHNG LIKE SODOCCHGI1.
                            SELECTION-SCREEN                             *
    SELECTION-SCREEN BEGIN OF BLOCK S1 WITH FRAME TITLE TEXT-001.
    PARAMETERS:
    P_WERKS  LIKE MARD-WERKS OBLIGATORY.     " Plant
    SELECT-OPTIONS:
    S_BUKRS  for mseg-bukrs,                 " Company  code
    S_LGORT  FOR MARD-LGORT OBLIGATORY,      " Storage Location
    S_MATNR  FOR MARD-MATNR,                 " Material Number
    S_DISPO  FOR MARC-DISPO,                 " MRP Controller
    S_DATE   FOR SY-DATUM DEFAULT SY-DATUM OBLIGATORY.  " Date Range
    SELECTION-SCREEN END OF BLOCK S1.
    SELECTION-SCREEN BEGIN OF BLOCK S2 WITH FRAME TITLE TEXT-002.
    PARAMETERS:
    P_MAIL  TYPE C AS CHECKBOX.                " Mail to user Group
    SELECT-OPTIONS:
    S_UNAME FOR SY-UNAME NO INTERVALS.         " Usergroup id
    SELECTION-SCREEN END OF BLOCK S2.
                         Initialization
    INITIALIZATION.
    AT S E L E C T I O N - S C R E E N
    AT SELECTION-SCREEN.
      CHECK SSCRFIELDS-UCOMM EQ 'ONLI'.
      PERFORM VALIDATE_MAIL.
      PERFORM VALIDATE_DATA.
                        START-OF-SELECTION                               *
    START-OF-SELECTION.
      PERFORM FETCH_DATA.
                         END-OF-SELECTION                                *
    END-OF-SELECTION.
      IF NOT IT_FINAL[] IS INITIAL.
        PERFORM DOWNLOAD_DISPLAY_REPORT.
      ENDIF.
                         TOP-OF-PAGE                                *
    TOP-OF-PAGE.
    PERFORM PAGE_HEADER.
    *&      Form  Fetch_DATA
          Pick data
    FORM FETCH_DATA .
      DATA : V_EBELN LIKE EKPO-EBELN,
             V_EBELP LIKE EKPO-EBELP,
             V_MENGE LIKE EKPO-MENGE,
             V_EINDT LIKE EKET-EINDT,
             V_DISPO LIKE MARC-DISPO,
             V_EKGRP LIKE MARC-EKGRP,
             V_MAKTX LIKE MAKT-MAKTX.
    *----Select data from MARD Table
      SELECT MATNR                  " Material Number
             WERKS                  " Plant
             LGORT                  " Storage Location
             LMINB                  " Reorder Point Level
             LABST                  " Stock with unrestricted use
             INTO TABLE IT_MARD
             FROM MARD
             WHERE MATNR  IN S_MATNR AND
                   WERKS  = P_WERKS . "AND
                  LGORT  IN S_LGORT.
                   D~LMINB <> SPACE .
      IF SY-SUBRC = 0.
        LOOP AT IT_MARD.
          CLEAR : V_EBELN, V_EBELP, V_MENGE, V_EINDT.
    *---select data from EKPO table
          SELECT EBELN
                 EBELP
                 MENGE
                 UP TO 1 ROWS
                 FROM EKPO
                 INTO (V_EBELN, V_EBELP, V_MENGE)
                 WHERE MATNR = IT_MARD-MATNR AND
                       WERKS = IT_MARD-WERKS AND
                       LGORT = IT_MARD-LGORT AND
                       BUKRS IN S_BUKRS AND
                       ELIKZ = SPACE.
          ENDSELECT.
          IF SY-SUBRC = 0.
            X_MSEG-EBELN = V_EBELN.
            X_MSEG-MENGE1 = V_MENGE.
            SELECT EINDT
                   UP TO 1 ROWS
                   FROM EKET
                   INTO V_EINDT
                   WHERE EBELN = V_EBELN AND
                         EBELP = V_EBELP.
            ENDSELECT.
            IF SY-SUBRC = 0.
              X_MSEG-EINDT = V_EINDT.
            ENDIF.
          ENDIF.
    *---Select Data from MARC table.
          CLEAR : V_DISPO, V_EKGRP.
          SELECT DISPO
                 EKGRP
                 UP TO 1 ROWS
                 FROM MARC
                 INTO (V_DISPO, V_EKGRP)
                 WHERE MATNR = IT_MARD-MATNR AND
                       WERKS = IT_MARD-WERKS AND
                       DISPO IN S_DISPO.
          ENDSELECT.
          IF SY-SUBRC = 0.
            X_MSEG-DISPO = V_DISPO.
            X_MSEG-EKGRP = V_EKGRP.
          else.
          continue.
          ENDIF.
    *---select Material Description from MAKT
          CLEAR V_MAKTX.
          SELECT SINGLE MAKTX
                 FROM MAKT
                 INTO V_MAKTX
                 WHERE MATNR = IT_MARD-MATNR AND
                       SPRAS = SY-LANGU.
          IF SY-SUBRC = 0.
            X_MSEG-MAKTX = V_MAKTX.
          ENDIF.
    *----Select data from MSEG Table
          SELECT MBLNR
                 MJAHR
                 MATNR                  " Material Number
                 WERKS                  " Plant
                 LGORT                  " Storage Location
                 MENGE                  " Quantity
                 MEINS                  " UOM
                 LIFNR                  " Account No of Vendor
                 SHKZG                  " Credit/Debit Indicator
                 FROM MSEG
                 INTO X_MSEG
                 WHERE MATNR = IT_MARD-MATNR AND
                       WERKS = IT_MARD-WERKS AND
                       LGORT = IT_MARD-LGORT AND
                       BUKRS IN S_BUKRS.
    *---Subroutine to check whether the document is in the given date range
            PERFORM CHECK_DATE.
          ENDSELECT.
        ENDLOOP.
      ELSE.
        STOP.
      ENDIF.
    *----Select YTD receipts and Issues to date from MSEG
      CLEAR : V_MJAHR, V_ISSUE, V_RECEIPT.
      IF S_DATE[] IS NOT INITIAL.
        V_MJAHR = S_DATE+3(4).
      ELSE.
        V_MJAHR = SY-DATUM+0(4).
      ENDIF.
      SELECT MENGE
             MEINS
             SHKZG
             FROM MSEG
             INTO TABLE IT_YTD
             WHERE WERKS = P_WERKS AND
                   MJAHR = V_MJAHR.
    *--Calculating YTD receipts and Issues
      IF SY-SUBRC = 0.
        LOOP AT IT_YTD.
          IF IT_YTD-SHKZG = 'S'.
            V_ISSUE = V_ISSUE + IT_YTD-MENGE.
          ELSE.
            V_RECEIPT = V_RECEIPT + IT_YTD-MENGE.
          ENDIF.
        ENDLOOP.
        IT_FINAL-ISSUE = V_ISSUE.
        IT_FINAL-RECEIPT = V_RECEIPT.
      ENDIF.
    *-----Logic for printing the material
      LOOP AT IT_MSEG.
        V_TABIX = SY-TABIX.
        AT NEW MATNR.
    *----Logic for calculation of Total On hand inv at plant.
    *---Sum of all MARD-LABST.
          CLEAR V_LABST.
          LOOP AT IT_MARD WHERE MATNR = IT_MSEG-MATNR.
            V_LABST = V_LABST + IT_MARD-LABST.
          ENDLOOP.
          IT_FINAL-TOT_LABST = V_LABST.
        ENDAT.
        AT NEW LGORT.
          CLEAR : V_SUM.
        ENDAT.
        READ TABLE IT_MARD WITH KEY MATNR = IT_MSEG-MATNR
                                    WERKS = IT_MSEG-WERKS
                                    LGORT = IT_MSEG-LGORT.
        IF SY-SUBRC = 0 AND IT_MARD-LMINB > 0.
    *---Logic for adding/Subtracting GR/GI
          IF V_TABIX = 1.
            IF IT_MSEG-SHKZG = 'S'.
              V_TEMP = IT_MARD-LABST + IT_MSEG-MENGE.
            ELSE.
              V_TEMP = IT_MARD-LABST - IT_MSEG-MENGE.
            ENDIF.
          ENDIF.
          IF IT_MARD-LABST < IT_MARD-LMINB.  "Stock < Reorder Point
    *---Check for any goods receipts on the given day. SHKZG = 'S'
            IF IT_MSEG-SHKZG = 'S' .
              IF V_TABIX = 1.
                V_SUM = V_TEMP.
              ELSE.
                V_SUM = V_SUM + IT_MSEG-MENGE.
              ENDIF.
              IF V_SUM < IT_MARD-LMINB.
                IT_FINAL-MATNR = IT_MARD-MATNR.
                IT_FINAL-MAKTX = IT_MSEG-MAKTX.
                IT_FINAL-LMINB = IT_MARD-LMINB.
                IT_FINAL-MEINS = IT_MSEG-MEINS.
                IT_FINAL-LABST = IT_MARD-LABST.
                IT_FINAL-DISPO = IT_MSEG-DISPO.
                IT_FINAL-EKGRP = IT_MSEG-EKGRP.
                IT_FINAL-LIFNR = IT_MSEG-LIFNR.
                IT_FINAL-ISSUE = V_ISSUE.
                IT_FINAL-RECEIPT = V_RECEIPT.
                IT_FINAL-TOT_LABST = V_LABST.
                IT_FINAL-EBELN = IT_MSEG-EBELN.
                IT_FINAL-MENGE = IT_MSEG-MENGE1.
                IT_FINAL-EINDT = IT_MSEG-EINDT.
                APPEND IT_FINAL.
                CLEAR IT_FINAL.
              ENDIF.
            ELSE.
    *--- If there is no Goods receipt mov't type on the given day, then
    *---add all the goods issues to the storage location stock.
    *---Goos Receipt = 'S' , Goods Issue = 'H'.
              IF V_TABIX = 1.
                V_SUM = V_TEMP.
              ELSE.
                V_SUM = V_SUM - IT_MSEG-MENGE.
              ENDIF.
              IF V_SUM < IT_MARD-LMINB.
                IT_FINAL-MATNR = IT_MARD-MATNR.
                IT_FINAL-MAKTX = IT_MSEG-MAKTX.
                IT_FINAL-LMINB = IT_MARD-LMINB.
                IT_FINAL-MEINS = IT_MSEG-MEINS.
                IT_FINAL-LABST = IT_MARD-LABST.
                IT_FINAL-DISPO = IT_MSEG-DISPO.
                IT_FINAL-EKGRP = IT_MSEG-EKGRP.
                IT_FINAL-LIFNR = IT_MSEG-LIFNR.
                IT_FINAL-ISSUE = V_ISSUE.
                IT_FINAL-RECEIPT = V_RECEIPT.
                IT_FINAL-TOT_LABST = V_LABST.
                IT_FINAL-EBELN = IT_MSEG-EBELN.
                IT_FINAL-MENGE = IT_MSEG-MENGE1.
                IT_FINAL-EINDT = IT_MSEG-EINDT.
                APPEND IT_FINAL.
                CLEAR IT_FINAL.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " Fetch_DATA
    *&      Form  check_date
          text
    FORM CHECK_DATE .
      DATA: LV_BLDAT LIKE MKPF-BLDAT.
      SELECT SINGLE BLDAT
             FROM MKPF
             INTO LV_BLDAT
             WHERE MBLNR = X_MSEG-MBLNR AND
                   MJAHR = X_MSEG-MJAHR AND
                   BLDAT IN S_DATE.
      IF SY-SUBRC = 0.
        MOVE : X_MSEG-MATNR TO IT_MSEG-MATNR,
               X_MSEG-WERKS TO IT_MSEG-WERKS,
               X_MSEG-LGORT TO IT_MSEG-LGORT,
               X_MSEG-MENGE TO IT_MSEG-MENGE,
               X_MSEG-MEINS TO IT_MSEG-MEINS,
               X_MSEG-LIFNR TO IT_MSEG-LIFNR,
               X_MSEG-SHKZG TO IT_MSEG-SHKZG,
               X_MSEG-EBELN TO IT_MSEG-EBELN,
               X_MSEG-MENGE1 TO IT_MSEG-MENGE1,
               X_MSEG-EINDT TO IT_MSEG-EINDT,
               X_MSEG-DISPO TO IT_MSEG-DISPO,
               X_MSEG-EKGRP TO IT_MSEG-EKGRP,
               X_MSEG-MAKTX TO IT_MSEG-MAKTX.
        APPEND IT_MSEG.
        CLEAR IT_MSEG.
      ENDIF.
    ENDFORM.                    " check_date
    *&      Form  PAGE_HEADER
         To Print page header and other details
    FORM PAGE_HEADER .                                          "#EC CALLED
    *---Page header
      ULINE AT /1(150).
      FORMAT COLOR COL_BACKGROUND INTENSIFIED ON .
      WRITE:/ 'Run Date:'(t08), SY-DATUM, 50 'Stanley Works'(t07),
             110 'Page No:'(t09), SY-PAGNO LEFT-JUSTIFIED.
      WRITE:/ 'Run Time:'(t10), SY-UZEIT, 47 SY-TITLE, 110 SY-UNAME.
      WRITE:/ 'Source  :'(t11), SY-SYSID, 110 SY-CPROG .
      ULINE AT /1(150).
      WRITE :/1 'Safety Stock Report for Plant :'(t13),P_WERKS.
    ENDFORM.                    "PAGE_HEADER
    *&      Form  VALIDATE_DATA
          Subroutine to Validate selection screen data
    FORM VALIDATE_DATA .
      DATA V_TEMP(20) TYPE C.                                   "#EC NEEDED
    *--Validation for Plant.
      CLEAR V_TEMP.
      SELECT SINGLE WERKS
             INTO V_TEMP
             FROM T001W
             WHERE WERKS = P_WERKS.
      IF SY-SUBRC NE 0.
        MESSAGE E001(ZZ) WITH 'Invalid Plant'(t03).             "#EC *
      ENDIF.
    *--Validation for Storage Location.
      CLEAR V_TEMP.
      IF NOT S_LGORT[] IS INITIAL.
        SELECT LGORT INTO V_TEMP UP TO 1 ROWS
               FROM T001L
               WHERE LGORT IN  S_LGORT.
        ENDSELECT.
        IF SY-SUBRC NE 0.
          MESSAGE E001(ZZ) WITH 'Invalid Storage Location'(t04).
        ENDIF.
      ENDIF.
    *--Validation for Material Number.
      CLEAR V_TEMP.
      IF NOT S_MATNR[] IS INITIAL.
        SELECT MATNR
               INTO V_TEMP
               UP TO 1 ROWS
               FROM MARA
               WHERE MATNR IN S_MATNR.
        ENDSELECT.
        IF SY-SUBRC NE 0.
          MESSAGE E001(ZZ) WITH 'Invalid Material Number'(t05).
        ENDIF.
      ENDIF.
    *--Validation for MRP controller.
      CLEAR V_TEMP.
      IF NOT S_DISPO[] IS INITIAL.
        SELECT  DISPO INTO V_TEMP UP TO 1 ROWS
                FROM T024D
                WHERE DISPO IN S_DISPO.
        ENDSELECT.
        IF SY-SUBRC NE 0.
          MESSAGE E001(ZZ) WITH 'Invalid MRP Controller'(t06).
        ENDIF.
      ENDIF.
    ENDFORM.                    " VALIDATE_DATA
    *&      Form  validate_mail
          Validate user id
    FORM VALIDATE_MAIL .
      IF P_MAIL = 'X' AND S_UNAME[] IS INITIAL.
        MESSAGE E001(ZZ) WITH 'Enter User Mail id'(t01).
      ENDIF.
    ENDFORM.                    " validate_mail
    *&      Form  SEND_MAIL
         Send email to SAP inbox
    FORM SEND_MAIL .
    Structures and internal tables for the send data
      DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2  WITH HEADER LINE,
            OBJHEAD LIKE SOLISTI1   OCCURS 1  WITH HEADER LINE,
            OBJBIN  LIKE SOLISTI1   OCCURS 0  WITH HEADER LINE,
            OBJTXT  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE,
            RECLIST LIKE SOMLRECI1  OCCURS 5  WITH HEADER LINE.
      DATA: DOC_CHNG LIKE SODOCCHGI1,
            TAB_LINES LIKE SY-TABIX.
    Data for the status output after sending
      DATA: SENT_TO_ALL LIKE SONV-FLAG.
      CLEAR: IT_RECLIST, IT_RECLIST[],
             IT_OBJTXT , IT_OBJTXT[],
             IT_OBJPACK, IT_OBJPACK[],
             IT_OBJBIN , IT_OBJBIN[],X_DOC_CHNG.
      LOOP AT IT_HTML.
        OBJBIN-LINE = IT_HTML-LINE.
        APPEND OBJBIN.
        CLEAR OBJBIN.
      ENDLOOP.
    Create the document which is to be sent
      DOC_CHNG-OBJ_NAME  = 'List'(012).
      DOC_CHNG-OBJ_DESCR = 'Mail'(m05).
    Heading
      OBJTXT-LINE = 'Safety Stock Report attached'(014).
      APPEND OBJTXT.
      CLEAR OBJTXT.
    Size
      DESCRIBE TABLE OBJTXT LINES TAB_LINES.
      READ TABLE OBJTXT INDEX TAB_LINES.
      DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    Fill the fields of the packing_list for the main document:
      CLEAR OBJPACK-TRANSF_BIN.
    The document needs no header (head_num = 0)
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
    Body
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'RAW'(m02).
      APPEND OBJPACK.
    Create the attachment (the list itself)
      DESCRIBE TABLE OBJBIN LINES TAB_LINES.
    Fill the fields of the packing_list for the attachment:
      OBJPACK-TRANSF_BIN = 'X'.
    Header
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
    Body
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'PDF'(m01).
      OBJPACK-OBJ_NAME = 'Attachment'(m03).
      OBJPACK-OBJ_DESCR = 'Mail with pdf Attachment'(018).
      OBJPACK-DOC_SIZE = TAB_LINES * 255.
      APPEND OBJPACK.
    *-Fill the mail recipient list
      LOOP AT S_UNAME.
        RECLIST-RECEIVER = S_UNAME-LOW.
        RECLIST-REC_TYPE = 'B'.
        APPEND RECLIST.
        CLEAR: RECLIST.
      ENDLOOP.
    *-Send the document by calling the SAPoffice API1 module for sending
    *-documents with attachments
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = DOC_CHNG
          PUT_IN_OUTBOX              = 'X'
          COMMIT_WORK                = 'X'
        IMPORTING
          SENT_TO_ALL                = SENT_TO_ALL
        TABLES
          PACKING_LIST               = OBJPACK
          OBJECT_HEADER              = OBJHEAD
          CONTENTS_BIN               = OBJBIN
          CONTENTS_TXT               = OBJTXT
          RECEIVERS                  = RECLIST
        EXCEPTIONS
          TOO_MANY_RECEIVERS         = 1
          DOCUMENT_NOT_SENT          = 2
          OPERATION_NO_AUTHORIZATION = 4
          OTHERS                     = 99.
      CASE SY-SUBRC .
        WHEN 0.
          MESSAGE s001 WITH 'Mail has been sent successfully'(003).
        WHEN OTHERS.
          MESSAGE s001 WITH 'Problem in sending the mail'(004).
      ENDCASE.
    ENDFORM.                    " SEND_MAIL
    *&      Form  download_display_report
          Download and dispaly report
    FORM DOWNLOAD_DISPLAY_REPORT .
      DATA: X_PARAMS TYPE PRI_PARAMS,
            V_VALID.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          IMMEDIATELY    = ' '
          LAYOUT         = 'X_65_255'
          NO_DIALOG      = 'X'
        IMPORTING
          OUT_PARAMETERS = X_PARAMS
          VALID          = V_VALID.
      IF V_VALID <> SPACE.
        NEW-PAGE PRINT ON PARAMETERS X_PARAMS NO DIALOG.
        PERFORM DISPLAY_REPORT.
        NEW-PAGE PRINT OFF.
        PERFORM CONV_TO_PDF_DOWNLOAD.
      ENDIF.
      PERFORM DISPLAY_REPORT.
    ENDFORM.                    " download_display_report
    *&      Form  DISPLAY_REPORT
          Display the report
    FORM DISPLAY_REPORT .
    ULINE AT /0(204).
      write:/1 sy-vline no-gap, (10)'Material'(032),
             sy-vline no-gap, (40)'Description'(031),
             sy-vline no-gap, (15)'Reorder pt'(030),
             sy-vline no-gap, (03)'BUn'(029),
             sy-vline no-gap, (13)'OnHandQty'(023),
             sy-vline no-gap, (13)'OnHandPlnt'(024),
             sy-vline no-gap, (13)'YTD issues'(025),
             sy-vline no-gap, (13)'YTD Receipts'(026),
             sy-vline no-gap, (08)'MRPcntrl'(027),
             sy-vline no-gap, (04)'POgrp'(028),
             sy-vline no-gap, (13)'POqty'(019),
             sy-vline no-gap, (10)'NextDelvDt'(020),
             sy-vline no-gap, (10)'Vendor'(021),
             sy-vline no-gap, (10)'PO#'(022),
             sy-vline no-gap.
    ULINE AT /0(204).
    loop at it_final.
      PERFORM COLOR_SWAP.
      write:/1 sy-vline no-gap, (10)it_final-matnr,
             sy-vline no-gap, (40)it_final-maktx,
             sy-vline no-gap, (15)it_final-lminb,     "#EC UOM_IN_MES
             sy-vline no-gap, (03)it_final-meins,
             sy-vline no-gap, (13)it_final-labst,     "#EC UOM_IN_MES
             sy-vline no-gap, (13)it_final-tot_labst, "#EC UOM_IN_MES
             sy-vline no-gap, (13)it_final-issue,     "#EC UOM_IN_MES
             sy-vline no-gap, (13)it_final-receipt,   "#EC UOM_IN_MES
             sy-vline no-gap, (08)it_final-dispo,
             sy-vline no-gap, (04)it_final-ekgrp,
             sy-vline no-gap, (13)it_final-menge,     "#EC UOM_IN_MES
             sy-vline no-gap, (10)it_final-eindt,
             sy-vline no-gap, (10)it_final-lifnr,
             sy-vline no-gap, (10)it_final-ebeln,
             sy-vline no-gap.
    endloop.
    ULINE AT /0(204).
    skip 2.
    WRITE:/ '******End of Report*******'.
    ENDFORM.                    " DISPLAY_REPORT
    *&      Form  CONV_TO_PDF_DOWNLOAD
          Convert to PDF
    FORM CONV_TO_PDF_DOWNLOAD .
      DATA: V_NUMBYTES TYPE I,
            V_SPOOLNO TYPE TSP01-RQIDENT.
      CLEAR   IT_PDF.
      REFRESH IT_PDF.
      WAIT UP TO 2 SECONDS.
      V_SPOOLNO = SY-SPONO.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          SRC_SPOOLID   = V_SPOOLNO
          NO_DIALOG     = ' '
        IMPORTING
          PDF_BYTECOUNT = V_NUMBYTES
        TABLES
          PDF           = IT_PDF.
      IF SY-SUBRC = 0.    "#EC *
        PERFORM PAGE_FORMAT.
      ENDIF.
    ENDFORM.                    " CONV_TO_PDF_DOWNLOAD
    *&      Form  page_format
       Format the page
    FORM PAGE_FORMAT .
      DATA : L_LINES       TYPE I,
             L_TEMP(500)   TYPE C,
             L_OFFSET      TYPE P,
             L_LINESLEN(2) TYPE P,
             L_MIMELEN(2)  TYPE P,
             L_TABIX       LIKE SY-TABIX.
      CLEAR : IT_XI_PDF,
              IT_XI_TEMP.
      REFRESH : IT_XI_PDF,
                IT_XI_TEMP.
      IT_XI_PDF[] = IT_PDF[].
    Reformat the line to 255 characters wide (code from SAP)
      CLEAR: L_TEMP, L_OFFSET, IT_XI_TEMP.
      DESCRIBE TABLE IT_XI_PDF   LINES  L_LINES.
      DESCRIBE FIELD IT_XI_PDF   LENGTH L_LINESLEN IN CHARACTER MODE.
      DESCRIBE FIELD IT_XI_TEMP  LENGTH L_MIMELEN IN CHARACTER MODE.
      LOOP AT IT_XI_PDF.
        L_TABIX = SY-TABIX.
        MOVE IT_XI_PDF TO L_TEMP+L_OFFSET.
        IF L_TABIX = L_LINES.
          L_LINESLEN = STRLEN( IT_XI_PDF ).
        ENDIF.
        L_OFFSET = L_OFFSET + L_LINESLEN.
        IF L_OFFSET GE L_MIMELEN.
          CLEAR IT_XI_TEMP.
          IT_XI_TEMP = L_TEMP(L_MIMELEN).
          APPEND IT_XI_TEMP.
          SHIFT L_TEMP BY L_MIMELEN PLACES.
          L_OFFSET = L_OFFSET - L_MIMELEN.
        ENDIF.
        IF L_TABIX = L_LINES.
          IF L_OFFSET GT 0.
            CLEAR IT_XI_TEMP.
            IT_XI_TEMP = L_TEMP(L_OFFSET).
            APPEND IT_XI_TEMP.
          ENDIF.
        ENDIF.
      ENDLOOP.
      CLEAR : IT_XI_MIME,
              IT_XI_MIME[].
      LOOP AT IT_XI_TEMP.
        IT_XI_MIME(255) = IT_XI_TEMP-LINE.
        APPEND IT_XI_MIME.
        CLEAR  IT_XI_MIME.
      ENDLOOP.
    Final Data
      CLEAR : IT_HTML,
              IT_HTML[].
      IT_HTML[] = IT_XI_MIME[].
    For sending mail
      PERFORM SEND_MAIL .
    ENDFORM.                    " page_format
    Form        : color_swap
    Description : Subroutine for color
    form color_swap.
    if flag is set
      if f_color eq 'X'.
        clear f_color.
    switch off the intensity
        format color col_normal intensified off.
      else.
    if flag is not set.
        f_color = 'X'.
    switch on the intensity
        format color col_normal intensified on.
      endif.
    endform.                    " color_swap

  • LSMW - Read Data not showing in Converted Data

    Hi,
    I am using LSMW to load data from a flat file (via recording).  I have it working except I have one issue.  When I display the data in read data all fields are showing.  No errors popup when I select convert data.  When I select display converted data the last few fields are missing.  Any ideas why or how to fix this?
    Any help is appreciated as I do not know how to proceed.
    Thanks,
    Annette
    Edited by: Annette Ameel on Dec 4, 2008 5:37 PM

    HI Bush,
    Currently I am also facing the same problem. In "display read data" it is showing all the field values. No error msg in "convert data". But only 2 fields are displaying in "display converted data". not showing any values in rest of the fields. Kindly suggest me how you fixed this problem

  • Question about get web service result in actionscript and convert data format

    Hi, All
    I have question about how to get dataset from web services
    and put it in tree structure. I have 2 questions about this:
    1, How can I get data correctly in actionscript?
    I have no problem to get data by
    <mx:ArrayCollection id="acFolder"
    source="{mx.utils.ArrayUtil.toArray(MyGServices.getFolder.lastResult)}"
    />
    And display in datagrid.
    But when I try to use
    public function
    handleFolderContents(event:mx.rpc.events.ResultEvent):void{
    arData=mx.utils.ArrayUtil.toArray(event.result);
    acData=new ArrayCollection(arData);
    input.text=acData.getItemAt(0).id;
    Seems I can’t get data, it always say:
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    2, how to convert data format
    I get data from web service and want to convert it to tree
    structure, as mention below:
    I get:
    <Array>
    <id>111</id>
    <Name>Production1</Name>
    </Array>
    <Array>
    <id>222</id>
    <Name>Production2</Name>
    </Array>
    Convert to:
    <mx:XMLList id="treeData">
    <node>
    <node label="Production1" data="111">
    <node label="Production2" data="222"/>
    </node>
    </node>
    </mx:XMLList>
    Please help me.
    Thanks.

    First, don't specify the package path in the argument
    declaration. Instead import the event object:
    import mx.rpc.events.ResultEvent;
    The docs state this emphatically.
    Second, try "lastResult", in place of "result":
    arData=mx.utils.ArrayUtil.toArray(event.lastResult); // I am
    not positive about this. I maybe recall reading that result was ok
    for the event object, but maybe not.
    Finally, why do you want to convert the xml? You certainly
    could, but it would be a manual process, recursively reading the
    existing xml nodes and building the new structure, but again, why?
    Just use a labelFunction if necessary to display the nodes as
    you wish.
    Tracy

  • [JHS10.1.3] Date problem

    Running into a date problem for a forms migration.
    I have a date field in the database, normal date field.
    The users want to be able to search on partial dates.
    So adding a between on this field will only generate two date selectors, which is not what they want.
    The format is like a year field, week field, day field.
    I could modify the query to return three extra numeric fields which convert the date to the right format ('yyyy', 'wi', 'dd' ) and then to number and generatie 3 between fields for this.
    This will generate the right layout, 6 input fields for a year from/to week from/to day from/to
    But the query will be like (year between x and x) and (week between x and x) and day (between x and x)
    This will not produce the right results.
    What is possible is a string manipulation of the whereclase in the method getViewCriteriaClause()
    And see if any/all of the fields are filled and build the query there, but this is not a 'clean' solution.
    Any idea on how I can solve this? Basicly a date field in the database, user wants to search that date field on year/week/day between year/week/day or a partial of that.
    This is the way it used to be in the forms application so I really want to give the same functionality with ADF.
    Anton

    Not sure if I completely understand what you said, but this is what I did ( it seems to work )
    All my viewobjects extends a new superviewobjectimp, this class has just 2 setters and getters, one for the datefield I want to search on and one for the partial name I gave the three attributes (<fixed name>Year <fixed name>Week <fixed name>Day).
    In the advancedSearch, in the loop trough the attributes I cast the viewobject to this superviewobjectimp. I can now check if the attribute contains the partial name. If this is the case I build my own string and add it to the viewCriteriaMap.
    One odd thing I found here is that it refuses to let me add a string like
    between to_date( '<startdate>', 'yyyy-mm-dd' ) and to_date( '<enddate>', 'yyyy-mm-dd' )Because if I do this, for some reason the attribute name will be wrapped in a to_char!
    If I just leave:
    between '<startdate>' and '<enddate>'It works, but I dont feel really safe about that, I would rather use the datecast to be sure.
    Any idea how this can be done?
    I also used the java Calendar class to transform a yyyy-iw-d to a yyyy-mm-dd because it seems I cant use 'iw' in a to_date(....). This also solved a problem with partial dates, java will autocomplete them for me.
    In other words if I only supply the year 2005 to 2006 it will auto search from 2005-1-1 - 2006-1-1, same for weeks.
    I have a lot of viewobjects which will require this, I'm trying to make it as solid as I can.
    Any suggestions?
    Anton

Maybe you are looking for

  • Yet Another Hard Drive Question from a Mac Newbie

    I apologize in advance for the length of this post -- as I state in the subject line, I am a complete Mac newbie. I just took delivery yesterday on a new (early 2008) Mac Pro. I purchased and installed an additional 8GB RAM, and ordered it with a 500

  • Basic questions about Mapviewer for OBIEE 11G

    Hello All.. I am pretty rookie in OBIEE and I have never worked with Mapviewer before.. I am going some POC right now in my environment and I want to experiment map reports in OBIEE.. My current OBIEE version is 11.1.1.6.5, Oracle DB version is 11.2.

  • How to access the SAP MDM destinations using mdm java api in 7.1

    hi, I have SAP MDM 7.1 SP11 and SAP Portal 7.3 and developing the custom webdynpro application using the  JAVA MDM API. I want configure the SAP MDM destinations in SAP Portal . How to access the MDM destinations in java code using API? and how to cr

  • AIR 17 - Sub Textures don't render ( black screen) on HTC Desire 610 ?

    Hello, AIR 17.0.0.124 critical bug on stage3D/Android/ HTC Desire 610 ( full spefication http://www.gsmarena.com/htc_desire_610-6160.php) I was using AIR 16 and all working correctly. In AIR 17 when I'm using SubTextures ( atlas textures) , stage 3D

  • Factory Calendar Maintained in Sales Org

    Hi I need one Information I have a sales org which is assigned to 10 plants. out of 10 plants some are assigned to different factory calendar. Now the requirement is to assign one of the calendar to the sales org. so my question is what will be the i