Help in abap code logic

hallow
i have two tables that i wont to move the data(price) to third table itab
i wont to now how i can do that?
<b>i reward kindly</b>
i give the tabls.
INTAB_A132[]
resrc             date             knumh
0000123456 20070101 0000014834
0000123456 20070601 0000014835
2) intab_konp
knumh (key)     kbetr(price)    
0000014834   200000.00
0000014834   250000.00
this is what i have in table zempkostlprice_rec and i wont to add price colman
zempkostlprice_rec
rserc                date
1 0000123456 012007
2 0000123456 022007
3 0000123456 032007
4 0000123456 042007
5 0000123456 052007
6 0000123456 062007
7 0000123456 072007
8 0000123456 082007
9 0000123456 092007
10 0000123456 102007
11 0000123456 112007
12 0000123456 122007
13 0000123456 012008
this is what i wont to add price colman to thired table from intab_konp
u can see that price have to be change after 01062007 to 250000
resrc                   date             price
<b>1 0000123456  012007             20000.00</b>
2 0000123456      01022007         20000.00
3 0000123456     01032007        20000.00
4 0000123456     01042007         20000.00
5 0000123456     01052007          20000.00
<b>6 0000123456  01062007         250000.00</b>
7 0000123456     01072007          250000.00
8 0000123456     01082007          250000.00
9 0000123456     01092007         250000.00
10 0000123456   01102007          250000.00
11 0000123456    01112007         250000.00
12 0000123456   01122007          250000.00
13 0000123456   01 012008        250000.00
hi itry with that code  but its not working i get in colman 2000000 in all rows
i thihk i have to take care in dates but i dont now how?
regards
LOOP AT zempkostlprice_rec INTO wa_zem.
READ TABLE intab_a132 INTO wa_intab_a132 WITH KEY resrc = wa_zem-resrc.
READ TABLE intab_konp INTO wa_intab_konp WITH KEY knumh = wa_intab_a132-knumh.
IF sy-subrc = 0.
wa_zem-kbetr = wa_intab_konp-kbetr.
MODIFY zempkostlprice_rec FROM wa_zem TRANSPORTING kbetr.
ENDIF.
ENDLOOP.

Create a new zprogram and put this code and check the values of internal tables in debugging mode
the price value chages according to knumh value becoz u have given intab_konp table which has common knumh so using this field only we can modify in ur zemp* table.
REPORT  ZSHYTAL.
TYPES: BEGIN OF t_a132,
resrc LIKE a132-resrc,
kostl LIKE a132-kostl,
datbi LIKE a132-datbi,
datab LIKE a132-datab,
knumh LIKE a132-knumh,
END OF t_a132.
TYPES: BEGIN OF t_konp,
knumh LIKE konp-knumh,
kstbm LIKE konp-kstbm,
kbetr LIKE konp-kbetr,
konwa TYPE konp-konwa,
END OF t_konp.
types: begin of t_zemp,
        RESRC like a132-resrc,
        KOSTL LIKE a132-kostl,
        kstbm LIKE konp-kstbm,
        konwa TYPE konp-konwa,
        kbetr LIKE konp-kbetr,
        knumh LIKE konp-knumh,
      END OF t_zemp.
DATA: intab_konp TYPE TABLE OF t_konp WITH HEADER LINE .
DATA : intab_a132 TYPE TABLE OF t_a132 WITH HEADER LINE .
data: it_zemp type TABLE OF t_zemp WITH HEADER LINE.
it_zemp-resrc = '0000123456'.
it_zemp-knumh = '0000014834'.
APPEND it_zemp.
it_zemp-resrc = '0000123456'.
it_zemp-knumh = '0000014834'.
APPEND it_zemp.
it_zemp-resrc = '0000123456'.
it_zemp-knumh = '0000014835'.
APPEND it_zemp.
intab_a132-resrc = '0000123456'.
intab_a132-knumh = '0000014834'.
intab_a132-datbi = '20070531'.
intab_a132-datab = '20070101'.
APPEND intab_a132.
intab_a132-resrc = '0000123456'.
intab_a132-knumh = '0000014835'.
intab_a132-datbi = '200701231'.
intab_a132-datab = '20070601'.
APPEND intab_a132.
intab_konp-knumh = '0000014834'.
intab_konp-kbetr = '20000'.
APPEND intab_konp.
intab_konp-knumh = '0000014835'.
intab_konp-kbetr = '25000'.
APPEND intab_konp.
clear: intab_konp, intab_a132, it_zemp.
LOOP at it_zemp. "into wa_zemp.
  READ TABLE intab_a132 WITH KEY resrc = it_zemp-resrc.
  READ TABLE intab_konp WITH key knumh = it_zemp-knumh.
  if sy-subrc eq 0.
    move intab_konp-kbetr to it_zemp-kbetr.
    modify it_zemp." from wa_zemp.
  ENDIF.
endloop.

