Validating keyboard input data

I am new to java and have a question regarding validating input.
I did check the FAQ for "Validating keyboard input data" but found no help.
I have to check that the keyboard input is only one of the following char a c,C,d,D
Ihave tried different conditional loops and statements but cannot get it right.
Could someone point me in the right direction.
I am using the latest java.
Thanx

well i think i am close but i can't figure out why i have an endless loop or how to fix it
System.out.print("Please enter the Costumer Type C or R: ");
String cosTypeTemp = scan.nextLine();
cosType = cosTypeTemp.charAt(0);
while (cosType != 'c' || cosType != 'C' || cosType != 'd' || cosType != 'D');
do
costumerType = 'N';
System.out.print("Wrong input please enter the Costumer Type c or r: ");
cosTypeTemp = scan.nextLine();
cosType = cosTypeTemp.charAt(0);
while (cosType != 'c' || cosType != 'C' || cosType != 'd' || cosType != 'D');
costumerType = cosType;
System.out.print("Please enter the Number of basic service connections: ");
System.out.print("Please enter the Costumer Type C or R: ");
String cosTypeTemp = scan.nextLine();
cosType = cosTypeTemp.charAt(0);
while (cosType != 'c' || cosType != 'C' || cosType != 'd' || cosType != 'D');
do
costumerType = 'N';
System.out.print("Wrong input please enter the Costumer Type c or r: ");
cosTypeTemp = scan.nextLine();
cosType = cosTypeTemp.charAt(0);
while (cosType != 'c' || cosType != 'C' || cosType != 'd' || cosType != 'D');
costumerType = cosType;
System.out.print("Please enter the Number of basic service connections: ");
numBsSrvConecs = scan.nextInt();
when i enter the correct data ( c, C, d, D) it goes into infinite loop and never reaches the next keyboard scan for System.out.print("Please enter the Costumer Type C or R: ");

