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.

Similar Messages

  • 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.

  • 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,

  • 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

  • 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

  • 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.

  • 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.

  • 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 ?

  • Need logic for this output  itab  format

    hi guys
    i need the output itab in following format
    i have data in my present  itab
    itab-f1     itab-f2    itab-f3
    AAA         10    (means null,' ')
    AAA         20            
    BBB         10          
    BBB         20    A1
    BBB         30         
    and i want output in following way output itab
    itab-f1     itab-f2    itab-f3
    AAA     30          
    BBB         60      A1
    can anyone suggest me code for this

    You want the sum of f2 for a group of f1's?
    Is f3 going to be the same for that group?
    Try this
    sum = 0
    sort itab by f1.
    itab2 like itab.
    loop itab.
    sum = itab-f2 + sum.
    f3var = tab-f3.
    at end of f1.
    move itab-f1 to itab2-f1.
    move sum to itab2-f2.
    move f3var to itab2-f3.
    append itab2.
    sum = 0.
    endat.
    endloop.
    Edited by: Ramiro Escamilla on Feb 7, 2008 11:29 PM

  • Tell me logic for this?

    In VA01, one field VBAP-PRODH, its length is 18 char
    suppose its having value 1040201030. here two charecters is one level. I need to check first two levels, can you please tell me how ?
    ie if product heirarchy determines this JET FUEL (4) = 1030
    how to check above condition tell me logic
    Thanks,
    Sanju

    Hi Sanjana,
    check this ,
    REPORT zex31 .
    data : prodh like VBAP-PRODH,
           ch(4).
    prodh = '1040201030'.
    ch = prodh+0(4).
    case ch.
    when '1030'.
      write : / 'JETFUEL'.
    WHEN '1020'.
      WRITE : / 'ELECTRICAL PARTS'.
    WHEN '1040'.
      WRITE : / 'GLASSES'.
    WHEN OTHERS.
      WRITE : / 'XYZ'.
    ENDCASE.
    if u r requirement is something else be more clear.

  • Programming logic for this scenario

    hi all,
    kindly help me with this scenario:
    i have a internal table with fields like this (among others)
    OBJEK                        ATINN         CHAR                                  CHARG            CHAR1
    000000000000000031 0000000188  Batchnumber: WEEK NO. 9  0000000052
    000000000000000031 0000000189  Visualinspection: OK            0000000052
    now wht i need to do is for SAME batch number i need to concatenate the values of CHAR into CHAR1.
    that is to say that CHAR1 shud have the value "Batchnumber: WEEK NO. 9 Visualinspection: OK"
    ive right now done it using 2 different internal tables and concatenating the values. want to know if theres an easier and simpler way.
    any pointers guys??
    pk

    solved it myself
    thanks to sujatha reddy's post in the following thread:
    Re: at end of  statement
    pk
    Edited by: prashanth kishan on Jul 11, 2008 9:19 AM

  • Logic for this query

    Hi friends,
    I have a requirement like I have the organizationid which changes for the employee over a period of time
    its like org_id
    CREATE TABLE ASSIGNMENTS
    ASSIGNMENT_ID NUMBER(10) NOT NULL,
    EFFECTIVE_START_DATE DATE NOT NULL,
    EFFECTIVE_END_DATE DATE NOT NULL,
    BUSINESS_GROUP_ID NUMBER(15) NOT NULL,
    PERSON_ID NUMBER(15),
    JOB_ID NUMBER(15),
    ASSIGNMENT_STATUS_TYPE_ID NUMBER(9) NOT NULL,
    SUPERVISOR_ID NUMBER(10),
    ORGANIZATION_ID NUMBER(15) NOT NULL,
    this is the table structure now if
    for the same employee the organization id changes I need to caputre those emp
    whose organization is chaged....using organization_id and the person_id
    how to do that?

    Audit the table, use a trigger and a history/journaling table, for example:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_triggers.htm#ABC1032282
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:59412348055

  • Logic for this requirement

    Hi friends,
    I get salary from different tables... like for example
    m_sal and e_sal..if the salary is null in m_sal i have to select salary from e_sal and viceversa
    can you pls tell me how to do this
    Thanks

    You would still use COALESCE
    SQL> with
      2  emp as
      3      (
      4      select 1 empno from dual union all
      5      select 2 empno from dual union all
      6      select 3 empno from dual union all
      7      select 4 empno from dual union all
      8      select 5 empno from dual union all
      9      select 6 empno from dual
    10      ),
    11  sal1 as
    12      (
    13      select 1 empno, 100 esal from dual union all
    14      select 3 empno, 200 esal from dual union all
    15      select 5 empno, 100 esal from dual union all
    16      select 6 empno, 300 esal from dual
    17      ),
    18  sal2 as
    19      (
    20      select 2 empno, 600 msal from dual union all
    21      select 4 empno, 500 msal from dual
    22      )
    23  select
    24      e.empno,
    25      coalesce
    26          (
    27              (select sal1.esal from sal1 where sal1.empno = e.empno),
    28              (select sal2.msal from sal2 where sal2.empno = e.empno)
    29          ) sal
    30  from
    31      emp e;
         EMPNO        SAL
             1        100
             2        600
             3        200
             4        500
             5        100
             6        300
    6 rows selected.

  • 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.

Maybe you are looking for

  • Not Able To Use Recovery Discs

    I am trying to recover my Windows Vista Home Premium 64-bit OS using the discs I purchased from HP.com However, when I insert the disc into the drive and restart my computer it tries to load the operating system again. The operating system is corrupt

  • Font Book does not allow me to move fonts into categories.

    I recently started using Pages to do some desktop publishing work and I decided it would help me out to make some font categories so I can find the fonts I need quickly. I set up the categories in Font Book, but after three tries in two days am about

  • Error for rman for RAC db

    Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database: TEST (DBID=485988764) connected to recovery catalog database RMAN> run { 2> resync catalog; 3> allocate channel oem_backup_disk1 type disk 4> format '/misc/OraBackup

  • CS3: elements sorting of selection object

    Hi people! I think U know that in CS2 app.selection[0] always return LAST selected object and app.selection[app.selection.length] return FIRST selected object its logically good way. but in CS3 Adobe changed this order. And now sorting of objects in

  • How to center page designed in Edge

    Hi, Can someone please tell me if there is a way to make a page created in Edge to center vertically on the browsers? It seems to default to top left. Thanks