Logic for this comparision of character type operands.

Source field name: ZDCNFG
Target Info Objects:
ZDVD59
ZDVD10
ZDVD14
ZDVD18
ZDVD25
ZDVD50
Scenario1: If ZDCNFG = 2(10). 2 is quantity and 10 in brackets is part number (DVD format). So I will have to update the quantity respective field as shown below.
ZDVD59: 0
ZDVD10: 2 -->updated 10 part
ZDVD14: 0
ZDVD18: 0
ZDVD25: 0
ZDVD50: 0
Scenario2: If ZDCNFG: 2(25)3(50)
ZDVD59: 0
ZDVD10: 0
ZDVD14: 0
ZDVD18: 0
ZDVD25: 2 --> Updated
ZDVD50: 3 --> Updated
Scenario3: If ZDCNFG: 2(5)3(9) ---This is exceptional case. If we have 5 and 9 then add and assign 5 to ZDVD59 rest all are 0.
ZDVD59: 5  Sum of DVD5 and DVD9
ZDVD10: 0
ZDVD14: 0
ZDVD18: 0
ZDVD25: 0
ZDVD50: 0
Quantity is the value which is out side the brackets. For e.g. in 10(5), 10 is the quantity.
Can any one give me a logic for this.
I was trying with CA  CS etc..but no charm.
Thanks
Kiran

Kiran,
This should work
parameters: zdcnfg(50).
data: zdvd59(3),
zdvd10(3),
zdvd14(3),
zdvd18(3),
zdvd25(3),
zdvd50(3),
rcnt type i,
roff type i,
temp type i.
data: static(50).
start-of-selection.
  static = zdcnfg.
  replace all occurrences of '(5)' in zdcnfg with '+' replacement count rcnt.
  if rcnt ge 1.
    zdcnfg = static.
    do rcnt times.
      replace first occurrence of '(5)' in zdcnfg with '+' replacement offset roff.
      temp = roff - 1.
      add zdcnfg+temp(1) to zdvd59.
    enddo.
  endif.
  zdcnfg = static.
  clear: roff, rcnt, temp.
  replace all occurrences of '(9)' in zdcnfg with '+' replacement count rcnt.
  if rcnt ge 1.
    zdcnfg = static.
    do rcnt times.
      replace first occurrence of '(9)' in zdcnfg with '+' replacement offset roff.
      temp = roff - 1.
      add zdcnfg+temp(1) to zdvd59.
    enddo.
  endif.
    zdcnfg = static.
  clear: roff, rcnt, temp.
  replace all occurrences of '(10)' in zdcnfg with '+' replacement count rcnt.
  if rcnt ge 1.
    zdcnfg = static.
    do rcnt times.
      replace first occurrence of '(10)' in zdcnfg with '+' replacement offset roff.
      temp = roff - 1.
      add zdcnfg+temp(1) to zdvd10.
    enddo.
  endif.
    zdcnfg = static.
  clear: roff, rcnt, temp.
  replace all occurrences of '(14)' in zdcnfg with '+' replacement count rcnt.
  if rcnt ge 1.
    zdcnfg = static.
    do rcnt times.
      replace first occurrence of '(14)' in zdcnfg with '+' replacement offset roff.
      temp = roff - 1.
      add zdcnfg+temp(1) to zdvd14.
    enddo.
  endif.
    zdcnfg = static.
  clear: roff, rcnt, temp.
  replace all occurrences of '(18)' in zdcnfg with '+' replacement count rcnt.
  if rcnt ge 1.
    zdcnfg = static.
    do rcnt times.
      replace first occurrence of '(18)' in zdcnfg with '+' replacement offset roff.
      temp = roff - 1.
      add zdcnfg+temp(1) to zdvd18.
    enddo.
  endif.
    zdcnfg = static.
  clear: roff, rcnt, temp.
  replace all occurrences of '(25)' in zdcnfg with '+' replacement count rcnt.
  if rcnt ge 1.
    zdcnfg = static.
    do rcnt times.
      replace first occurrence of '(25)' in zdcnfg with '+' replacement offset roff.
      temp = roff - 1.
      add zdcnfg+temp(1) to zdvd25.
    enddo.
  endif.
    zdcnfg = static.
  clear: roff, rcnt, temp.
  replace all occurrences of '(50)' in zdcnfg with '+' replacement count rcnt.
  if rcnt ge 1.
    zdcnfg = static.
    do rcnt times.
      replace first occurrence of '(50)' in zdcnfg with '+' replacement offset roff.
      temp = roff - 1.
      add zdcnfg+temp(1) to zdvd50.
    enddo.
  endif.