Similar Messages

  • Philosophical Question: validation of input data

    This is a "best practices" sort of question...
    I came across this statement while going through the latest Tutorial (the tutorial is great, by the way): "The page author registers the validator on a component by nesting the validator's tag within the component's tag."
    It strikes me that field validation should be the responsibility of the model developers rather then the page authors. Intermixing validation logic with presentation logic seems like a violation of the spirit of the desire to separate the model from the view.
    Validation of a form's fields should be associated with the model rather then with the presentation. There may different presentations for the same model, and the validation rules should (more then likely) be consistent regardless of the presentation.
    Am I missing something?

    I've used Struts for years (and am very grateful), but
    I've always been bothered by the manual
    synchronization necessary between the XML, the Java,
    and the JSP. In the horrible bad old days of
    generating HTML from a servlet the compiler would
    catch dumb mistakes. Now we have to wait for run time
    errors. This worries me.It worries me, too. One of the arguments for using systems languages (like Java) to do web development, instead of scripting approaches (like ASP), is the compile-time error detection available in Java due to language features like strong type checking, etc. In ASP, you had to wait until runtime to find out you had typed a function name incorrectly, etc.
    Well, Microsoft has finally delivered ASP.NET, with strong type-checking in languages like C# and VB.NET. I've experimented with it quite a bit, and they really have worked hard on giving good diagnostic messages, and on catching things like naming discrepancies between components defined in the HTML (.aspx) and the corresponding C# source code (.aspx.cs) at page compile time.
    Meanwhile, the Java community seems to be moving in the opposite direction, introducing features like the JSTL (with its runtime Java introspection). Frameworks such as Struts and the new JavaServer Faces rely heavily on JSTL to avoid having to put Java expression scriptlets in the page, but you give up the compile-time type checking. Also, errors caused by naming differences between beans referenced both in .jsp files and in .java files are often hard to track down, because all you may get is a null pointer diagnostic or an empty value.
    I do think tools support will help with some of the XML - Java - JSP synchronization issues, when the vendors catch up, but the whole idea of splitting up an application into declarative (XML / JSP) and procedural (Java) sections tends to make for higher learning curves, and complicates debugging.
    I earnestly hope that, as we approach the final stages of the JSF reviews, much thought will be given to "making easy things easy". If this initiative is Sun's answer to Microsoft's ASP.NET, which it appears to be, the goal has to be to make Java web application programming accessible to the average developer, as well as making good developers more productive. Early error detection certainly belongs in there somewhere.
    Stephen

  • Sales order creation:  validations on input data in BDC

    HI,
    i am using document type, sales org, distr chan, division, Custommer po num, incoterms1, payment terms, material, quantity, plant, item category, partner role, partner number.
      kindly let me know what validations i need to make on these before uploading.

    try with this.
    BAPI_SALESORDER_SIMULATE and see the documentation.
    No BDC.
    Regards
    Prabhu

  • CS3 Language Keyboard Input Error

    Greetings All,
    I have been trouble-shooting this problem for a while, but still it is not resolved. Any help or ideas would be gladly received!
    Background: We have a correctly functioning installation of Win XP, and PS CS3 Extended which appears to work normally in every other regard. No obvious errors; no crashes, no start-up complaints; nothing seemingly out of order. I use several installed languages in Windows (EngUK, Russian, Swedish, etc). All of these work normally. All of my installed fonts work correctly in every application on the system except for CS3.
    There would appear to be something wrong with CS3's keyboard mapping in foreign languages. When typing with a non-English keyboard setting (any other language) and using TrueType fonts (not Open), only 'missing character' boxes appear in the artwork. The Layers menu displays the typed text correctly, but this will not appear in the artwork. If I use an old install of PS7, I can type using these same fonts correctly in any language. These layers can be imported into CS3, and these WILL display correctly on the artwork. However, the Layers menu in this case displays nonsensical characters. Ergo, I suspect that CS3's keyboard input data is errant.
    Where does PS3 keep its information regarding language / keyboard layout? It is possible to edit this file(s)? Are there any other ideas regarding this problem and what might be wrong?
    Thanks

    Unicode vs. non-Unicode. Turn off glyph substition in the character palette.
    Mylenium

  • Problem validating an two Input Date components !...

    Hi to all the users !. I would like to tell my problem... I have two input dates ("from" and "to") and I would like that the value from the "from" component isn't higher than the value from the "to" component... For that, I have use a validateDateTimeRange validator and set the "Maximum" value... My problem is that I don't get validated my inputdates components and additionally, when I select a date it appears with a strange format... Although I set the pattern to "dd/mm/yyyy" !... Let say... If I choose the 23th of July of 2012, the input date show "23/58/2012"... What would be the problem ?... Thankx !...

    Navaneetha: Thankx for your help !; I will check it right now... I didn't answer as I was having lunch ! :D Thankx again
    Suresh: A friend from another group told me that and the problem was solved !; anyway... Thankx for your time ! :d

  • ABAP - input data validation

    I have been trying to look through the forum for means of input data validation to no vail. It is necessary to validate data before saving in database. There is an interface IF_WD_VALIDATION out there which seems to handle this task but no more information is provided on how to use it. Does anyone know more about it?
    By validation, I mean verification of:
    data type
    data value (min value, max value)
    data dependence (a<b, or a>b)
    Your suggestion is appreciated.

    There is more solution to validate fields.
    If you import adaptiev RFC model, Dynpro will make validation.
    Secend vay is to put validation in setters function and raise exception if is not valide
    public void setName(String name)
      if(name.length() > 100) throw new Exception("name is to loong");
      this.name = name;
    or mabie more simpliest is to make boolean function check()
    If you want stop workflow in not valide case you can do with
    wdComponentAPI.getMessageManager().raiseException("message", true)

  • Help with date validation on input boxes.

    I need some help with date validation on input boxes.
    What I�m trying to create is a form where a user inputs dates and then the rest of the form calculates the other dates for them.
    i.e. � A user inputs 2 dates (A & B) and then a 3rd date which is 11 weeks before date B is calculated automatically.
    Is this possible and if so how do I do it ???
    Thanks

    Hi,
    to get third date try this:
    java.util.Date bDate = ...;
    Calendar yourCalendar = new GregorianCalendar();
    yourCalendar.setTime(bDate);
    yourCalendar.roll(Calendar.WEEK_OF_YEAR, -11);
    java.util.Date cDate = yourCalendar.getTime();Regards
    Ldinka

  • HT201406 1st. Gen iPad question:  the touch keyboard does not appear when attempting to input data into data fields - this happens while using all apps, ex. Notes, Google, Pages, etc..

    1st. Gen iPad question:  the touch keyboard does not appear when attempting to input data into data fields - this happens while using all apps, ex. Notes, Google, Pages, etc.. The cursor prompt is present.  Tapping screen just brings up the option to: "Select   Select All   Paste."   I have rebbooted with no change. 
    Message was edited by: Jimfromutah
    The problem was my connected bluetooth keyboard.

    1st. Gen iPad question:  the touch keyboard does not appear when attempting to input data into data fields - this happens while using all apps, ex. Notes, Google, Pages, etc.. The cursor prompt is present.  Tapping screen just brings up the option to: "Select   Select All   Paste."   I have rebbooted with no change. 
    Message was edited by: Jimfromutah
    The problem was my connected bluetooth keyboard.

  • Date picker for af:inputDate   is not picking up the correct input date

    view source:
    <af:inputDate value="#{bindings.DateField.attributeValue}" label="#{bindings.DateField.hints.label}"
    required="#{bindings.DateField.hints.mandatory}"
    valueChangeListener="#{pageFlowScope.CollectApplicantInformation.datesItemChanged}"
    columns="#{bindings.DateField.hints.displayWidth}" shortDesc="#{CustomTooltip[DateField]}"
    autoSubmit="true" helpTopicId="AppDt" id="DateField" simple="true">
    <f:validator binding="#{bindings.DateField.validator}"/>
    *<f:converter converterId="CustomConverter"/>*
    </af:inputDate>
    Here I am not using <af:ConvertDateTime> insted using customConverter, so what code changes do I need to make sure the date picker always picks the already existind date in the inputDate rather picking the current date?
    Here is my CustomConverter.java
    CustomConverter.java
    public class CustomConverter extends DateTimeConverter implements ClientConverter, Converter
    public Object getAsObject(FacesContext context, UIComponent component, String value)
    String dataType = (String) resolveExpression("#{bindings." + component.getId() + ".attributeDef.javaType.name}");
    if (dataType != null && !dataType.equalsIgnoreCase("oracle.jbo.domain.Date") && !dataType.equalsIgnoreCase("oracle.jbo.domain.Timestamp"))
    String test = null;
    if (context == null || component == null)
    throw new NullPointerException();
    if (value != null)
    // To solve DB transaction dirty issue, Check isEmpty and return null.
    if (value.isEmpty())
    return null;
    // the "value" is stored on the value property of the component.
    // The Unified EL allows us to check the type
    ValueExpression expression = component.getValueExpression("value");
    if (expression != null)
    Class<?> expectedType = expression.getType(context.getELContext());
    if (expectedType != null)
    System.out.println("expectedType Value:::" + expectedType.getName());
    // try to convert the value (Object) to the TYPE of the "value" property
    // of the underlying JSF component
    try
    return TypeFactory.getInstance(expectedType, value);
    catch (DataCreationException e)
    String errorMessage;
    if (expectedType.equals(CustomNumber.class))
    errorMessage = "You can enter only Numbers in this field";
    else
    errorMessage = e.getMessage();
    if (errorMessage != null)
    FacesContext ctx = FacesContext.getCurrentInstance();
    FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Invalid Format" , errorMessage);
    ctx.addMessage(component.getClientId(), fm);
    catch (CustomDomainException e)
    int errorCode = e.getErrorMessageCode();
    String[] errorMessage = e.getErrorMessageParams();
    if (errorCode == 7 && errorMessage != null)
    String msg = "Invalid " + errorMessage[0];
    FacesContext ctx = FacesContext.getCurrentInstance();
    FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Application Error: ", msg);
    ctx.addMessage(component.getClientId(), fm);
    catch (JboException e)
    Throwable cause = e.getCause();
    if (cause == null)
    cause = e;
    test = "not good format";
    throw e;
    return null;
    else
    return value != null? value: null;
    public String getAsString(FacesContext context, UIComponent component, Object value)
    return value != null? value.toString(): null;
    public String getClientLibrarySource(FacesContext context)
    return null;
    @Override
    public Collection<String> getClientImportNames()
    return Collections.emptySet();
    @Override
    public String getClientScript(FacesContext context, UIComponent component)
    String formatMask = (String) resolveExpression("#{bindings." + component.getId() + ".format}");
    if (formatMask != null)
    String dataType = (String) resolveExpression("#{bindings." + component.getId() + ".attributeDef.javaType.name}");
    if (dataType.equalsIgnoreCase("oracle.jbo.domain.Date") || dataType.equalsIgnoreCase("oracle.jbo.domain.Timestamp"))
    if (component == null)
    _LOG.severe("The component is null, but it is needed for the client id, so no script written");
    return null;
    // Add a JavaScript Object to store the datefield formats
    // on the client-side. We currently store the format string
    // for each and every field. It'd be more efficient to have
    // an array of formats, then store for each field the
    // index of the format, especially if we could delay outputting
    // these objects to when the <form> closes.
    String clientId = component.getClientId(context);
    if (clientId != null)
    // =-=AEW Only if Javascript...
    Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
    // this fetch could be at the place where we append, but has been
    // moved ahead to optimize use of StringBuilder
    String jsPattern = getJSPattern(context, component);
    String loc = _getLocaleString(context);
    // FIX - figure out size!!!
    // 127 chars for javascript + length of jspattern + locale + 12 chars for
    // tranforming to name in the worst case.
    StringBuilder buff = new StringBuilder(139 + jsPattern.length() + loc.length());
    if (requestMap.get(_PATTERN_WRITTEN_KEY) == null)
    requestMap.put(_PATTERN_WRITTEN_KEY, Boolean.TRUE);
    // only create the _dfs object if it doesn't exist, so we don't
    // wipe out _dfs[xxx] values if we ppr the first date field on a
    // page with multiple date fields.
    buff.append("if(window['_dfs'] == undefined){var _dfs=new Object();}if(window['_dl'] == undefined){var _dl=new Object();}");
    buff.append("_dfs[\"");
    buff.append(clientId);
    buff.append("\"]=");
    buff.append(jsPattern);
    buff.append(";");
    buff.append("_dl[\"");
    buff.append(clientId);
    buff.append("\"]=");
    buff.append(loc);
    buff.append(";");
    return buff.toString();
    else
    LOG.severe("NULLCLINET_ID_NO_SCRIPT_RENDERED");
    return null;
    else
    return null;
    else
    return null;
    private String _getLocaleString(FacesContext context)
    Locale dateTimeConverterLocale = getLocale();
    if (dateTimeConverterLocale != null)
    Locale defaultLocale = RenderingContext.getCurrentInstance().getLocaleContext().getFormattingLocale();
    if (!(dateTimeConverterLocale.equals(defaultLocale)))
    String loc = dateTimeConverterLocale.toString();
    StringBuffer sb = new StringBuffer(2 + loc.length());
    sb.append("'");
    sb.append(loc);
    sb.append("'");
    return (sb.toString());
    return "null";
    @Override
    @Deprecated
    public String getClientConversion(FacesContext context, UIComponent component)
    String formatMask = (String) resolveExpression("#{bindings." + component.getId() + ".format}");
    if (formatMask != null)
    String dataType = (String) resolveExpression("#{bindings." + component.getId() + ".attributeDef.javaType.name}");
    if (dataType.equalsIgnoreCase("oracle.jbo.domain.Date") || dataType.equalsIgnoreCase("oracle.jbo.domain.Timestamp"))
    String jsPattern = getJSPattern(context, component);
    Map<String, String> messages = new HashMap<String, String>();
    if (jsPattern != null)
    Class<?> formatclass = formatMask.getClass();
    System.out.println("FormatClass::" + formatclass);
    System.out.println(" Format Mask : " + formatMask);
    // SimpleDateFormat sdfDestination = new SimpleDateFormat(formatMask);
    String pattern = formatMask; //getPattern();
    if (pattern == null)
    pattern = getSecondaryPattern();
    String key = getViolationMessageKey(pattern);
    Object[] params = new Object[]
    { "{0}", "{1}", "{2}" };
    Object msgPattern = getMessagePattern(context, key, params, component);
    //if hintFormat is null, no custom hint for date, time or both has been specified
    String hintFormat = _getHint();
    FacesMessage msg = null;
    String detailMessage = null;
    if (msgPattern != null)
    msg = MessageFactory.getMessage(context, key, msgPattern, params, component);
    detailMessage = XhtmlLafUtils.escapeJS(msg.getDetail());
    Locale loc = context.getViewRoot().getLocale();
    SimpleDateFormat formatter = new SimpleDateFormat(pattern, loc);
    java.lang.Object obj = resolveExpression("#{bindings." + component.getId() + ".attributeValue}");
    String databaseDate=null;
    if(obj!=null)
    databaseDate = obj.toString();
    DateFormat df = new SimpleDateFormat(pattern,loc);
    System.out.println("DateComponent input value :::::::::::::::::::::::::"+databaseDate);
    Date today;
    try {
    // System.out.println("Before Conversion::::::::::::"+df.parse(databaseDate).toString());
    if(databaseDate!=null)
    today = df.parse(databaseDate);
    else
    today = new Date();
    System.out.println("After Conversion Date :::::::::::::::::::::::::::::"+today.toString());
    //Date today = new Date();
    String dt = formatter.format(today);
    String exampleString = dt;
    String escapedType = XhtmlLafUtils.escapeJS(getType().toUpperCase());
    StringBuilder outBuffer = new StringBuilder();
    outBuffer.append("new TrDateTimeConverter(");
    outBuffer.append(jsPattern);
    // loc = getLocale();
    if (loc != null)
    outBuffer.append(",'");
    outBuffer.append(loc.toString());
    outBuffer.append("','");
    else
    outBuffer.append(",null,'");
    outBuffer.append(exampleString);
    outBuffer.append("','");
    outBuffer.append(escapedType);
    outBuffer.append("'");
    if (msgPattern != null || hintFormat != null)
    messages.put("detail", detailMessage);
    messages.put("hint", hintFormat);
    outBuffer.append(',');
    // try
    // JsonUtils.writeMap(outBuffer, messages, false);
    // catch (IOException e)
    // outBuffer.append("null");
    outBuffer.append(')'); // 2
    return outBuffer.toString();
    catch(ParseException e)
    System.out.println("Parse Exception :::::::::::::::::::::"+e);
    return null;
    else
    // no pattern-matchable date
    return null;
    else
    return null;
    else
    return null;
    protected String getJSPattern(FacesContext context, UIComponent component)
    String jsPattern = null;
    String datePattern = (String) resolveExpression("#{bindings." + component.getId() + ".format}");
    if (datePattern != null)
    String secondaryPattern = getSecondaryPattern();
    if (datePattern != _NO_JS_PATTERN)
    int length = datePattern.length() * 2 + 2;
    if (secondaryPattern != null)
    length = length + 3 + secondaryPattern.length() * 2;
    StringBuilder outBuffer = new StringBuilder(length);
    jsPattern = _getEscapedPattern(outBuffer, datePattern, secondaryPattern);
    else
    jsPattern = datePattern;
    return jsPattern;
    private static void _escapePattern(StringBuilder buffer, String pattern)
    buffer.append('\'');
    XhtmlUtils.escapeJS(buffer, pattern);
    buffer.append('\'');
    private static String _getEscapedPattern(StringBuilder buffer, String pattern, String secondaryPattern)
    if (secondaryPattern != null)
    buffer.append('[');
    _escapePattern(buffer, pattern);
    if (secondaryPattern != null)
    buffer.append(",'");
    XhtmlUtils.escapeJS(buffer, secondaryPattern);
    buffer.append("']");
    return buffer.toString();
    private String _getHint()
    String type = getType();
    if (type.equals("date"))
    return getHintDate();
    else if (type.equals("both"))
    return getHintBoth();
    else
    return getHintTime();
    public static Object resolveExpression(String pExpression)
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application app = facesContext.getApplication();
    ExpressionFactory elFactory = app.getExpressionFactory();
    ELContext elContext = facesContext.getELContext();
    ValueExpression valueExp = null;
    valueExp = elFactory.createValueExpression(elContext, pExpression, Object.class);
    return valueExp.getValue(elContext);
    private static final String _NO_JS_PATTERN = new String();
    private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(DateTimeConverter.class);
    // RenderingContext key indicating the _dateFormat object
    // has been created
    private static final String _PATTERN_WRITTEN_KEY = "org.apache.myfaces.trinidadinternal.convert.DateTimeConverter._PATTERN_WRITTEN";
    *Problem is if any input date componet is displaying other than current date then the date picker is always picking the current date rather existing date*
    Please suggest me where to make changes?
    Edited by: 858782 on Oct 3, 2011 7:43 AM
    Edited by: 858782 on Oct 3, 2011 11:44 PM

    I need custom date foramts to be applied for different inputDates which are not defined in <af:convertDateTime>
    Thanks
    Edited by: 858782 on Oct 13, 2011 4:59 PM

  • I have a new mac book pro (sept 2014) and am suddenly stuck on the log-in screen. Keyboard input not working to enter my password. Already tried a basic restart and a cmmnd/ cntrl/ pwr troubleshoot to no effect.

    I have a new mac book pro (sept 2014) and am suddenly stuck on the log-in screen. Keyboard input is not working to enter my password. Seems to be a log in issue as keyboard works for forced troubleshooting. (And b/c when I first noticed the problem, I was able to enter my log in password but then everything sort of froze. Now, no ability to enter the password.) Already tried a basic restart and a cmmnd/ cntrl/ pwr troubleshoot to no effect.

    Reset PRAM:   http://support.apple.com/kb/PH14222
    Start up in Safe Mode.
    http://support.apple.com/kb/ph14204
    A new Mac is in warranty for 1 year from the date of purchase.
    A new Mac comes with 90 days of free tech support from AppleCare.
    AppleCare: 1-800-275-2273
    Call AppleCare or take it to the Apple store to have it checked out.
    Genius Bar reservation
    http://www.apple.com/retail/geniusbar/
    Best.

  • Creation of error log  on input data  and stat report

    I am doing call transaction on <b>C202</b> transaction.my client asked me before uploading the file he needs some validations on input file and he is asking me to create  a log for all the validations.i have to place error lof for all the input data.
    •An error log will record all errors occurring during upload. For each error the list should
    contain the data (line) going in error and an error text in a subsequent column (subsequent to data). The change number used to perform  the upload will be stated in the header of the error list.A txt-file containing the error log will get the same name as the input file, but with an ending –err.xls.
    Therefore no Batch-Input-Session is needed.
    • After execution of the batch input program, the following analysis regarding execution will be shown:
    o Number of records in input file (including title, first line)
    o Number of records successfully updated
    o Number of records in error
    Example:
    Number of records in input file (incl. first line) 4
    Number of records successfully updated:   3
    Number of records in error:      0
    How to do this according to client  requirements.can u help me to get a statastical way to represent errors.  Send me some smpale code for number of errors and no records gets success and no of failed.
    Thanks
    chandrasekhar

    Hai Chandrasekhar
    Go through the following Code
    report Z_CALLTRANS_VENDOR_01
    no standard page heading line-size 255.
    Generated data section with specific formatting - DO NOT CHANGE ***
    data: begin of it_lfa1 occurs 0,
    KTOKK like lfa1-ktokk,
    NAME1 like lfa1-name1,
    SORTL like lfa1-sortl,
    LAND1 like lfa1-land1,
    end of it_lfa1.
    End generated data section ***
    data : it_bdc like bdcdata occurs 0 with header line.
    *DATA: IT_MESSAGES TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE.
    *DATA: LV_MESSAGE(255).
    data : it_messages like bdcmsgcoll occurs 0 with header line.
    data : V_message(255).
    data : V_flag.
    data : V_datum1 type sy-datum.
    data : begin of it_mesg occurs 0,
    message(100),
    end of it_mesg.
    *V_datum1 = sy-datum-1.
    parameters : P_Sess like APQI-GROUPID.
    start-of-selection.
    perform Get_data.
    *perform open_group.
    loop at it_lfa1.
    perform bdc_dynpro using 'SAPMF02K' '0100'.
    perform bdc_field using 'BDC_CURSOR'
    'RF02K-KTOKK'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'RF02K-KTOKK'
    it_lfa1-KTOKK.
    perform bdc_dynpro using 'SAPMF02K' '0110'.
    perform bdc_field using 'BDC_CURSOR'
    'LFA1-LAND1'.
    perform bdc_field using 'BDC_OKCODE'
    '=UPDA'.
    perform bdc_field using 'LFA1-NAME1'
    it_lfa1-name1.
    perform bdc_field using 'LFA1-SORTL'
    it_lfa1-sortl.
    perform bdc_field using 'LFA1-LAND1'
    it_lfa1-land1.
    call transaction 'XK01' using it_bdc
    mode 'N'
    update 'S'
    messages into it_messages.
    if sy-subrc <> 0.
    if V_flag <> 'X'.
    perform open_group.
    V_flag = 'X'.
    endif.
    perform bdc_transaction. "using 'XK01'.
    endif.
    perform format_messages.
    refresh : it_bdc,it_messages.
    endloop.
    if V_flag = 'X'.
    perform close_group.
    endif.
    *& Form Get_data
    text
    --> p1 text
    <-- p2 text
    FORM Get_data .
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    FILENAME = 'C:\srinu_vendor.txt'
    FILETYPE = 'ASC'
    TABLES
    DATA_TAB = it_lfa1
    EXCEPTIONS
    CONVERSION_ERROR = 1
    INVALID_TABLE_WIDTH = 2
    INVALID_TYPE = 3
    NO_BATCH = 4
    UNKNOWN_ERROR = 5
    GUI_REFUSE_FILETRANSFER = 6
    OTHERS = 7
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. " Get_data
    *& Form bdc_dynpro
    text
    -->P_0061 text
    -->P_0062 text
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
    CLEAR it_BDC.
    it_BDC-PROGRAM = PROGRAM.
    it_BDC-DYNPRO = DYNPRO.
    it_BDC-DYNBEGIN = 'X'.
    APPEND it_BDC.
    ENDFORM.
    Insert field *
    FORM BDC_FIELD USING FNAM FVAL.
    CLEAR it_BDC.
    it_BDC-FNAM = FNAM.
    it_BDC-FVAL = FVAL.
    APPEND it_BDC.
    ENDFORM.
    *& Form format_messages
    text
    --> p1 text
    <-- p2 text
    FORM format_messages .
    loop at it_messages.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
    ID = it_messages-MSGID
    LANG = 'EN'
    NO = it_messages-MSGNR
    V1 = it_messages-MSGV1
    V2 = it_messages-MSGV2
    V3 = it_messages-MSGV3
    V4 = it_messages-MSGV4
    IMPORTING
    MSG = V_message
    EXCEPTIONS
    NOT_FOUND = 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.
    write : / V_message.
    clear : V_message.
    endloop.
    ENDFORM. " format_messages
    *& Form open_group
    text
    --> p1 text
    <-- p2 text
    FORM open_group .
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
    CLIENT = SY-MANDT
    GROUP = P_Sess
    HOLDDATE = V_datum1
    KEEP = 'X'
    USER = SY-UNAME
    IF SY-SUBRC = 0.
    write : / 'Session Creating wit Name : ',P_Sess.
    ENDIF.
    ENDFORM. " open_group
    *& Form close_group
    text
    --> p1 text
    <-- p2 text
    FORM close_group .
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
    ENDFORM. " close_group
    *& Form bdc_transaction
    text
    -->P_0132 text
    FORM bdc_transaction. "USING VALUE(P_0132).
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
    TCODE = 'XK01'
    POST_LOCAL = NOVBLOCAL
    PRINTING = NOPRINT
    SIMUBATCH = ' '
    CTUPARAMS = ' '
    TABLES
    DYNPROTAB = it_bdc
    EXCEPTIONS
    INTERNAL_ERROR = 1
    NOT_OPEN = 2
    QUEUE_ERROR = 3
    TCODE_INVALID = 4
    PRINTING_INVALID = 5
    POSTING_INVALID = 6
    OTHERS = 7
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. " bdc_transaction
    Regards
    Sreeni
    Message was edited by: Sreenivasulu Ponnadi

  • How to do validation of input fields

    Hi all,
              I have a rquirement to do the validation of input fields.Can anybody explain me how to go for that???Please explain in detail.U can also give me a link where i can find the tutorial for doing this.

    Hi Amit,
    What everyone has said above is correct - in the method of your action simply test for whatever condition you need to validate for.  However, the following tutorial shows you how to use Web Dynpro's Message Manager to display the messages on the screen in an easy user-friendly way:
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/a%20simple%20input%20form%20with%20message%20and%20error%20service%20support.pdf">Enabling Message and Error Support</a>
    In addition, there are some validations that are done automatically depending on what you have your input fields set to - for instance, if you bind your input field to a date and a user enters words into the field instead of an actual date, it will automatically display an error message.  To learn how to turn this feature on and off, see this tutorial
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/edf6ea90-0201-0010-7696-a68662381c12">Using Validating and Non-Validating Actions</a>

  • Validation of input parameters in Oracle BI Publisher reports

    Hi
    I am new to Oracle Bi Publisher.
    In my project i am using oracle BIPfor generating simple reports.
    here i need validation for input parameters (Date field) and i want to make it (Date field) disable, so that user can select the date through the Calendar component only.
    Can anyone please provide me the solution in detail, it is urgent.

    I have the same task to validate input parameters with Oracle BI Publisher 5.6.3 running under Oracle eBS 10.5.10.2. My validation goes beyond of what I can do during parameter registration. I am using Data Templates.
    My first logical place was the before report trigger. So, I built a report trigger which returns 'false' in case the parameters are not proper. Guess what... XMLP just returns a hard-coded message
    !!Error : trigger '" + datatrigger.getName() + "' returns status as 'false'
    First of all, this is a bad style to hardcode messages visible by the user (especially during French implementation). Second of all, it is not informative at all. It would be nice to change oracle.apps.xdo.dataengine.XMLPGEN.executeTrigger() to read, for example, a message from the message stack when the trigger returns 'false' and let the user read it.
    Anyway, what I did was I built a special data group, decalred before any other data group, query like
    select my_package.my_validation fro dual
    If parameters fail the validation my PL/SQL package throws an application exception with a message. At least, in this case the error message gets available as the description of the concurrent request.
    I wish the before report trigger worked!!!

  • How to compare the current date to an inputed date?

    I am having a validation to check if the date is not After the current System Date?
         public String getDate_trans()
             try {
             Date x=new Date();<<Get the current Date
             Date date=new Date();
             DateFormat formatter ;
             formatter = new SimpleDateFormat("yyyy-MM-dd");
             date = (Date)formatter.parse(date_trans); <<<Inputed Date
                   System.out.println(date);
                   System.out.println(x);
                   if(date<x)
                        System.out.print("Date is Valid");
                                                   else
                                                     System.out.print("Date is invalid");
             catch (ParseException e)
        {System.out.println("Exception :"+e);    }
         return date_trans;
         }

    tr3k wrote:
    I dunno what to method to use in there...I'm so sorry...The closest method that I could use I think is the compareTo...but I dunno how I can use that to compare using greater than or less than.....Read the docs for that method. READ THE DESCRIPTION. What do you not understand about that?
    And there are two other methods that are even simpler. You haven't looked closely enough.

  • Setting keyboard input to default to phone

    Trying to figure out how to set my keyboard input to default to the phone, NOT to search or any other text-based input. I want to be able to type a phone number into my phone and call someone. Is this too much to ask? I have spent hours trying to figure this out and can't find an answer. Help please! And thanks.

    I don't think so, that I know of.
    Are most of your calls all dialed by number or are there a few numbers you dial quite often?
    You can set a screen shortcut to those.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

Maybe you are looking for

  • Communicating w. running (non-Java) process from Java

    I'd like to be able write a Java program that can run an instance of a text editor, say NotePad or TextPad, with some text file open (I know how to do this via the Runtime class' exec method), but then, at a later point, open some other text file in

  • I am unable to share a contact via text message on my iphone 4

    I am unable to share a contact via text message on my i phone 4

  • Ajatix Extensions won't install. Please help!

    I just upgraded from CS6 to Adobe CC. I am trying to install my Ajatix extensions but the extention manager isn't taking them. I even downloaded the CC versions from the Ajatix website. When I try to install them with Adobe Extention Manager, I get a

  • Sort collection by adding date

    Hi How can I sort the images inside a collection by the date of adding it to the collection?

  • Execute view prpblum

    Hi All I have view based on three tables it executes well but in between i need one column in one of the tables and i alter the table and add a column after this it will craeting problum while i am try to execute it it Through the erroe frm:-40505 :O