Similar Messages

  • Need help in ABAP code to Enhance the Extract Structure ?????

    Hi all,
        I want to enhance the extract structure to get KBETR & KBRUE fields of KONP table since it didn’t allow me to add those fields while creating the generic extractor because of currency key problems. I want to read all KONP records into internal table with KNUMH (Key). Next, I want to fill them into ZZKBETR & ZZKBRUE of Extract Structure ZOXUR40065 in loop.
    DATA:
      i_t_zrebate like ZOXUR40065 occurs 0 with header line,
      reb_tabix like sy-tabix.
    TABLES: KONP.
      Could you please help me in completing the ABAP code?
    Thanks,
    Venkat.

    Hello Manga,
        I have included the following code in ZXRSAU01:
    WHEN 'ZREBATE'.
    PERFORM ZREBATE_EXIT TABLES C_T_DATA.
    After Double click on ZREBATE_EXIT on perform statement, it created ZXRSAF01 include and the following code is added in it:
    FORM ZREBATE_EXIT TABLES FP_C_T_DATA STRUCTURE ZOXUR40065.
    DATA:
    i_t_zrebate like ZOXUR40065 occurs 0 with header line,
    reb_tabix like sy-tabix.
    FIELD-SYMBOLS: <l_c_t_data> TYPE ZOXUR40065.
    LOOP AT fp_c_t_data ASSIGNING <l_c_t_data>.
    reb_tabix = sy-tabix.
    select single KBETR KBRUE
    into (<l_c_t_data>-ZZKBETR,
    <l_c_t_data>-ZZKBRUE,
    from KONP
    where KNUMH eq <l_c_t_data>-KNUMH.
    if sy-subrc eq 0.
    MODIFY fp_c_t_data FROM <l_c_t_data> INDEX reb_tabix.
    endif.
    CLEAR:reb_tabix.
    ENDLOOP.
    ENDFORM.
    When I tried to Activate this ZXRSAF01 include, it fails with 'The FORM "ZREBATE_EXIT" does not exist'.
      Should it be FP_C_T  or P_C_T? I found P_C_T in ZXRSAF01 include.
      What is wrong with it, please ?
       Can't I add this whole code in main include ZXRSAU01itself?
      The Extractor ZREBATE is based on KONA, KONH & KONP tables. This Extractor and KONA table have the same 4000 records and KONP has 13000 records. I want to extract KBERT & KBRUE from KONP.
       Thanks in advance.
    Regards,
    Venkat

  • Syntax helper for ABAP code?

    Please, I would like to ask any of you ABAP developers with some expirience...is there any tool (inside or outside the Workbench) that can color the syntax of ABAP code... (the way it is done in some other IDEs like Visual Studio, JBuilder or even Ultra Edit...) ???

    There are some IDE external of SAP that do that. But .. I try it and don't like that.
    Ex : http://www.sapedit.com/
    Wait for next release, there will be some new stuff.
    Frédéric

  • Help in ABAP code please!

    We have upgraded to ECC6.0 and I am trying to fix some syntax errors. Here is the piece of code with the problem:
    ====
    import i_key
               old_zsops to old_zzsops
               new_zsops to new_zzsops
               from database zsopshist(Z1)
               id i_key.
         import i_key
               old_zsops to old_prezsops
               new_zsops to new_prezsops
               from database zsopshist(Z1)
               id i_key.
    =====
    I am kind of new to ABAP and went throught the documentation but could someone please tell me what "old_zsops to old_zzsops" does?
    The code above is causing the dump with error "Error when attempting to IMPORT object "OLD_ZSOPS"". I went through the code and I found that old_zsops and new_zsops is not declared at all and it doesn't give any compilation errors! It goes to dump when I execute the problem. If it is required I would send the whole code but I see the following declarations in the code:
    data: old_prezsops like zsops_prev.     "PJCHG10854
    data: new_prezsops like zsops_prev.     "PJCHG10854
    data: old_zzsops like zsops.            "PJCHG10854
    data: new_zzsops like zsops.            "PJCHG10854
    data: long_rec(900) type c.             "PJCHG10854
    data: old_lzsops like long_rec.         "PJCHG10854
    data: new_lzsops like long_rec.         "PJCHG10854
    data: curr_zsops like zsops,
          prev_zsops like zsops_prev.
    Could someone please help me how to fix this problem? How do I declare "old_zsops and new_zsops" because they are used in 2 different import statements? All the answers will be rewarded.
    Thanks.
    Mithun

    Everything is in the same porgram. To avoid confusion I will send the whole code:
    ===
    REPORT ZCFICO6010
             line-count 65
             line-size 132
             no standard page heading.
    tables: zsopshist, zsops.
    *data: old_zsops like zsops,
         new_zsops like zsops.
    data: old_prezsops like zsops_prev.     "PJCHG10854
    data: new_prezsops like zsops_prev.     "PJCHG10854
    data: old_zzsops like zsops.            "PJCHG10854
    data: new_zzsops like zsops.            "PJCHG10854
    data: long_rec(900) type c.             "PJCHG10854
    data: old_lzsops like long_rec.         "PJCHG10854
    data: new_lzsops like long_rec.         "PJCHG10854
    data: curr_zsops like zsops,
          prev_zsops like zsops_prev.
    data: begin of i_key,
      kostl(5),
      aedat(8),
      cputm(6).
    data:   end of i_key.
    DATA: HEADER like zsops-oprcd,
          header1(92) type c.
        header1 like header.
    data: v_field(18) type c,
          v_old(20)  type c,
          v_new(20)  type c,
          user like zsops-uname,
          date like zsops-aedtm.
    data: begin of table occurs 0,
          text(20) type c,
          oprcd like zsops-oprcd,
          field(15) type c,
          user like zsops-uname,
          date like zsops-aedtm,
          v_old(20) ,
          v_new(20) ,
        end of table.
    data: text(30) type c.
    data: begin of itab occurs 0,
           srtfd like zsopshist-srtfd,
         end of itab.
    *data: ihist like old_zsops occurs 0 with header line,
         nhist like new_zsops occurs 0 with header line.
    data: ihist like zsops occurs 0 with header line,
          nhist like zsops occurs 0 with header line.
    *&      Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK one WITH FRAME TITLE TEXT-200.
    parameters: s_oprcd  like zsops-oprcd obligatory,
                s_oprcdh like zsops-oprcd .
                    s_cputm   for sy-uzeit.
    SELECTION-SCREEN END OF BLOCK one.
    SELECTION-SCREEN BEGIN OF BLOCK three WITH FRAME TITLE TEXT-300.
    parameters:s_aedtm  like zsops-aedtm obligatory,
    s_aedtmh like zsops-aedtm obligatory.
    SELECTION-SCREEN END OF BLOCK three.
    SELECTION-SCREEN BEGIN OF BLOCK TWO WITH FRAME TITLE TEXT-100.
    PARAMETERS: P_REGSRT RADIOBUTTON GROUP RADI,
                P_ACCSRT RADIOBUTTON GROUP RADI.
    SELECTION-SCREEN END OF BLOCK TWO.
    parameters: new_date like sy-datum obligatory default '20051214'.
    *&      Top-Of-Page
    top-of-page.
    BEGIN OF BLOCK INSERTED FOR                              "JJMM20040330
      DATA: CC_LOW LIKE ZSOPS-OPRCD,
            CC_HIGH LIKE ZSOPS-OPRCD,
            FROM_DATE(10) TYPE C,
            TO_DATE(10)   TYPE C.
      WRITE: S_OPRCD TO CC_LOW NO-ZERO,
             S_AEDTM TO FROM_DATE USING EDIT MASK '__/__/____',
             S_AEDTMH TO TO_DATE USING EDIT MASK '__/__/____'.
      IF S_OPRCDH = S_OPRCD.
        CONCATENATE: 'Cost Center'(T02) CC_LOW 'Changed On'(T04) FROM_DATE
                     'To'(T03) TO_DATE 'Sort By'(T05) text INTO HEADER1
                     separated by space.
      ELSE.
        WRITE: S_OPRCDH TO CC_HIGH NO-ZERO.
        CONCATENATE: 'Cost Center'(T02) CC_LOW 'To'(T03) CC_HIGH
                     'Changed On'(T04) FROM_DATE 'To'(T03) TO_DATE
                     'Sort By'(T05) text INTO HEADER1 separated by space.
      ENDIF.
    END OF BLOCK INSERTED FOR                                "JJMM20040330
      PERFORM DISPLAY_PAGE_HEADER(ZCLT0001) USING
                                          header1            "JJMM20040330
                                            HEADER
                                            TEXT-T01
                                            header1.           "JJMM20040330
    BEGIN OF BLOCK COMMENTED OUT FOR                         "JJMM20040330
    write:/5 'Cost Center'(T02), s_oprcd+5(5), 'To'(T03), s_oprcdh,
           40 'Changed On'(T04), s_aedtm, 'To'(T03), s_aedtmh,
           85 'Sort by'(T05), text.
    uline. skip.
    END OF BLOCK COMMENTED OUT FOR                           "JJMM20040330
      Write:/ 'Field Changed'(C01), 25 'Old Values'(C02),
               55 'New Values'(C03), 85 'Cost Center'(C04),
              105 'Changed By'(C05), 120 'Changed On'(C06).
      uline.
    start-of-selection.
      data: time(6),
            v_subrc like sy-subrc,
            prev_format(1),
            srtfd like zsopshist-srtfd,
            srtfdh like zsopshist-srtfd.
      srtfd0(5) = s_oprcd5(5).
      srtfd+5(8) = s_aedtm.
      srtfd+13(6) = '000000'.
       if s_oprcdh is initial.
         s_oprcdh = s_oprcd.
       endif.
      srtfdh0(5) = s_oprcdh5(5).
      srtfdh+5(8) = s_aedtmh.
      srtfdh+13(6) = '999999'.
      select srtfd from zsopshist into table itab
              WHERE  SRTFD >= SRTFD
              AND    SRTFD <= SRTFDH.
    sort itab by srtfd.
      loop at itab.
        IF ITAB+5(8) GE S_AEDTM  AND                            "IJHM00001
            ITAB+5(8) LE S_AEDTMH.                              "IJHM00001
          move: itab+0(5)          to i_key-kostl,
                itab+5(8)          to i_key-aedat,
                itab+13(6)         to i_key-cputm.
    /---  PJCHG10854 Begin commented/New code                     /
    /---  To change the import structure based on date the old    /
    /---  import was removed and following coded added.           /
          clear: v_subrc, prev_format.
          if itab+5(8) lt new_date.
            prev_format = 'X'.
            perform import_record_prev changing v_subrc.      "PJCHG10854
          else.
            perform import_record changing v_subrc.           "PJCHG10854
          endif.
         import i_key
              old_zsops
              new_zsops
              from database zsopshist(Z1)
              id i_key.
    /---   PJCHG10854 END commented/New code                /
          if v_subrc = 0.                                     "PJCHG10854
            perform get_final_table.
          endif.
        ENDIF.                                                  "IJHM00001
      endloop.
      if p_regsrt = 'X'.
        sort table by oprcd field date descending.
        text = 'Cost Center'(C04).
      else.
        sort table by field oprcd date descending.
        text = 'Field Changed'(C01).
      endif.
       perform write_report.
          FORM get_final_table                                          *
    form get_final_table.
    move old_zsops to ihist.           "PJCHG10854
    move new_zsops to nhist.           "PJCHG10854
      if prev_format eq 'X'.              "PJCHG10854
        move old_prezsops to ihist.       "PJCHG10854
        move new_prezsops to nhist.       "PJCHG10854
      else.                               "PJCHG10854
        move old_zzsops to ihist.         "PJCHG10854
        move new_zzsops to nhist.         "PJCHG10854
      endif.                              "PJCHG10854
      if ihist-ivcrg ne nhist-ivcrg.
       table-text = 'Invst Charge Base'(F01).
       table-field = 'IVCRG'.
        table-v_old   = ihist-ivcrg.
        table-v_new   = nhist-ivcrg.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-mgtfp ne nhist-mgtfp.
        table-field = 'MGTFP'.
        table-text = 'Mgt Fee %'(F02).
        table-v_old(12)   = ihist-mgtfp.
        table-v_new(12)   = nhist-mgtfp.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-discd ne nhist-discd.
        table-field = 'DISCD'.
        table-text = 'Cash Disc. Passback'(F03).
        table-v_old   = ihist-discd.
        table-v_new   = nhist-discd.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-consc ne nhist-consc.
        table-field = 'CONSC'.
        table-text = 'Subsidy Calc'(F04).
        table-v_old   = ihist-consc.
        table-v_new   = nhist-consc.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-payfart ne nhist-payfart.
        table-field = 'PAYFART'.
        table-text = 'Payroll Fringe'(F05).
        table-v_old(12)   = ihist-payfart.
        table-v_new(12)   = nhist-payfart.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-frbpb ne nhist-frbpb.
        table-field = 'FRBPB'.
        table-text = 'Rebate Pass Back'(F06).
        table-v_old(12)   = ihist-frbpb.
        table-v_new(12)   = nhist-frbpb.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-exlca ne nhist-exlca.
        table-field = 'EXLCA'.
        table-text = 'Excl Source27'(F07).
        table-v_old   = ihist-exlca.
        table-v_new   = nhist-exlca.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
      perform write_report.
        append table.
      endif.
      if ihist-exlcb ne nhist-exlcb.
        table-field = 'EXLCB'.
        table-text = 'Excl Source11'(F08).
        table-v_old   = ihist-exlcb.
        table-v_new   = nhist-exlcb.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
      perform write_report.
        append table.
      endif.
      if ihist-trnrate ne nhist-trnrate.
        table-field = 'TRNRATE'.
        table-text = 'Payroll Training'(F09).
        table-v_old(12)   = ihist-trnrate.
        table-v_new(12)   = nhist-trnrate.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-mgffa ne nhist-mgffa.
        table-field = 'MGFFA'.
        table-text = 'Mgt Fee Amt'(F10).
        table-v_old(12)   = ihist-mgffa.
        table-v_new(12)   = nhist-mgffa.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
      perform write_report.
        append table.
      endif.
      if ihist-mgtfi ne nhist-mgtfi.
        table-field = 'MGTFI'.
        table-text = 'Mgt Fees Indicator'(F11).
        table-v_old   = ihist-mgtfi.
        table-v_new   = nhist-mgtfi.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
      perform write_report.
        append table.
      endif.
      if ihist-eqres ne nhist-eqres.
        table-field = 'EQRES'.
        table-text = 'Eqip Res Accrual'(F12).
      table-v_old = ihist-eqres.                             "JJMM20040331
      table-v_new = nhist-eqres.                             "JJMM20040331
        table-v_old(12) = ihist-eqres.                         "JJMM20040331
        table-v_new(12) = nhist-eqres.                         "JJMM20040331
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-ovrhd ne nhist-ovrhd.
        table-field = 'OVRHD'.
        table-text = 'OverHead Amt'(F13).
        table-v_old(12)   = ihist-ovrhd.
        table-v_new(12)   = nhist-ovrhd.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
        if ihist-xaccural ne nhist-xaccural.
        table-field = 'XACCUARAL'.
        table-text = 'Exclude Accrual'(F14).
        table-v_old(12)   = ihist-xaccural.
        table-v_new(12)   = nhist-xaccural.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
      if ihist-ovrrt ne nhist-ovrrt.
        table-field = 'OVRRT'.
        table-text = 'OverHead Rate'(F15).
        table-v_old(12)   = ihist-ovrrt.
        table-v_new(12)   = nhist-ovrrt.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
        if ihist-ztbd01 ne nhist-ztbd01.
        table-field = 'ZTBD01'.
      table-text = 'Char1'.                                  "JJMM20040330
        table-text = 'Meal Allowance'(F16).                    "JJMM20040330
        table-v_old   = ihist-ztbd01.
        table-v_new   = nhist-ztbd01.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    BEGIN OF BLOCK INSERTED FOR                            "JJMM20040330
      if ihist-earlybil ne nhist-earlybil.
        table-field = 'EARLYBIL'.
        table-text = 'Early Billing'(F17).
        table-v_old   = ihist-earlybil.
        table-v_new   = nhist-earlybil.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
      if ihist-combined ne nhist-combined.
        table-field = 'COMBINED'.
        table-text = 'Combined Billing'(F18).
        table-v_old   = ihist-COMBINED.
        table-v_new   = nhist-COMBINED.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    END OF BLOCK INSERTED FOR                                "JJMM20040330
        if ihist-rate1 ne nhist-rate1.
        table-field = 'RATE1'.
        table-text = 'Rate 1'(F19).
        table-v_old(12)   = ihist-rate1.
        table-v_new(12)  = nhist-rate1.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate2.                            "JJMM20040330
      table-field = 'RATE1'.                                 "JJMM20040330
    if ihist-rate2 ne nhist-rate2.                            "JJMM20040330
        table-field = 'RATE2'.                                 "JJMM20040330
        table-text = 'Rate 2'(F20).
        table-v_old(12)   = ihist-rate2.
        table-v_new(12)   = nhist-rate2.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate3.                            "JJMM20040330
    if ihist-rate3 ne nhist-rate3.                            "JJMM20040330
        table-field = 'RATE3'.
        table-text = 'Rate 3'(F21).
        table-v_old(12)   = ihist-rate3.
        table-v_new(12)   = nhist-rate3.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate4.                            "JJMM20040330
    if ihist-rate4 ne nhist-rate4.                            "JJMM20040330
        table-field = 'RATE4'.
        table-text = 'Rate 4'(F22).
        table-v_old(12)   = ihist-rate4.
        table-v_new(12)   = nhist-rate4.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate5.                            "JJMM20040330
    if ihist-rate5 ne nhist-rate5.                            "JJMM20040330
        table-field = 'RATE5'.
        table-text = 'Rate 5'(F23).
        table-v_old(12)   = ihist-rate5.
        table-v_new(12)   = nhist-rate5.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate6.                            "JJMM20040330
    if ihist-rate6 ne nhist-rate6.                            "JJMM20040330
        table-field = 'RATE6'.
        table-text = 'Rate 6'(F24).
        table-v_old(12)   = ihist-rate6.
        table-v_new(12)   = nhist-rate6.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate7.                            "JJMM20040330
    if ihist-rate7 ne nhist-rate7.                            "JJMM20040330
        table-field = 'RATE7'.
        table-text = 'Rate 7'(F25).
        table-v_old(12)   = ihist-rate7.
        table-v_new(12)   = nhist-rate7.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate8.                            "JJMM20040330
    if ihist-rate8 ne nhist-rate8.                            "JJMM20040330
        table-field = 'RATE8'.
        table-text = 'Rate 8'(F26).
        table-v_old(12)   = ihist-rate8.
        table-v_new(12)   = nhist-rate8.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate9.                            "JJMM20040330
    if ihist-rate9 ne nhist-rate9.                            "JJMM20040330
        table-field = 'RATE9'.
        table-text = 'Rate 9'(F27).
        table-v_old(12)   = ihist-rate9.
        table-v_new(12)   = nhist-rate9.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate10.                           "JJMM20040330
    if ihist-rate10 ne nhist-rate10.                          "JJMM20040330
        table-field = 'RATE10'.
        table-text = 'Rate 10'(F28).
        table-v_old(12)   = ihist-rate10.
        table-v_new(12)   = nhist-rate10.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    *if ihist-rate1 ne nhist-rate11.                           "JJMM20040330
    if ihist-rate11 ne nhist-rate11.                          "JJMM20040330
       table-field = 'RATE11'.
        table-text = 'Rate 11'(F29).
        table-v_old(12)   = ihist-rate11.
        table-v_new(12)   = nhist-rate11.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      perform write_report.
      endif.
    The following lines of code have been added per change IJHM00001
    if ihist-rate12 ne nhist-rate12.
       table-field = 'RATE12'.
        table-text = 'Rate 12'(F30).
        table-v_old(12)   = ihist-rate12.
        table-v_new(12)   = nhist-rate12.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate13 ne nhist-rate13.
       table-field = 'RATE13'.
        table-text = 'Rate 13'(F31).
        table-v_old(12)   = ihist-rate13.
        table-v_new(12)   = nhist-rate13.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate14 ne nhist-rate14.
       table-field = 'RATE14'.
        table-text = 'Rate 14'(F32).
        table-v_old(12)   = ihist-rate14.
        table-v_new(12)   = nhist-rate14.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate15 ne nhist-rate15.
       table-field = 'RATE15'.
        table-text = 'Rate 15'(F33).
        table-v_old(12)   = ihist-rate15.
        table-v_new(12)   = nhist-rate15.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate16 ne nhist-rate16.
       table-field = 'RATE16'.
        table-text = 'Rate 16'(F34).
        table-v_old(12)   = ihist-rate16.
        table-v_new(12)   = nhist-rate16.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate17 ne nhist-rate17.
       table-field = 'RATE17'.
        table-text = 'Rate 17'(F35).
        table-v_old(12)   = ihist-rate17.
        table-v_new(12)   = nhist-rate17.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate18 ne nhist-rate18.
       table-field = 'RATE18'.
        table-text = 'Rate 18'(F36).
        table-v_old(12)   = ihist-rate18.
        table-v_new(12)   = nhist-rate18.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    The following lines of code have been added per change IJHM00002
    if ihist-rate19 ne nhist-rate19.
       table-field = 'RATE19'.
        table-text = 'Rate 19'(F37).
        table-v_old(12)   = ihist-rate19.
        table-v_new(12)   = nhist-rate19.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate20 ne nhist-rate20.
       table-field = 'RATE20'.
        table-text = 'Rate 20'(F38).
        table-v_old(12)   = ihist-rate20.
        table-v_new(12)   = nhist-rate20.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate21 ne nhist-rate21.
       table-field = 'RATE21'.
        table-text = 'Rate 21'(F39).
        table-v_old(12)   = ihist-rate21.
        table-v_new(12)   = nhist-rate21.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-rate22 ne nhist-rate22.
       table-field = 'RATE22'.
        table-text = 'Rate 22'(F40).
        table-v_old(12)   = ihist-rate22.
        table-v_new(12)   = nhist-rate22.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-intcrb ne nhist-intcrb.
       table-field = 'INTCRB'.
        table-text = 'Intcrb'(F47).                             "IJHM00002
       table-text = 'Intcrb'(F37).                            "IJHM00002
        table-v_old   = ihist-intcrb.
        table-v_new   = nhist-intcrb.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-intcrr ne nhist-intcrr.
       table-field = 'INTCRR'.
        table-text = 'Intcrr'(F48).                             "IJHM00002
       table-text = 'Intcrr'(F38).                            "IJHM00002
        table-v_old(12)   = ihist-intcrr.
        table-v_new(12)   = nhist-intcrr.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-zwktran ne nhist-zwktran.
       table-field = 'ZWKTRAN'.
        table-text = 'Data Trans End Unit'(F49).                "IJHM00002
       table-text = 'Data Trans End Unit'(F39).               "IJHM00002
        table-v_old   = ihist-zwktran.
        table-v_new   = nhist-zwktran.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-zwkbud ne nhist-zwkbud.
       table-field = 'ZWKBUD'.
        table-text = 'Wkly Budget Ind'(F50).                    "IJHM00002
       table-text = 'Wkly Budget Ind'(F40).                   "IJHM00002
        table-v_old   = ihist-zwkbud.
        table-v_new   = nhist-zwkbud.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-bcycle ne nhist-bcycle.
       table-field = 'BCYCLE'.
        table-text = 'Bcycle'(F51).                             "IJHM00002
       table-text = 'Bcycle'(F41).                            "IJHM00002
        table-v_old   = ihist-bcycle.
        table-v_new   = nhist-bcycle.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    if ihist-ovind ne nhist-ovind.
       table-field = 'OVIND'.
        table-text = 'Ovind'(F52).                              "IJHM00002
       table-text = 'Ovind'(F42).                             "IJHM00002
        table-v_old   = ihist-ovind.
        table-v_new   = nhist-ovind.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    *New code for PRSID -
    "ZN032106
      if ihist-prsid ne nhist-prsid.
       table-field = 'PRSID'.
        table-text = 'PRSID'(F53).
        table-v_old   = ihist-prsid.
        table-v_new   = nhist-prsid.
        table-user    = nhist-uname.
        table-date    = nhist-aedtm.
        table-oprcd = nhist-oprcd.
        append table.
      endif.
    *End of new code----
    "ZN032106
    endform.
          FORM write_report                                             *
    form write_report.
    loop at table.
      write:/1 table-text,   25 table-v_old(12) left-justified,
             55 table-v_new(12) left-justified, 85 table-oprcd,
             106 table-user, 120 table-date.
      uline.
    endloop.
    skip 5.                                                    "JJMM20040330
    write:/35 TEXT-R01.                                        "JJMM20040330
    reserve 1 lines.                                           "JJMM20040330
    endform.
    *&      Form  import_record
    form import_record changing p_subrc.
         import i_key
               old_zsops to old_zzsops
               new_zsops to new_zzsops
               from database zsopshist(Z1)
               id i_key.
         p_subrc = sy-subrc.
    endform.                    " import_record
    *&      Form  import_record_prev
    form import_record_prev changing p_subrc.
         import i_key
               old_zsops to old_prezsops
               new_zsops to new_prezsops
               from database zsopshist(Z1)
               id i_key.
         p_subrc = sy-subrc.
    endform.                    " import_record_prev
    *&      Form  import_record_long
    form import_record_long changing p_subrc.
         import i_key
               old_zsops to old_lzsops
               new_zsops to new_lzsops
               from database zsopshist(Z1)
               id i_key.
         p_subrc = sy-subrc.
    endform.                    " import_record_prev
    ========
    Thanks.
    Mithun

  • Help with abap code in Transformation

    Hi Experts,
    we have a scenario where we load delta data from an DSO into a Cube.
    The records in the DSO looks like below.
    Location as (L)
    WorkOrder as (W)
    Startdate(DDMMYYYY)/time (HH:MM:SS) as (S)
    Finishdate/time as (F)
    L1
    W1
    21/04/2009/10:00:00
    21/04/2009/12:00:00
    L1
    W2
    21/04/2009/14:00:00
    21/04/2009/23:00:00
    || L1 ||W3||  21/04/2009/16:00:00 ||21/04/2009/20:00:00 || 
    Total time ( April 2009 ) for above Location L1 should be calculated as a difference between W1 and W2 since W3 is a overlapping record. So the result would be 13 Hrs. Work Orders are summarised, so we dont need work order info in the output.
    Can you experts help me with the code to implement??
    Thanks,
    DV

    For each location, for example L1, move the records to an internal table itab.
    sort itab by startdate.
    read table itab index 1. 
    You will get the first value.
    sort itab by finishdate descending.
    read table itab index 1.
    you will get the second value.
    Calculate the difference and populate it to the internal table.
    finally modify the source package.
    I have just given the logic.  I hope you can build upon this.
    I hope it helps.
    Thanks.

  • Help on ABAP code to trigger an Email with HTML attachment

    Hi folks,
                Could any of you help me out in writing code to attach a HTML document to the internet email address.
          I was able to convert the list output to HTML using FM WWW_LIST_TO_HTML.
          Could some help me out how to attach HTML doc to the Email  using any of the FM SO_DOCUMENT_SEND_API1 or  SO_NEW_DOCUMENT_SEND_API1 or any other.
          I tried some of the examples available in the forum, but I couldnot find one that actually send the list output(in HTML format) as attachment to email
    points will be rewarded for helpful responses...
       Thanks In Advance.
        Suku

    Hi,
    REPORT  zkiran_send_mail_bor                    .
    *& Report  Zkiran_SEND_MAIL_BOR
    *&  Send document with BOR Object as attachment
    DATA: docdata    LIKE sodocchgi1,
          objpack    LIKE sopcklsti1 OCCURS 10 WITH HEADER LINE,
          objhead    LIKE solisti1   OCCURS 10 WITH HEADER LINE,
          objtxt     LIKE solisti1   OCCURS 10 WITH HEADER LINE,
          objbin     LIKE solisti1   OCCURS 10 WITH HEADER LINE,
          objhex     LIKE solix      OCCURS 10 WITH HEADER LINE,
          reclist    LIKE somlreci1  OCCURS  1 WITH HEADER LINE.
    DATA: tab_lines  TYPE i,
          doc_size   TYPE i,
          objdes(100).
    For the BOR attachment
    CONSTANTS:
      c_object_describe LIKE swotobjid-describe VALUE '<OBJECT>'.
    DATA:
      l_object      TYPE swotobjid,
      l_objheader   LIKE soxobj.
    PARAMETERS:
      p_objtyp TYPE swo_objtyp OBLIGATORY,
      p_objkey TYPE swo_typeid OBLIGATORY.
    Create Message Body
      Main Text
    objtxt = 'Test Document.'.
    APPEND objtxt.
    objtxt = 'You will find a BOR object attachment in message.'.
    APPEND objtxt.
    objtxt = 'Have a nice day.'.
    APPEND objtxt.
      Title and Description
    DESCRIBE TABLE objtxt LINES tab_lines.
    READ     TABLE objtxt INDEX tab_lines.
    docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    docdata-obj_name  = 'BOR Object'.
    Concatenate p_objtyp '-' p_objkey into objdes.
    Concatenate 'BOR Object' objdes 'as Attachment'
           into docdata-obj_descr separated by space.
    condense docdata-obj_descr.
      Write Packing List (Main)
    CLEAR objpack-transf_bin.
    objpack-head_start = 0.
    objpack-head_num   = 0.
    objpack-body_start = 1.
    objpack-body_num   = tab_lines.
    objpack-doc_type   = 'RAW'.
    APPEND objpack.
    Create OBJ attachment
    l_object-describe = c_object_describe.
    l_object-objtype  = p_objtyp.
    l_object-objkey   = p_objkey.
    CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
      IMPORTING
        own_logical_system             = l_object-logsys
      EXCEPTIONS
        own_logical_system_not_defined = 1
        OTHERS                         = 2.
    IF sy-subrc <> 0.
      MESSAGE e398(00) WITH 'No Log Sys Found'.
    ENDIF.
    MOVE-CORRESPONDING l_object TO l_objheader.
    APPEND l_objheader TO objhead.
      Write Packing List (Attachment)
    CLEAR objpack.
    objpack-head_start = 1.
    objpack-head_num   = 1.
    objpack-body_start = 0.
    objpack-body_num   = 0.
    objpack-doc_type   = 'OBJ'.
    objpack-obj_name   = p_objtyp.
    objpack-obj_descr  = Objdes.
    APPEND objpack.
    Create receiver list
    reclist-receiver = sy-uname.
    reclist-rec_type = 'B'.
    APPEND reclist.
    Send Message
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = docdata
        put_in_outbox              = 'X'
        commit_work                = 'X'   
      TABLES
        packing_list               = objpack
        object_header              = objhead
        contents_bin               = objbin
        contents_txt               = objtxt
        receivers                  = reclist
      EXCEPTIONS
        too_many_receivers         = 1
        document_not_sent          = 2
        document_type_not_exist    = 3
        operation_no_authorization = 4
        parameter_error            = 5
        x_error                    = 6
        enqueue_error              = 7
        OTHERS                     = 8.
    IF sy-subrc <> 0.
      MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
              WITH docdata-obj_name.
    ENDIF.
    WRITE: / 'End of Program'.
    also <b>check BCS_EXAMPLE*</b>
    <b>Reward points</b>
    Regards

  • Abap code Logic for splitting is not working

    Hi,
    I have a requirement to split a single amount and product into several parts. so far my logic is not working as only the first row is being fetched.
    TYPES: BEGIN of map_tab,
             ZPRODH4 TYPE NEWMAPPINGTABLE-/BIC/ZNEW_MP,
             ZSPRATIO TYPE NEWMAPPINGTABLE-/BIC/ZSP_RATIO,
             ZMATERIAL TYPE NEWMAPPINGTABLE-MATERIAL,
           END OF map_tab.
    Data:IT_MAP_TAB TYPE HASHED table of MAP_TAB with unique Key ZPRODH4,
         wa_it_map_tab like line of IT_MAP_TAB.
    Data rp TYPE _ty_s_TG_1.
    LOOP AT RESULT_PACKAGE into rp.
    Clear wa_it_map_tab.
    read table IT_MAP_TAB into wa_it_map_tab with table key ZPRODH4 =
    rp-prodh4.
    IF sy-subrc EQ 0.
    select SINGLE /BIC/ZNEW_MP /BIC/ZSP_RATIO MATERIAL into corresponding
    fields of wa_it_map_tab from NEWMAPPINGTABLE
    where  PRODH4 = rp-PRODH4.
    IF sy-subrc EQ 0.
      rp-PRODH4 = wa_it_map_tab-ZPRODH4.
      rp-AMOUNT = rp-AMOUNT * wa_it_map_tab-Zspratio.
      rp-MATERIAL = wa_it_map_tab-ZMATERIAL.
    ENDIF.
    ENDIF.
    MODIFY RESULT_PACKAGE FROM rp.
    ENDLOOP.
    <br><br>
    This is how my tables looks like
    Source Table
    PROD                                       AMOUNT
    900006600999                          1000
    400004400000                           500
    NEW MAPPING TABLE
    PROD                                      NEWPROD                      MATERIAL                             SPLITRATIO
    900006600999                         1000066001111                    7000                                         0.5
    900006600999                         1000066002222                    7001                                         0.4
    900006600999                         1000066003333                    7002                                         0.1
    OLD MAPPING TABLE
    PROD                              MATERIAL
    4000044000000               7100
    TARGET TABLE
    PROD                        PROD3               MATERIAL        AMOUNT
    1000066001111         100006600            7000                 500            
    1000066002222         100006600            7001                 400          
    1000066003333         100006600            7002                 100
    4000044000000         400004400            7100                 500

    Hi,
    I rewrote the code the like this and it is still not working as the new value is not being fetched.
    {* TABLES: ...
    Defining tables
    Tables: /BIC/OLDTABLE,/BIC/NEWTABLE.
    $$ end of global - insert your declaration only before this line -
    The follow definition is new in the BW3.x
    TYPES:
    BEGIN OF DATA_PACKAGE_STRUCTURE.
    INCLUDE STRUCTURE /BIC/CS8ZSEM_TC03.
    TYPES:
    RECNO LIKE sy-tabix,
    END OF DATA_PACKAGE_STRUCTURE.
    DATA:
    DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
    WITH HEADER LINE
    WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    New Material table
    DATA: BEGIN OF I_S_NEWTAB,
    PRODH4 TYPE /BIC/NEWTABLE-PRODH4,
    /BIC/ZNEW_MP TYPE /BIC/NEWTABLE-/BIC/ZNEW_MP,
    /BIC/ZSP_RATIO TYPE /BIC/NEWTABLE-/BIC/ZSP_RATIO,
    MATERIAL TYPE /BIC/NEWTABLE-MATERIAL,
    END OF I_S_NEWTAB.
    Data: i_t_newtab LIKE TABLE OF I_S_NEWTAB.
    *Old Material table
    DATA: BEGIN OF I_S_OLDTAB,
    PRODH4 TYPE /BIC/OLDTABLE-PRODH4,
    MATERIAL TYPE /BIC/OLDTABLE-MATERIAL,
    END OF I_S_OLDTAB.
    DATA: i_t_oldtab like table of I_S_oldTAB.
    data: e_s_result type STANDARD TABLE OF DATA_PACKAGE_STRUCTURE WITH
    HEADER LINE
    WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    data: e_t_result type STANDARD TABLE OF DATA_PACKAGE_STRUCTURE WITH
    HEADER LINE
    WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    data: amount type DATA_PACKAGE_STRUCTURE-/BIC/AMOUNT.
    data: CUSTSOLD type DATA_PACKAGE_STRUCTURE-/BIC/CUSTSOLD.
    selecting data from new table
    Select PRODH4 /BIC/ZNEW_MP /BIC/ZSP_RATIO MATERIAL FROM /BIC/NEWTABLE
    into corresponding fields of table i_t_newtab.
    SORT i_t_newtab by PRODH4.
    Selecting data from old material table
    Select PRODH4 MATERIAL FROM /BIC/OLDTABLE into corresponding fields
    of table i_t_oldtab.
    SORT i_t_oldtab by PRODH4.
    LOOP AT DATA_PACKAGE INTO e_s_result.
    read table i_t_oldtab into i_s_oldtab with key PRODH4 =
    e_s_result-PRODH4.
    if sy-subrc EQ 0.
    MOVE i_s_oldtab-PRODH4 to e_s_result-PRODH4.
    MOVE i_s_oldtab-PRODH4(14) to e_s_result-PRODH3.
    MOVE i_s_oldtab-MATERIAL to e_s_result-MATERIAL.
    APPEND e_s_result to e_t_result.
    ELSE.
    LOOP AT i_t_newtab into i_s_newtab where PRODH4 = e_s_result-PRODH4.
    amount = i_s_newtab-/BIC/ZSP_RATIO * e_s_result-/BIC/AMOUNT.
    CONCATENATE DATA_PACKAGE-SOLD_TO i_s_newtab-PRODH4(10) into AMOUNT.
    MOVE i_s_newtab-/BIC/ZNEW_MP to e_s_result-PRODH4.
    MOVE i_s_newtab-MATERIAL to e_s_result-MATERIAL.
    MOVE i_s_newtab-/BIC/ZNEW_MP(14) to e_s_result-PRODH3.
    MOVE amount to e_s_result-/BIC/AMOUNT.
    MOVE ZASTUOTE to e_s_result-/BIC/CUSTSOLD.
    APPEND e_s_result to e_t_result.
    ENDLOOP.
    ENDIF.
    ENDLOOP.
    REFRESH DATA_PACKAGE.
    MOVE e_t_result to DATA_PACKAGE[].}

  • Help with ABAP code in CMOD.

    dear all,
    can you help me solve the below abap coding problem? thanks.
    somewhere at the top
    DATA: L_S_RANGE LIKE LINE OF E_T_RANGE.
    DATA: L_S_VAR_RANGE LIKE E_T_RANGE.
          LOOP AT I_T_VAR_RANGE INTO L_S_VAR_RANGE. <-- error msg stops here.
            FIND l_s_var_range-vnam IN TABLE it_vnam.
            IF sy-subrc = 0.
              l_check = 'X'.
              EXIT.
            ENDIF.
          ENDLOOP.
    Error message...
    "L_S_VAR_RANGE" cannot be converted to the line type of "I_T_VAR_RANGE".
    Thanks all.

    Hi Try this,
    DATA: L_S_RANGE LIKE LINE OF E_T_RANGE.
    DATA: L_S_VAR_RANGE LIKE LINE OF  I_T_VAR_RANGE .
    LOOP AT I_T_VAR_RANGE INTO L_S_VAR_RANGE. <-- error msg stops here.
            FIND l_s_var_range-vnam IN TABLE it_vnam.
            IF sy-subrc = 0.
              l_check = 'X'.
              EXIT.
            ENDIF.
          ENDLOOP.
    Regards,
    Ravi

  • Help in abap code

    hallow
    i have two tables that i wont to move the data(price) from first table INTAB_A132
    to table zempkostlprice_rec. in table zempkostlprice_rec i have 2 colman one is date and resrc and i wont to add from table INTAB_A132 the price to zempkostlprice_rec
    i give example.
    <b>REMOVED BY MODERATOR</b>
    i give the tables.
    <b>INTAB_A132</b>
    resrc              date      kbetr(price)
    0000123456 20070101 20.0000
    0000123456 20070601 25.0000
    the date mean that from 01012007 until 01062007 the price where 20.0000
    <b>this is what i have in table right now zempkostlprice_rec</b> and i wont to add price colman from  INTAB_A132
    zempkostlprice_rec
    rserc date
    1 0000123456 012007
    2 0000123456 022007
    3 0000123456 032007
    4 0000123456 042007
    5 0000123456 052007
    6 0000123456 062007
    7 0000123456 072007
    8 0000123456 082007
    9 0000123456 092007
    10 0000123456 102007
    11 0000123456 112007
    12 0000123456 122007
    13 0000123456 012008
    this is what i wont to add price colman to thired table from intab_konp
    u can see that price have to be change after 01062007 to 250000
    resrc                date         price
    <b>1 0000123456 012007       20000.00
    2 0000123456 01022007      20000.00
    3 0000123456 01032007     20000.00
    4 0000123456 01042007     20000.00
    5 0000123456 01052007    20000.00</b>
    <i>6 0000123456 01062007  250000.00
    7 0000123456 01072007    250000.00
    8 0000123456 01082007   250000.00
    9 0000123456 01092007   250000.00
    10 0000123456 01102007  250000.00
    11 0000123456 01112007 250000.00
    12 0000123456 01122007 250000.00
    13 0000123456 01 012008 250000.00</i>
    regards
    Message was edited by:
            Alvaro Tejada Galindo

    hi anji
    i try like that and i get just the line after 1.06.07 maybe u can help me how can i get from price 01.01.2007.
    (i use the function to cahnge the format of day to be the same format in both table)
    LOOP AT  zempkostlprice_rec INTO wa_zem.
            READ TABLE intab_a132 INTO wa_intab_a132.
            CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
              EXPORTING
                date_external = wa_zem-date
              IMPORTING
                date_internal = tmp_date.
            IF wa_intab_a132-datab LE tmp_date.
              MOVE: wa_intab_a132-kbetr TO wa_zem-kbetr.
              MODIFY zempkostlprice_rec FROM wa_zem TRANSPORTING kbetr .
              CLEAR:wa_zem,wa_intab_a132.
            ENDIF.
          ENDLOOP.
    0000123456     012007     0.00
    0000123456     022007     0.00
    0000123456     032007     0.00
    0000123456     042007     0.00
    0000123456     052007     0.00
    0000123456     062007     250000.00
    0000123456     072007     250000.00
    0000123456     082007     250000.00
    0000123456     092007     250000.00
    0000123456     102007     250000.00
    0000123456     112007     250000.00
    Best regards

  • Need help in ABAP code

    Hi All,
    I have the data like this and ABC line is the primary object, Inline is the attribute.
    ABC Line                                                                       Inline
    GH04                    1001
    OI04                    1031
    OU04                    1002
    OU05                                                                            1002
    My requirement is like in the report. I have to use the Inline and restrict with the data when I restrict with 1001, 1031 and 1002. But it has to consider 1001, 1031 and 1002 which starts with only OU*. I donu2019t require all ABC lines.
    I tried to write the code but I couldnu2019t.
    Can any one give the code please?
    Thanks
    Sravani

    if the ABC line item is OU* then you need to display 1001 and 1031 else you want display all the items
    I m right???
    reach me at
    Edited by: shanthi bhaskar on Apr 15, 2010 5:20 PM

  • Help on ABAP code

    Hi,
    Lets say I have a table with 2 columns. Lets call this table IT_2.
    Column 1 - Value is either a space or *
    Column 2 - Text
    So here is what I need to do, looping into a new table (Call it IT_3).
    Loop at IT_2.
    When Column 1 = *.
    Create a new line with the value of column 2.
    When Column 1 = space
    Add the current column 2 text to the column 2 text of the previous row.
    Please help. This is very important and I am unsure as to how to implement this.
    Thanks,
    John

    Hi, John Damion.
    Try this:
    TYPES: BEGIN OF TYP_IT_2,
             COLUMN1 TYPE C,
             COLUMN2 TYPE C LENGTH 10,
           END OF TYP_IT_2.
    TYPES: BEGIN OF TYP_IT_3,
             COLUMN1 TYPE C,
             COLUMN2 TYPE C LENGTH 100,
           END OF TYP_IT_3.
    DATA: IT_2    TYPE STANDARD TABLE OF TYP_IT_2,
          WA_IT_2 TYPE TYP_IT_2,
          IT_3    TYPE STANDARD TABLE OF TYP_IT_3,
          WA_IT_3 TYPE TYP_IT_3,
          WA_IT   TYPE TYP_IT_3.
    WA_IT_2-COLUMN1 = '*'.
    WA_IT_2-COLUMN2 = 'A'.
    APPEND WA_IT_2 TO IT_2.
    WA_IT_2-COLUMN1 = ' '.
    WA_IT_2-COLUMN2 = 'B'.
    APPEND WA_IT_2 TO IT_2.
    WA_IT_2-COLUMN1 = '*'.
    WA_IT_2-COLUMN2 = 'C'.
    APPEND WA_IT_2 TO IT_2.
    WA_IT_2-COLUMN1 = ' '.
    WA_IT_2-COLUMN2 = 'D'.
    APPEND WA_IT_2 TO IT_2.
    WA_IT_2-COLUMN1 = ' '.
    WA_IT_2-COLUMN2 = 'E'.
    APPEND WA_IT_2 TO IT_2.
    WRITE 'IT_2:'.
    LOOP AT IT_2 INTO WA_IT_2.
      WRITE: / WA_IT_2-COLUMN1,
               WA_IT_2-COLUMN2.
    ENDLOOP.
    READ TABLE IT_2 INTO WA_IT INDEX 1.
    LOOP AT IT_2 INTO WA_IT_2 FROM 2.
      IF WA_IT_2-COLUMN1 = ' '.
        CONCATENATE WA_IT-COLUMN2 WA_IT_2 INTO WA_IT-COLUMN2.
      ELSE.
        APPEND WA_IT TO IT_3.
        WA_IT = WA_IT_2.
      ENDIF.
    ENDLOOP.
    APPEND WA_IT TO IT_3.
    WRITE / 'IT_3:'.
    LOOP AT IT_3 INTO WA_IT.
      WRITE: / WA_IT-COLUMN1,
               WA_IT-COLUMN2.
    ENDLOOP.
    And the result is:
    IT_2:
    * A
      B
    * C
      D
      E
    IT_3:
    * A B
    * C D E
    I hope this can help you.
    Regards,
    feng.

  • Need help for ABAP CODE

    hi,
    i need to reload the master data without FM, i put the comments on fm and relaod the data, now i having a problem, loading process is slow now as compair to before, when i was using with FM.i checked the manage of infoObject, it is show 1123455 records in "transfer" column and 0 record in "added" column, below is the start routine,
    Please help me to fix that problem
    IF NOT DATAPAK[] IS INITIAL.
        LOOP AT DATAPAK INTO S_DATAPAK.
          CLEAR V_INDEX.
          V_INDEX = SY-TABIX.
         IF S_DATAPAK-/BIC/ABRETPRI CO ' 0123456789.'.
           CLEAR: V_AMOUNT, V_PRC.
          V_AMOUNT = S_DATAPAK-/BIC/ABRETPRI.
          CALL FUNCTION 'RSAR_CURRENCY_CONVERT'
          EXPORTING
          I_CURRENCY = S_DATAPAK-CURRENCY
          CHANGING
          C_AMOUNT   = V_AMOUNT.
         V_PRC = V_AMOUNT.
         S_DATAPAK-/BIC/ABRETPRI = V_PRC.
        ENDIF.
    IF S_DATAPAK-/BIC/ABBLNKFLG IS INITIAL.
            S_DATAPAK-/BIC/ABBLNKFLG = 'N'.
          ENDIF.
    TRANSLATE S_DATAPAK-/BIC/ABSZRANGE TO UPPER CASE
    IF S_DATAPAK-CURRENCY IS INITIAL.
          S_DATAPAK-CURRENCY = S_DATAPAK-WHLPRCCURR.
    MODIFY DATAPAK FROM S_DATAPAK INDEX V_INDEX TRANSPORTING
         /BIC/ABRETPRI /BIC/ABWHLPRCE /BIC/ABBLNKFLG
         ENDIF.
    *ENDLOOP.
      ENDIF
    Thanks

    You need not use start routine to achieve this. Instead you can write transfer routines/formulas for those fields in UR.

  • Call SE11 Search Help through ABAP code.

    Hello,
    I have a requirement in which I need to call various search helps created through SE11 in a Function Module. I want the Search help to return the Values which I would use in my Function Module.
    Please suggest if there's a standard FM/ Statement to process SE11 Search helps.
    Thanks,
    Shalabh

    TYPE-POOLS: shlp.
    DATA: l_shlp     TYPE shlp_descr_t,
          l_wa       TYPE ddshiface,
          l_bukrs    TYPE char50,
          l_repid    TYPE syrepid,
          L_DYNNR    TYPE SYDYNNR,
          l_ret_val  LIKE ddshretval OCCURS 0 WITH HEADER LINE,
          l_t_fields TYPE dynpread   OCCURS 0 WITH HEADER LINE.
    PARAMETERS: p_bukrs TYPE pa0001-bukrs,
                p_werks TYPE pa0001-werks,
                p_btrtl TYPE pa0001-btrtl.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks.
      FIELD-SYMBOLS <fs> TYPE ddshiface.
      l_repid = sy-repid.
      L_DYNNR = SY-DYNNR.
      CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
        EXPORTING
          shlpname       = 'H_T500P'
    *     SHLPTYPE       = 'SH'
        IMPORTING
          shlp           = l_shlp
      LOOP AT l_shlp-interface INTO l_wa.
        IF l_wa-shlpfield  EQ 'BUKRS'.
          l_wa-valtabname = 'PA0001'.
          l_wa-valfield   = 'BUKRS'.
        ELSEIF l_wa-shlpfield EQ 'PERSA'.
          l_wa-valtabname = 'PA0001'.
          l_wa-valfield   = 'WERKS'.
        ENDIF.
        MODIFY l_shlp-interface FROM l_wa.
      ENDLOOP.
    * Process standard searchhelp
      CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
        EXPORTING
          shlp          = l_shlp
        TABLES
          return_values = l_ret_val.

  • Need Help With Simple ABAP Code

    Hello,
    I'm loading data from a DSO (ZDTBMAJ) to an Infocube (ZCBRAD06). I need help with ABAP code to some of the logic in Start Routine. DSO has 2 fields: ZOCTDLINX & ZOCBRDMAJ.
    1. Need to populate ZOCPRODCD & ZOCREFNUM fields in Infocube:
        Logic:-
        Lookup /BI0/PMATERIAL, if /BIC/ZOCBRDMAJ = /BIC/OIZOCBRDMAJ
        then /BIC/ZOCPRODCD = ZOCPRODCD in Infocube
               /BIC/ZOCREFNUM = ZOCREFNUM in Infocube         
    2. Need to populate 0G_CWWTER field in Infocube:
        Logic:
        Lookup /BIC/PZOCTDLINX, if /BIC/ZOCTDLINX = BIC/OIZOCTDLINX
        then G_CWWTER = 0G_CWWTER in Infocube.
    I would need to read single row at a time.
    Thanks!

    I resolved it.

  • Help regarding calling BRFPLUS function through ABAP code

    Hi,
          I have  a situation where I have to input  data into a BRFPLUS function  as a table (i.e the data is input as select options where list or range of data can be provided).The corresponding output is also in the form a table .I've created this function in BRFPLUS and is working fine .Now I have to call it through ABAP code.Can someone kindly  provide me with the probable code for this scenario.
    E.g:
            ZT_MATNR  is the table in brfplus representing the list of MATNR values input along with other such inputs to function module Z_FM
            ZT_ATM   is the  resultant output table  of the function  which contains several fields.
    Now I have to call this BRFPLUS function with help of ABAP code.Could someone kindly help.

    Hello ,
    There should be a number of BRF+ tutorials available in SCN which discuss the FDT APIs. You can have a look at them to get an idea of the various APIs available and their uses.
    For your usecase, you should do the following.
            lo_fdt_function         TYPE REF TO if_fdt_function,
            lo_fdt_result           TYPE REF TO if_fdt_result,
    * Get function handle
          CALL METHOD lo_fdt_factory->get_function
            EXPORTING
              iv_id       = lv_function_id
            RECEIVING
              ro_function = lo_fdt_function.
    where lv_function_id is the GUID of the BRF+ function . You can either make it a constant , or you can use a FDT API to get the function GUID from the BRF+ application name and function name.
    *   Set function context
        TRY.
            CALL METHOD lo_fdt_context->set_value
              EXPORTING
                iv_id    =
                ia_value =
    This is one way to set the input context ( pass the input to the BRF+ function to process ). There are other ways to do this as well. Which one you use would depend on the kind of input you want to pass.
    * Execute BRFPLUS function
      TRY.
          CALL METHOD lo_fdt_function->process
            EXPORTING
              io_context = lo_fdt_context
            IMPORTING
              eo_result  = lo_fdt_result.
    * Get result output
      TRY.
          CALL METHOD lo_fdt_result->get_value
            IMPORTING
              ea_value =
    Another direct way of doing it would be to use the method PROCESS of the class CL_FDT_FUNCTION_PROCESS.
    I have not gone into much explaination here , but it should provide you an idea of how you can go about it.Read the SCN docs on the APIs to get a better idea , or better still if you can get hold of a copy of the BRF+ book by Carsten Ziegler , you will get an end to end explaination of all BRF+ APIs in it.
    Regards,
    Indranil.

Maybe you are looking for