Similar Messages

  • No authorization for this transaction with movement type 601

    Dear All,
    This is chandra i am getting this error in delivery level " No authorization for this transaction with movement type 601. If give the authorization for SAP ALL its working fine. If give the authorization for SAP SD T.Codes i am getting this error. Plz help me.
    Thanks and regards
    Chandra

    Dear Chandra,
    Check with -
    T. Code: OMJJ
    Select Movement Type: 601 and Double-Click: "Allowed Transaction" (From Left-hand side) .
    Check whether the Transaction is allowed for Movement Type 601 or not
    Note: if Transaction is not listed (i.e. not allowed) and you wanna allow this Transaction with Movement type 601, then -
    Up-there, Tab: New Entry. Click on it.
    Maintain entry as:
    MovTy: 601
    TCode: As reqd.
    and Save.
    Best Regards,
    Amit

  • Need the Logic for this Prg issue Pls

    Hi Friends,
    i have an urgent requirement..
    i am develop the report that is :
    Based on Selction Critirea kunnr(knvv-kunnr)
    i want Delete the
             Internet mail (SMTP) address FROM ADR6-MTP_ADDR
    AND Teletex number FROM ADR4-TTX_NUMBER..
    USING TABLES ARE KNVV , ADR6 AND ADR4.
    please how to Write the LOGIC For this Program .
    help me.. it is an urgent.. anyone.
    regards,

    Hi Alchermi,
    thanks for your reply soon.
    based on selction kunnr .. i want deete the ADR4-TTX_NUMBER..and ADR6-SMTP_ADDR From these 2 tables
    for these 2 fields..
    kunnr from knvv, selection field..
    below fields want be DELETED..
    ttx-number from adr4,
    smtp_addr from adr6.
    it is an urgent. help me .
    regards,

  • Logic for this senerio -- UDF

    Hi XI Gurus,
                          I hav to create a UDF.This is an IDOC - XI - FILE seerio. In  this senerio is I have an IDOc whose 7th segment contains a field. This field can store values in between 0 - 9. On the other hand I have a file structure in my left hand side from Messge mapping prespective , which contains 9 similar sized fields.
    Now the logic is if the field in the segment of the idoc has value say '3', then the file structure in the left hand side would have 3 in the field no 3 and all other fields 1, 2, 4, 5, 6, 7, 8, 9 would be zero.
    Can u guys suggest some logic for this???
    Thanks in advance !
    Poits would be rewarded.
    Arnab

    Hi Mohd,
    Select the Queue option for getting individual nodes
    public void test(String[] a,ResultList result,Container container){
    if (a<i> == 7) { //This is for selecting the node
    for(i=0;i<10;i++){  //This is for collecting the correct value
    ifIi==3){
    write what ever u have to done
    else{
    write the exceptional condition
    Dont to Reward points if this helps
    Regards
    Pragathi.

  • No authorization for this transaction with mvt type 101

    Has anyone seen this error:
    RFC BAPI Wrapper call:You have no authorization for this transaction inplant 1120      
    RFC BAPI Wrapper call:You have no authorization for this transaction with mvt. type 101
    RFC BAPI Wrapper call:You have no authorization for this transaction inplant 1120      
    The strange thing is that when I assign user with a different Personnel Number and it works just fine.  But when I switched back to his Personnel Number, then I get above error.
    Even though I don't get any order list but I got all notifications and technical objects.
    Also, this user has same roles with everyone else.  While everyone is working fine this user is the only one that getting the error and no order download to PDA.
    Regards,
    Dai Ly

    Hi,
    please run ther getlist and getdetail handler in the backend directly for that user - most likely you will get a better failure message there.
    Nevertheless - what Application  yre you using? Is it MAM? If yes, check the SPRO setup for this particular user,
    Regards,
    Oliver

  • Comparision of character type field

    hello expert,
    i want to compare a character type field without using operator like ge, ne etc.
    plz help me if you know.
    thanks in advance

    Hi,
    If it is character type. it will compare like this
    For operands with a character-type data type (c, d, n, t, string) the contents are compared from left to right. Based on the order in the code page used, the first different character from the left decides which operand is larger.
    let try this example you will get wrong output
    data : lv_field1 type char2 value '2',
             lv_field2 type char2 value '12'.
    if lv_field1 GT lv_field2.
      write : / 'test'.
    endif.
    So assing the values to some integer varaibles and compare then it will work fine.
    Hope it will helps

  • Can anyone please give me the logic for this....

    I have a database table and in it i have a field department code. now, that department code might have '00' or '   ' (blank) or anyother value. now i want to add up all the currency amounts with department code '00'  and '  ' (blank) which have same company code and currency type. I called all the entries with '00' into one internal table and enrties with '  ' (blank) to other internal table.
    can anyone give me the logic for adding all the entries at a time.
    thanks in advance.....

    HI Srinivas
    i have a solution for this question.
    Use At control break statement for this.
    Loop the internal table.
    Use at Event AT LAST. In that use SUM Statement. U will get sum of all the numeric fields.
    Or else u can use ON CHANGE OF Currency type
    then find the total amount by adding previouse value with ur current value.
    Like itab1-amount = total + itab1-amount.
    Appent this into ur internal or write it into ur report.
    Reward me if its useful.
    Regards
    Ravi

  • No authorization for this transaction with movement type

    Hi gurus,
      My sd consultant is authorized to execute VLO2N Tcode. But it is giving the error as follows
      "No authorization for this transaction(vlo2n) with movement type 643" ...
    When i try to do the same thing through BASIS ,it gives no error..
    Thanks in Advance,
    Vaibhav Gore.

    Hi Vaibhav,
    T. Code PFCG --> Give particular Role Name then click Change Button -->
    Then Click Autherization Button --> then Click Change Autherisation(pencil)
    Go and Click or Drill down the Material Management : Inventry Management
    1.This is --> Goods Movement  : Storage Location Type :
       Click -->  Movement type (Inventry Management) Press F4 --> u can choose ur valid type
        Like -->  623        GI iss:cust.ret.pack
    Regards
    kesav

  • Is there any alternative logic for this issue

    Hello all ,
    I have a  program which is executed as a background job for every 15 minutes . Now my requirement is If this batch job is successfully finished, i have to capture that time and date at which the batch job is successfully finished and update the corresponding time and date in a ZTABLE .
    In order to achieve this , i have created a separate program which will also be running in background.in this program , using the table TBTCO, i m getting the last date and  last time at which the batch job is successfully finished and modifying the ZTABLE accordingly
    Is there any alternate solution for this ?
    thanks&regards,
    G.Pavan

    Hi gpavansap,
    When you define background job in SM36, your first step should be the program which you have scheduled now.
    Create a second step in the same job with another program which would just update system date and time to the ZTABLE. No need to read TBTCO and all.
    The second step would immediately execute as soon as the first step ended successfully.
    If you don't want to create a separate program. you can have a check-box "Update ZTable Only" in the selection screen of the first program itself. If this check-box is selected, the program should only update ZTABLE and do nothing else. Create a variant of your selection screen with this check-box selected and schedule this variant as "Second Step" of your back-ground job.
    Regards
    Suresh

  • Comparison operators for character-type operands

    Hi Experts,
    I have one internal table in that Name is one field(char type) .
    some records have upper case,
    some in lower case,
    some are mixed.
      in selection screen i am entering the name and i am serching the record using search button.
    i am using code like as below,
    loop at itab where name cs name.
    endloop.
    cs operator is not working properly.
    can any body tell me how to do this.
    thanks in advance.
    tharangini.

    first of all change both the strings into one comman case like uppercase or lowercase.
    TRANSLATE w-string2 TO LOWER CASE.
    or
    TRANSLATE w-string2 TO UPPER CASE.
    then do the search operation in internal table.

  • Can anyone please help me with the logic for this..

    hi all,
    os  has the value Windows 2000
    IF os CP 'WINDOWS' OR os CP 'SUN'.
         OS1 = 'X'.
      ENDIF.
    (if i test this,
    os1 doesnot have any value, (should be x)).
    This doesnot work for me.
    Any suggestions.
    Regards,
    Sukumar.

    Dear Sukumar,
    just use the F1 help on CP in ABAP code, there is a description.
    I think you need to use the asterix '*' than it will work.
    Regards
    Tibor
    Just check the example:
    Report z_example.
    data: os1, os type string.
    os = 'WINDOWS 2000'.
    IF os CP 'WINDOWS' OR os CP 'SUN' or os = space.
    OS1 = 'X'.
    ENDIF.
    write: / os1.

  • Logic for this math problem

    Before I get stinker replies for cross posting , let me tell that , i have been recommended to post this in this forum.
    My problem is such:
    I need to find a logic to implement the following :
    In the floating point number , say , 1.0.. the Integral part will remain constant(1) but the decimal part has to get incremented by 1
    1.1 +0.1
    1.2+0.1
    1.3+0.1
    1.4+0.1
    1.5 +0.1
    1.6+0.1
    1.7+0.1
    1.8+0.1
    1.9+0.1
    1.10+0.1
    1.2... But what I need here is 1.11 ,1.12
    I need my programming logic to detect there needs to be a change in the increment value from 0.1 to 0.01 when I reach 1.1
    and from 0.01 to 0.001 when i reach 1.111..so on,
    please suggest..

    you can't do it with a double,
    since double d = 1.10d; will be treated as 1.1d
    what you can do is treat the double as a String
    public void test(){
    String s1 = "1.9";
    String s2 = "1.10";
    String s3 = "1";
    String s4 = "1.1";
    System.out.println(increment(s1));
    System.out.println(increment(s2));
    System.out.println(increment(s3));
    System.out.println(increment(s4));
    public String increment(String d){
    int pos = d.indexOf(".");
    if (pos != -1){
    if (d.charAt(d.length()-1) == 0)
    return d.substring(0, d.length()-2) +
    ength()-2) + "1";
    String temp = d.substring(pos+1);
    int num = Integer.parseInt(temp);
    num++;
    return d.substring(0, pos+1) + num;
    else
    return d + ".1";
    }gives
    1.10
    1.11
    1.1
    1.2
    I leave it to you to understand the logic...it's to
    get you started..it does not check for all conditions
    of the inputI think it is a Math with algorithm problem. Your solution is good, but you are using String functions so much. There is other solution, handling with numbers only.

  • Process chain Logic for this scenario

    HI,
      We have a typical requirement that need to be implemented using a Process chain.
    We need to Load data from R/3 to PSA,
    then Load the data from the PSA into ODS1,
    then execute an ABAP program,
    then load the data from PSA into ODS2 (we cannot repull from R/3).
    Can some one provide me an Idea on how to implement this.  I am stuck with the idea on how to populate ODS2 from PSA after executing ABAP Program.
    Thanks In advance,

    Hi Krishnamohan,
    I hope i m getting ur problem right.I think u can implement the below steps easily :
    Step 1 : We need to Load data from R/3 to PSA,
    Step 2 : then Load the data from the PSA into ODS1,
    Step 3 : then execute an ABAP program,
    U have options avaialable for each of them in process chains.
    Now coming to your problem.
    Step 4 : then load the data from PSA into ODS2 (we cannot repull from R/3).
    i guess ur Abap program makes some changes in the Data of PSA which u then want to load in the ODS2.
    What u can do is create 2 infopackages and inside infopackages in the data targets tab select ODS1 in the first infopackage and uncheck ODS2 , likewise in the 2nd infopackage select ODS2 and  uncheck ODS1.
    U can execute the first infopackage in the process chain , then ur abap program and then
    In process chain and in Process types u have something called "Read PSA Data and Updata Data Target".
    select that process type , specify the 2nd infopackage name and get it executed.
    Hope it helps.
    Thanks and Regards,
    Parth.

  • Logic for this..

    Hi,
    Can someone help me in implementing this simple logic in ABAP.
    Set of values : (10,20,30,40,50)
    If the value is not in this interval then it is updated to next higher value.
    Ex: If the value is 25 , it will be updated to 30.
    Tushar.

    Another Sample....
    REPORT  zramki.
    PARAMETERS: p_val TYPE i.
    DATA:
      result TYPE i,
      BEGIN OF it_num OCCURS 0,
        val TYPE i,
      END OF it_num.
    START-OF-SELECTION.
      it_num-val    = 10. APPEND it_num.
      it_num-val    = 20. APPEND it_num.
      it_num-val    = 30. APPEND it_num.
      it_num-val    = 40. APPEND it_num.
      it_num-val    = 50. APPEND it_num.
      SORT it_num.
      CLEAR result.
      LOOP AT it_num.
        IF it_num-val < p_val.
          CONTINUE.
        ENDIF.
        result = it_num-val.
        EXIT.
      ENDLOOP.
      WRITE:/ 'Value =', p_val.
      IF result IS INITIAL.
        WRITE: / 'Input value higher than largest list value: ',
                 it_num-val.
      ELSE.
        WRITE: / 'Result = ', result.
      ENDIF.
    Cheers,
    Ramki Maley.

  • NEED LOGIC FOR THIS

    I HAVE A TABLE AND THE VALUES LIKE THIS,
    CALENDAR_DATE working_day return_date
    JUL 04 N JUL 04
    JUL 05 N JUL 05
    JUL 06 N JUL 06
    JUL 06 N JUL 07
    JUL 08 Y JUL 08
    my requirement is how can i change all the return_date for which the working_day is 'N' to JUL 08 (working_day= 'Y')

    UPDATE table_name
    SET return_date = 'JUL 08'
    ,working_day = 'Y'
    WHERE working_day = 'N';
    Is this what you wanted ?

Maybe you are looking for