Awk script to check condition.[SOLVED]

11:50:37.302 I AlertAppli oid 178371182, priceChange 300, percentChange 4, elapsedTime 1000
need to get the price and percent and check if price > 5000 and percent > 5
#!/bin/gawk -f
BEGIN {
pxChange=length("priceChange")+2;
pcntChange=length("percentChange")+2;
idx=index($0, "priceChange");
priceChange=substr($0,idx);
price=substr(priceChange,pxChange,index(priceChange,",")-pxChange);
if( price > 5000 ) {
idx=index($0, "percentChange");
percentChange=substr($0,idx);
percent=substr(percentChange,pcntChange,index(percentChange,",")-pcntChange);
if ( percent > 5 ) {
print price"-"percent;
The above script is printing  price and percent even when the price is not > 5000 and pcnt is not > 5. What is wrong with the script above?
bash-2.05b$ grep 'priceChange.*percentChange' a_olpa.log | awk -f /var/tmp/a_olpa.awk
600-50
Last edited by srikanthradix (2011-12-12 16:10:33)

In Appendix A of the awk book it says: "Each variable and field can potentially be a string or a number or both at any time." The type of a variable is set to the type of the expression you assign to the variable. Fields are special. If the field contains only digits then its type is set to a number. Otherwise, the field is a string. When doing a comparison, if both operands are numbers, then a numeric comparison is performed. If one of the operands is a string then the other is converted to a string before the string comparison is made. A string is "less than" another string if it is earlier in sorted order.
You want a numeric comparison but what you are actually getting is a string comparison. substr is a string function and so returns a string. Coerce the expression into a number by adding zero to it. For example, in an if statement:
if( 0 + price > 5000 ) {
Here's a simple way to handle named fields that come in random order... assuming your data is as simple as your example line.
{ price = fld("priceChange"); perc = fld("percentChange") }
price > 5000 && perc > 5 { print price "-" perc }
function fld(name)
for(i = 4; i <= NF; i += 2) if($i == name) return 0 + $(i+1)
return 0
Notice how I coerce a field's value into a number. When converting expressions from a string to a number, awk reads as many digits from the beginning of the string as it can. Once it runs into the comma character it will stop converting the string to a number expression, ignoring the comma.

Similar Messages

  • [SOLVED] calling sleep from an awk script

    I am working on an awk script which repeatedly does some work and then sleeps.  Most of the time it is sleeping and while it is sleeping I would like to be able to hit control-c to abort the program.  Example awk scripts I have seen suggest this should be possible by testing for a non-zero exit code from the sleep call.  However, it doesn't work and my program won't let me stop it.  The following test program prints "0" whether I abort the sleep with control-c or wait for it to terminate normally:
    #!/bin/awk -f
    BEGIN {
    print system("sleep 10")
    My arch system is up to date.  From the "info" man page for sleep it says an abnormal termination should yield a non-zero exit code.  I've tried calling other programs instead of sleep and they return non-zero exit codes when I hit control-c on them.  I've tried invoking as "/bin/sleep 10" and "env sleep 10" as well.  Nothing works.  Any idea what I'm doing wrong?
    Last edited by scottfial (2010-07-09 08:05:35)

    Sleep must return something useful when you it ^C because the following lua program:
    #!/usr/bin/lua
    local exit_code
    repeat
    exit_code = os.execute("sleep 10")
    print("exit_code: " .. exit_code)
    until exit_code ~= 0
    produces the following output if I let the sleep expire twice and then hit ^C:
    exit_code: 0
    exit_code: 0
    ^Cexit_code: 2
    and then it terminates.  Now here's an equivalent awk program:
    #!/bin/awk -f
    BEGIN {
    do {
    exit_code = system("sleep 10")
    print "exit_code: " exit_code
    } while (!exit_code)
    It produces the following if I let the sleep expire twice and then hit ^C twice:
    exit_code: 0
    exit_code: 0
    ^Cexit_code: 0
    ^Cexit_code: 0
    and it never terminates.  I have to kill it.  Just to make sure that awk is seeing exit codes, I compiled this C program
    int main(int argc, char *argv[]) {
    return 2;
    and changed my awk program to call "a.out" rather than "sleep 10".  The result is
    exit_code: 2
    and then it terminates.
    I got the following on the command line:
    $ ./a.out
    $ echo $?
    2
    $ sleep 10
    ^C
    $ echo $?
    130
    Excuse me?  130?  Lua saw a 2.  None of this makes sense.   Its as if awk has singled out "sleep" to not work!  Where am I going wrong?
    Last edited by scottfial (2010-06-22 17:18:54)

  • Need a Script to check Database backup chain for revovery

    Dear All,
    any having a handy script to check database backup chain ,
    Database A --> Full backup  -- Diff -- log1 --Log 2 ...... and scan through the files to validate if we can recover the database using the avaiable backups.
    Regards
    Sufian
    Mohd Sufian www.sqlship.wordpress.com Please mark the post as Answered if it helped.

    You can use below TSQL
    set nocount on
    go
    if exists ( select name from tempdb..sysobjects where name like '#DatabasesBackupsStatus%')
    drop table #DatabasesBackupsStatus
    GO
    create table #DatabasesBackupsStatus
    ServerName varchar(100) null,
    DBName varchar(100) null,
    RecoveryModel varchar(100) null,
    LastFullbackup datetime null,
    days_since_Lastfullbackup int null,
    days_since_Lastdiffbackup int null,
    HOURS_since_LastLogbackup int,
    DBStatus varchar (100) null,
    FullBackupLocation varchar(1000) null,
    MEDIASET INT,
    JobOwner varchar(100) null
    Go
    insert into #DatabasesBackupsStatus(ServerName,DBName)
    select convert(varchar,serverproperty('ServerName')),a.name
    from master.dbo.sysdatabases a
    where a.name <> 'tempdb'
    update #DatabasesBackupsStatus
    set LastFullbackup=b.backup_start_date,
    days_since_Lastfullbackup=datediff(dd,b.backup_start_date,getdate()),
    MEDIASET=b.media_set_id
    from #DatabasesBackupsStatus a,(select database_name,MAX(media_set_id)media_set_id,max(backup_start_date) backup_start_date
    from msdb..backupset where type='D' group by database_name)b
    where a.DBName=b.database_name
    update #DatabasesBackupsStatus
    set RecoveryModel=convert(sysname,DatabasePropertyEx(DBName,'Recovery'))
    update #DatabasesBackupsStatus
    set DBStatus=convert(sysname,DatabasePropertyEx(DBName,'Status'))
    update d
    set d.FullBackupLocation=b.physical_device_name
    from #DatabasesBackupsStatus d , msdb..backupmediafamily b
    where d.MEDIASET =b.media_set_id
    update d
    set d.days_since_Lastdiffbackup=datediff(dd,b.backup_finish_date,getdate())
    from #DatabasesBackupsStatus d , (select database_name,max(backup_finish_date) backup_finish_date
    from msdb..backupset where type ='I' group by database_name) b
    where d.DBName = b.database_name
    update d
    set d.JobOwner=b.[user_name]
    from #DatabasesBackupsStatus d , msdb..backupset b
    where d.MEDIASET = b.media_set_id
    update d
    set d.HOURS_since_LastLogbackup=datediff(hh,b.backup_finish_date,getdate())
    from #DatabasesBackupsStatus d , (select database_name,max(backup_finish_date) backup_finish_date
    from msdb..backupset where type ='L' group by database_name) b
    where d.DBName = b.database_name
    AND d.RecoveryModel != 'SIMPLE'
    Go
    select * from #DatabasesBackupsStatus
    Go
    drop table #DatabasesBackupsStatus
    Please Mark This As Answer if it solved your issue 
    Please Mark This As Helpful if it helps to solve your issue
    Thanks,
    Shashikant

  • Checking conditions in SELECT statement

    Hi All,
    I am relative new to ABAP and I would like to ask a question about checking conditions in SELECT statement in the "WHERE" part.
    There are two checkboxes at the selection screen and each should disable one of  conditions (marked with two stars) in the SELECT mentioned below.
    My question is, whether there exists an option how to solve this problem without using solution like:
    IF checkobx1.
    SELECT (without one condition)
    ELSEIF checkbox2.
    SELECT(without other condition).
    ELSE.
    SELECT (with both conditions)
      SELECT  qprueflos qherkunft qaufnr qsa_aufnr qmatnr qwerkvorg
              qpastrterm  qpaendterm
              qverid qobjnr vobjnr AS objnr_fa vauart
        FROM qals AS q INNER JOIN vkaufk AS v
        ON qaufnr = vaufnr
        INTO CORRESPONDING FIELDS OF TABLE gt_qals
        WHERE q~prueflos IN s_pruefl
          AND q~stat35     EQ space
          AND q~werk       EQ loswk
          AND q~herkunft IN s_herk
          AND q~offennlzmk EQ 0
          AND q~offen_lzmk EQ 0
          AND q~pastrterm IN s_startt
          AND q~paendterm LE s_endt
          AND v~auart IN s_auart.    "('ZCPA', 'ZCPK', 'ZCBA').

    Hi,
    With this, I think u can directly read into WHERE clause
    IF checkbox1.
        v_where = '& BETWEEN ''&'' AND ''&'' '.
        REPLACE '&' WITH key_field INTO v_where.
        REPLACE '&' WITH field_LOW INTO v_where.
        REPLACE '&' WITH field_HIGH INTO v_where.
        CONDENSE v_where.
    ELSEIF  checkbox2.
        v_where = '& BETWEEN ''&'' AND ''&'' '.
        REPLACE '&' WITH key_field INTO v_where.
        REPLACE '&' WITH field_LOW INTO v_where.
        REPLACE '&' WITH field_HIGH INTO v_where.
        CONDENSE v_where.
    ENDIF.
    select * into corresponding fields of table ITAB
                 from (table_name)
                where (v_where).
    In this key_field is your fieldname in the where clause and field_low, field_high are range of values.
    If i write static query it looks like this
    RANGES: MATNR1 FOR MARA-MATNR.
      MATNR1-LOW = MATNR_LOW.
      MATNR1-HIGH = MATNR_HIGH.
      MATNR1-SIGN = 'I'.
      MATNR1-OPTION = 'BT'.
      APPEND MATNR1.
    select * into corresponding fields of table itab
    from mara where matnr BETWEEN 'M100' AND 'M200'.
    Hope it helps u
    thanks\
    Mahesh
    Edited by: Mahesh Reddy on Jan 30, 2009 11:23 AM

  • Script to check aur status

    I'm trying to write a script to check the status of a package on aur; ie, to see if its been updated since I've installed it.
    Here's what I have so far:
    #!/bin/sh
    PACK=$1 #package name
    PACKID=$2 #package ID on AUR
    #grab last updated of package on AUR
    LUPD=`elinks -source http://aur.archlinux.org/packages.php?ID=$PACKID | grep "Last Updated" | awk -F : '{print $2}'`
    LAST=`grep -c $PACK /var/log/pacman.log` #number of instances of package
    INST=`grep $PACK /var/log/pacman.log | sed -n ${LAST}p` #get last instance
    echo -e "Package: $PACK \n $INST \n Last Update: $LUPD"
    This basically works fine for manually inputting a package name and AUR ID (though it needs to be prettied up):
    [mike@esme abs]$ aurcheck rxvt-unicode-256color 13060
    Package: rxvt-unicode-256color
    [2008-04-18 20:01] installed rxvt-unicode-256color (9.02-1)
    Last Update: Sun, 04 May 2008 14
    but what I envision is having a two column file with the first column the package name and the second the ID but I can't figure out how to make this loop around for each line of such a file.  If anyone can provide some help/pointers I'd greatly appreciate it.
    PS Perhaps yaourt can do this for you, but I don't use yaourt and would like to learn how to do this even just to improve my scripting abilities
    Thanks!

    Daenyth wrote:Oh wow, I had no idea such a thing existed... Very cool!
    Expanding on my suggestion, here's the bash/js-script I use to find packages in AUR:
    wget="/usr/bin/wget -q -O-"
    aurrepo="http://aur.archlinux.org/rpc.php?type=search&arg="
    js="/usr/bin/js"
    aur() {
    local iam="${FUNCNAME[0]}:"
    local cmd="${1}"
    local what="${2}"
    local aurresult=""
    [[ -z "${cmd}" ]] && {
    echo "${iam}: use ${iam} (cmd) searchstring"
    return 1
    aurresult="$(${wget} ${aurrepo}${what})"
    ${js} -e "
    var out = ${aurresult};
    var res = out.results;
    var i, j, len;
    var tabs = ' ';
    var tabstop1 = 13;
    var oneline1 = {
    'ID':true, 'CategoryID':true, 'NumVotes':true,
    'OutOfDate':true, 'License':true
    var oneline2 = {'Name':true, 'Version':true};
    var line1='', line2='';
    var others = {};
    function tabto(string) {
    return tabs.substring(1, tabstop1 - string.length);
    if (out.type === 'error') {
    print(res);
    quit(1);
    for (i in res) {
    others = {};
    line1 = '';
    line2 = '';
    for (j in res[i]) {
    if ((typeof oneline1[j] !== 'undefined')
    && (typeof res[i][j] === 'string')) {
    if (line1.length > 0) line1 = line1 + '; ';
    line1 = line1 + j + ': ' + res[i][j];
    } else if ((typeof oneline2[j] !== 'undefined')
    && (typeof res[i][j] === 'string')) {
    if (line2.length > 0) line2 = line2 + '; ';
    line2 = line2 + j + ': ' + res[i][j];
    } else {
    others[j] = res[i][j];
    print(line2);
    print(line1);
    for (k in others) {
    print(k + ':' + tabto(others[k]) + others[k]);
    print('---');
    quit(0);
    return $?
    Note that js(1), which has no man-page or other documentation, is part of "spidermonkey", which in turn is part of "firefox".  It makes sense to assume that people have this browser installed.  If at all possible, the javascript shell should have the file-methods compiled in to be able to use it like many other scripting languages, especially with JSON code.  The scriptlet above works with an unmodified standard install.

  • BADI/User Exit for Checking Conditions in TRM Transactions

    Hi  All,
    I have to check some conditions before saving the transaction FTR_CREATE. So that based on that condition it will be known that whether that transaction will save or not.  I found some BADIs, but those are particularly working for Money market and derivatives. For my Req, I need a BADI which will check conditions for both Money market and Securities.
    Exact req is, Based on Portfolio and PaymentAmount i have to restrict the transaction. Those will found in 2 tables VTBFHA and VTBFHAPO. But many BADIs doesnt contain VTBFHAPO.
    If any one working on TRM can u help me out ?

    >
    priya tavanam wrote:
    > Hi Frds,
    >
    > I am using the FTR_TR_GENERIC Badi.  In that one method is : EVT_TRANSACTION_SAVE_CHECK. In that one parameter is PI_PROXY_TRANSACTION. I want to get the attributes of Method A_TAB_CASHFLOW . That is  : A_TAB_CASHFLOW~BZBETR.
    -->whats ur code to read those values , it should be
    lt_cashflow[] = PI_PROXY_TRANSACTION->a_A_TAB_CASHFLOW [ ] ' .
    But i am unable to access this value in BADI. how access this. Can any one help me on this.

  • Calculation script with multiple conditions

    Hi. I am recreating an order form in Livecycle. I'd like to auto-populate some of the pricing info on the bottom based on data input on the top half of the form.
    I've tried several different sets of code, and come up with nothing that works.
    Here's an example scenario:
    If the checkbox for "offshore" and "bolting" is checked, the numeric field associated with bolting should be $50 * whatever number is in the bolting quantity box.
    So i need the script to check the offshore checkbox, and the bolting checkbox, assign a value to the numeric field and multiply it by another numeric field.
    There is the added complication of some customers having custom pricing, so I'd need to also figure out a code that is based on the customer selection.
    I also thought about, perhaps, putting the price info in drop down lists and enabling/disabling them based on the checkboxes up top.
    Ideally, though, the first scenario would be my preference.
    I tried this code (and many other variations of it) in both javascript and formcalc...in formcalc i get an error about the &.
    if (offshore == 1) && (bolting == 1) then
    $.rawValue == $50.00
    elseif
    (inland == 1) && (bolting == 1) then
    $.rawValue == $50.00
    elseif
    (land == 1) && (bolting == 1) then
    $.rawValue == $55.00
    elseif
    (rig == 1) && (bolting == 1) then
    $.rawValue == $50.00
    elseif
    (plant == 1) && (bolting == 1) then
    $.rawValue == $50.00
    elseif
    (yard == 1) && (bolting == 1) then
    $.rawValue == $55.00
    else
    $.rawValue = 0
    endif
    any help would be appreciated!

    You need more parenthesis.      
    if ((offshore==1) && (bolting==1)){
    //do stuff

  • Calling different pages in a single sap script based on conditions?

    Hi All,
             Can anyone please give me an example of how to call different pages in a single sap script based on condition. Eg., i need to call 5 differnet pages from a single sap script based on 5 company codes.
    Please help
    Regards
    Priya

    This approach to make call from SAPscript. Its concept is similar to make call to a subroutine in another program. I would presume you understand how to use USING and CHANGING parameter. =)
    SAPscript -
    /: Perform get_date in program z_at_date
    /:    using &p_year&
    /:    changing &new_date&
    /: endperform.
    program z_at_date -
    form get_date TABLES rec_in  STRUCTURE itcsy
                                    rec_out STRUCTURE itcsy..
    DATA:
       v_year type char10.
    sap script and subroutine uses itcsy structure to transmit parameters
    first parameter is incoming while second parameter is out going
    their function is like an internal table with header line
    all data types between SAPscript and subroutine are string.
    so, you might need additional conversion.
    read incoming parameter with exact name from SAPscript
      READ TABLE rec_in WITH KEY name = 'P_YEAR'.
      IF sy-subrc EQ 0.
        v_year = rec_in-value.
      ENDIF.
    to return value, use the exact name on the second structure
        CONCATENATE v_year v_year INTO v_year.
        READ TABLE rec_out WITH KEY name = 'NEW_DATE'.
        IF sy-subrc EQ 0.
          rec_out-value = v_year.
          MODIFY rec_out TRANSPORTING value WHERE name = 'NEW_DATE'.
        ENDIF.
    endform.
    Hope this helps =)

  • Check condition on sub total line of ALV list

    Hi All ,
    Is it possible to check  condition on the value of subtotal line in ALV list ,
    I,e If the value of subtotal line is say greator than 100 I need to change the color of that line or change the text on the subtotal line .
    I know how to change the subtotal text but i want to change with respect to value of the subtotal ,
    Any input if this can be achieved will be great .
    Thanks in adv .
    Vinay
    Edited by: vinay kolla on Jul 29, 2009 4:43 AM

    Hi,
    I donu2019t think there is any direct way to check  the subtotal value in LIST display, try the following logic.
    1. Use the event BEFORE_LINE_OUTPUT to check the subtotal value and accordingly change the text or colour of the line.
    2. To use events in ALV, first get the events into a table through the FM REUSE_ALV_EVENTS_GET as shown
         CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
          EXPORTING
          i_list_type = 0
         IMPORTING
          et_events   = z_i_events.
      SORT z_i_events BY name.
      CLEAR z_wa_events.
      READ TABLE z_i_events WITH KEY name = slis_ev_before_line_output
                            INTO z_wa_events BINARY SEARCH.
      IF sy-subrc = 0.
        MOVE 'BEFORE_LINE_OUTPUTu2019 TO z_wa_events-form.
        MODIFY z_i_events FROM z_wa_events INDEX sy-tabix.
      ENDIF.
    3. Create a form with the name BEFORE_LINE_OUTPUT and do the coding to check the subtotals there.
    Form BEFORE_LINE_OUTPUT USING RS_LINEINFO TYPE SLIS_LINEINFO.
    *The structure RS_LINEINFO will have u2018Xu2019 in the field rs_lineinfo-subtot for subtotals.
    If RS_LINEINFO-SUBTOT = u2018Xu2019.
    *Here try to find the totals by looping at your final internal table till rs_lineinfo-tabindex.
    *Then based on this u can give the colour to the line.
    *I think there is no other way to check the subtotal value.
    Endif.
    Endform.
    Edited by: venkatesh PH on Jul 29, 2009 5:31 AM

  • Check condition in J1IIN Transaction

    Dear All,
    I am creating Excise Invoice through J1IIN transaction against a Billing Document. Sometimes user unknowingly change the Posting Date in J1IIN. So I want that Posting Date in J1IIN must be equal to the Billing Date of Reference Billing Document.
    So please tell if something is possible at Customization Level or not. If it is not possible then tell can it be done with ABAP (Some Userexit or like that) or not.
    Please reply asap.
    Regards,
    Vishal

    Hi Ankur,
    Can you please confirm whether I need to write this Check condition in FM 'J_1I7_USEREXIT_EXCISE_BEF_SAVE'?
    As it is most important transaction, so I need to take great care in this matter.
    Regards,
    Vishal

  • How to update Ztable from Excel file and how to check conditions ,

    HI this uday,
    pls help me how can i update Ztable from Excel file and how to check conditions .
    regards
    uday
    Moderator message: please (re)search yourself before asking.
    Edited by: Thomas Zloch on Jul 13, 2010 12:00 PM

    Hi
    Use Fm : ALSM_EXCEL_TO_INTERNAL_TABLE.
    L_INTERN : internal table with your fields .
    make sure that the fields in the Excel should be formatted (as numeric , characher ) depending upon the data types .
    LOOP AT L_INTERN INTO WA_LINTERN .
            MOVE WA_LINTERN-COL TO L_INDEX.
            ASSIGN COMPONENT  L_INDEX OF STRUCTURE WA_INREC TO <FS> .
            IF SY-SUBRC = 0.
              MOVE WA_LINTERN-VALUE TO <FS>.
            ENDIF.
            AT END OF  ROW .                                    "#EC *
              APPEND WA_INREC TO IT_DATA.  "
              CLEAR WA_INREC.
            ENDAT.
         ENDLOOP.
    Regards
    Swapnil

  • Need a windows script to check all unix db boxes are pinging ?

    Hi ,
    I need a windows script to check all unix remote db boxes are pinging ?
    I need to show the output in an html file.
    Can anyone suggest ideas ?

    I have a script that "kind of" works. The only problem I've seen is that it gets confused when filenames contain characters that are fine in Macland but not good in Unixland. Forward slashes are a good example of this.
    In this case I have a folder in my home named "copytest" Inside copytest are two folders:
    Source (containing the images to be added)
    Dest (My existing library of images)
    It also assumes that the folder of images to be added contains no sub-folders. Hope this helps.
    tell application "Finder"
    set theSource to folder "source" of folder "copytest" of home
    set imagesToBeCopied to name of every file of theSource
    end tell
    repeat with theFile in imagesToBeCopied
    try
    if (do shell script "find -r ~/copytest/dest -name " & quoted form of (theFile as string)) is not equal to "" then
    --The file exists. Don't copy it
    else
    --the file doesn't already exist. Copy it.
    end if
    on error
    return "Failed while trying to check for existence of a file"
    end try
    end repeat

  • Need a bat script to check Server status remotly.

    Hi,
    I need bat script to check server status remotly (Ping) for multiple servers. It should generate a txt file for result.
    Thanks.

    Hi Ravi,
    To ping multiple computers and generate report cia cmd, please refer to the script below, the "fnm" is computer name list and the "lnm" is the result, and you can save the script below as .bat file:
    @echo off
    set fnm=d:\test1\computers.txt
    set lnm=d:\test1\ping.txt
    if exist %fnm% goto Label1
    echo.
    echo Cannot find %fnm%
    echo.
    Pause
    goto :eof
    :Label1
    echo PingTest STARTED on %date% at %time% > %lnm%
    echo ================================================= >> %lnm%
    echo.
    for /f %%i in (%fnm%) do call :Sub %%i
    echo.
    echo ================================================= >> %lnm%
    echo PingTest ENDED on %date% at %time% >> %lnm%
    echo ... now exiting
    goto :eof
    :Sub
    echo Testing %1
    set state=alive
    ping -n 1 %1
    if errorlevel 1 set state=dead
    echo %1 is %state% >> %lnm%
    Refer to:
    Explain the Batch script to ping multiple computers
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • How can I put check conditions when using Function 'LDB_PROCESS'

    Hy experts,
    I am using LDB_PROCESS and I don't know how to use check conditions in the callback forms.
    for example:
    FORM CALLBACK_QALS USING  NAME  TYPE LDBN-LDBNODE
                              WA    TYPE QALS
                              EVT   TYPE C
                              CHECK TYPE C.
    CASE EVT.
       WHEN 'G'.
         MOVE-CORRESPONDING wa to ITAB_QALS.
         APPEND ITAB_QALS.
    ENDCASE.
    endform.                    " CALLBACK_QALS
    Have anyone an example of how I can use check conditions in this type of form???
    thx in advance

    Hi
    U should indicate in which node (the GET) you need to check the condition, you form should have the following interface:
    FORM <formname> USING <nodename> LIKE LDBCB-LDBNODE
                           <workarea> (LIKE ...)
                           <mode>
                           <selected>.
    So the code should be:
    CHECK <WORKAREA>-FIELD = ............
    Max

  • Read table and checking condition in PAI

    Hi,
    I have a requirement where I need to check and compare with (Custom table) Bankn with Partner Bank`s bankn.
    I have wrote a code in PAI like this.
    MODULE CHECK_BANKN INPUT.
       Data: l_bankn like (Custom table)-bankn.
       select bankn from (Custom Table) into l_bankn
           where recno = g_recno.
       IF NOT g_head-bankn IS INITIAL.
      Read table i_bvtyp with key bankn = i_bvtyp-bankn .
         IF l_bankn <> i_bvtyp-bankn.--------->" Comparison of (custom table) Bankn with internal table I_BVTYP-BANKN
           MESSAGE w022 WITH text-w06.
         ENDIF.
       ENDIF.
    ENDMODULE.
    My Read Table statement is seems to be wrong and my checking condition is also wrong.
    So, how to resolve this?
    regards,
    Kiran

    Hi Kiran,
    If you observe your read statement, you are comparing the field with it's own table field.
       Read table i_bvtyp with key bankn = i_bvtyp-bankn .
    Untill unless you read I_BVTYP, i_bvtyp-bankn will be initial and you cannot find the matching record with Null-Value.
    So, I think you need compare with l_bankn.
       Read table i_bvtyp with key bankn = i_bankn .
    Then you can directly raise a message using SY-SUBRC value.
       Read table i_bvtyp with key bankn = i_bankn
          if SY-SUBRC <> 0 .
              <MESSAGE>    
         endif.
    Regards,
    Vijay

Maybe you are looking for

  • Down payment for Serivice Call!

    Hi all! I have a problem a bout services call. This is senarior of my customer. Before create Service Call, they have Down payment for service (not for Item) and then they create Service Call in next step. When they delivery some item( For Item) for

  • Best Pratice of Error Handling calling multiple external components

    I have used EJBs in my question, but it applies to any component/service that is exposed. If I have EJB1 calling EJB2, what is the standard approach to handling an error received from EJB2? Does EJB1 simply pass it back or wrap its own error around i

  • PUK locked SIM and PUK provided on "MYVerizon" doesn't work?

    So I have a PUK locked SIM and the PUK that is provided on "MYVerizon" doesn't work? I've had this phone for about a week and have had no problems with it. I set up my own pin and everything but when i went to disable the pin it kept saying it was wr

  • Help with multiple layers moving position

    Hi I am new to After effects so apologies if this is a daft question. I have a map as my main layer and I have created a text layer.I want to animate the position of the map which can easily be done.However all other layers move with the map layer.So

  • Can't install Ps 7

    Installation of PS 7 quits after agreeing to license agreement. It previously installed perfectly. It partially installed in Windows Safe Mode. Any thoughts please?