CMOD code efficiency

Hi Experts,
I have written the following CMOD for enhancin 2lis_03_bf with fields from tables MKPF and MSEG. I understand that it is not efficient use of ABAP statements. Could you please help me decide write the following code more efficiently?
DATA: I_MC03BF0 LIKE MC03BF0,
  I_tabix like sy-tabix.
    CLEAR: I_MC03BF0.
    LOOP AT c_t_data INTO I_MC03BF0.
      IF NOT I_MC03BF0-MATNR IS INITIAL.
        I_tabix = sy-tabix.
        select single CPUDT CPUTM from MKPF into (I_MC03BF0-ZZCPUDT,I_MC03BF0-ZZCPUTM)
                              where
                               MBLNR = I_MC03BF0-MBLNR and
                               MJAHR = I_MC03BF0-MJAHR.
        Select single XAUTO FROM MSEG INTO I_MC03BF0-ZZXAUTO
                              WHERE
                              MBLNR = I_MC03BF0-MBLNR AND
                              MJAHR = I_MC03BF0-MJAHR AND
                              ZEILE = I_MC03BF0-ZEILE.
        modify c_t_data from I_MC03BF0.
        clear: I_MC03BF0.
     ENDIF.
    ENDLOOP.

Hi CC,
Although you could also consider to first extract the fields from the MKPF table to BW and then add them to data that are being extracted through the 2LIS_03_BF datasource, from a 'code point of view' you can try the following:
* Types for internal tables to select data
TYPES: Begin of ty_mkpf,
     MBLNR type MBLNR,
     MJAHR type MJAHR,
     CPUDT type CPUDT,
     CPUDM type CPUDM,
       end of ty_mkpf,
       Begin of ty_mseg,
     MBLNR type MBLNR,
     MJAHR type MJAHR,     
     ZEILE type MBLPO,
     XAUTO type MB_AUTO,
       end of ty_mseg.
* Field symbols for adding and checking additional fields
  FIELD-SYMBOLS : <fs_mkpf> type ty_mkpf,
            <fs_mseg> type ty_mseg,
                  <fs_MC03BF0> type MC03BF0.
* Internal tables to select data
  DATA: it_mkpf type HASHED table WITH UNIQUE KEY MBLNR MJAHR,
     it_mseg type HASHED table WITH UNIQUE KEY MBLNR MJAHR ZEILE,
        it_MC03BF0 TYPE SORTED TABLE OF MC03BF0.
* Clear internal tables
CLEAR: it_mkpf,
       it_mseg,     
       it_MC03BF0.
* Move c_t_data to internal table
  it_MC03BF0 = c_t_data[].
* Select additional fields from source system tables
IF it_MC03BF0 is not initial.
        SELECT MBLNR
               MJAHR
               CPUDT
               CPUTM
         FROM MKPF
         INTO table it_mkpf
         FOR ALL ENTRIES IN it_MC03BF0
         WHERE MBLNR = it_MC03BF0-mblnr
          AND MJAHR = it_MC03BF0-mjahr.
        SELECT MBLNR
               MJAHR
            ZEILE
               XAUTO 
         FROM MSEG
         INTO table it_mseg
         FOR ALL ENTRIES IN it_MC03BF0
         WHERE MBLNR = it_MC03BF0-mblnr
          AND MJARH = it_MC03BF0-mjahr.
* Loop on selected fields to add additional fields
      LOOP AT c_t_data ASSIGNING <fs_MC03BF0>.
        READ TABLE it_mkpf ASSIGNING <fs_mkpf>
          WITH TABLE KEY MLBNR = <fs_MC03BF0>-MLBNR
                MJAHR = <fs_MC03BF0>-MJAHR.
        READ TABLE it_mseg ASSIGNING <fs_mseg>
          WITH TABLE KEY MLBNR = <fs_MC03BF0>-MLBNR
                MJAHR = <fs_MC03BF0>-MJAHR
                ZEILE = <fs_MC03BF0>-ZEILE.     
      if sy-subrc = 0.
* Add additional fields to append in extract structure
        <fs_2lis_03_bf>-ZZCPUDT = <fs_MC03BF0>-CPUDT.
        <fs_2lis_03_bf>-ZZCPUTM = <fs_MC03BF0>-CPUTM.
        <fs_2lis_03_bf>-ZZXAUTO = <fs_MC03BF0>-XAUTO.
      endif.
      endloop.
endif.
Edited by: Edwin Neuenschwander on Jun 26, 2011 4:19 PM

Similar Messages

  • How to use same CMOD code for 2 Diff. variableS?

    Experts,
    I have written some code under CMOD. Now, i have another query which i could use the same CODE, but diff. variable
    ( In the CMOD code, i am passing one User input variable ). For the 2nd query i have to pass different User Input variable.
    How OR what should i wright to tell CMOD, that IF its Query # 1 then use ABC variable and if Query # 2 then use XYZ .
    thanx

    Dear Hon Bon,
    Let us have a small example on ur scenario.
    Lets take the requirement as to calculate Month from Date. (In both the queries).
    Query 1: Input variable for Date is say  'ZDATE1'.
    Query 2: Input variable for Date is say  'ZDATE2'.
    Now let the CMOD variable be ZVAR_CALMONTH.
    when 'ZVAR_CALMONTH'.
        clear: lwa_var_rng,
               lwa_range.
        loop at i_t_var_range into lwa_var_rng where vnam = 'ZDATE1' or vnam = 'ZDATE2'.
          concatenate lwa_var_rng-low+0(4)
                      lwa_var_rng-low+4(2)
                 into lwa_range-low.
          lwa_range-sign = 'I'.
          lwa_range-opt  = 'EQ'.
          append lwa_range to e_t_range.
          clear lwa_range.
        endloop.
    Now when you execute the Query1,  the above code will work for 'ZDATE1' variable,
    if you execute the Query2,  the above code will work for 'ZDATE2' variable.
    So, the key point is,
    1. You need not worry about which query is getting executed. Whatever the query, the particular user entry variable of that query will be taken care.
    2. This method works only if the cmod variable (ZVAR_CALMONTH) is used in both the queries (Ofcourse its ur requirement).
    3. If queries have both the user entry variables then the cmod will work differently(it ll get data from both the user variables).
    You shall try ur code in the above example by replacing the code and the variable names and try playing around it.
    Hope this helps.
    Regards,
    Guru

  • Unable to debug/correct the CMOD code for a variable used in a query

    unable to debug/correct the CMOD code for a variable used in a query
    i am using the data in a DSO in a query and using a custom coding variable in that query , but this data not coming in that query ..
    can anyone suggest how to debug that cmod code for the variable?
    code is written in CMOD tocde for the variable.

    belowis the code that i have written for a custom coding for a variable
    *******Start***
    IF i_step = 2.
      CASE i_vnam.
        WHEN 'IC_COMPCD'.
         TYPES:       BEGIN OF gt_itab_DyAuthTable,
                           username  TYPE /bic/afiop_o1200-/BIC/IC_USER,
                           companycode TYPE /bic/afiop_o1200-COMP_CODE,
                      END OF gt_itab_DyAuthTable,
                      BEGIN OF gt_itab_Cocd_all,
                            companycode TYPE /BI0/MCOMP_CODE-COMP_CODE,
                      END OF gt_itab_Cocd_all.
          DATA: gi_itab_DyAuthTable TYPE STANDARD TABLE OF gt_itab_DyAuthTable,
                wa_itab_DyAuthTable TYPE gt_itab_DyAuthTable.
           DATA: gi_itab_Cocd_all TYPE STANDARD TABLE OF gt_itab_Cocd_all,
                wa_itab_Cocd_all TYPE gt_itab_Cocd_all.
          SELECT /BIC/IC_USER
                 COMP_CODE FROM /bic/afiop_o1200
            INTO CORRESPONDING FIELDS OF TABLE gi_itab_DyAuthTable
            WHERE /bic/ic_user = sy-uname.
          LOOP AT gi_itab_DyAuthTable INTO wa_itab_DyAuthTable.
            IF wa_itab_DyAuthTable-companycode EQ '*'
              OR
              wa_itab_DyAuthTable-companycode EQ ' '.
              SELECT COMP_CODE FROM /BI0/MCOMP_CODE
                  INTO CORRESPONDING FIELDS OF TABLE gi_itab_Cocd_all.
              LOOP AT gi_itab_Cocd_all INTO wa_itab_Cocd_all.
                l_s_range-low    = wa_itab_Cocd_all-companycode.
                l_s_range-sign   = 'I'.
                l_s_range-opt    = 'EQ'.
                APPEND l_s_range TO e_t_range.
              ENDLOOP.
          to exit the loop if any one value is */space/all for a user's compcode values
            EXIT.
            ENDIF.
          ENDLOOP.
           if control is here means, the comp codes values didnt have */space
              LOOP AT gi_itab_DyAuthTable INTO wa_itab_DyAuthTable.
                l_s_range-low    = wa_itab_DyAuthTable-companycode.
                l_s_range-sign   = 'I'.
                l_s_range-opt    = 'EQ'.
                APPEND l_s_range TO e_t_range.
              ENDLOOP.
      Endcase.
    Endif.

  • How to read variable in CMOD code !

    Experts,
    in my one of the query, there is a variable, which takes 2 dates. so the variable is type "interval"
    so, when you run the report, user needs to enter value something like this.."mm/dd/yyyy  - mm/dd/yyyy"
    Now, i have writtn a code in CMOD, by reading this variable.
    But i dont know how to read 2nd date from the variable.
    READ TABLE   i_t_var_range
                 WITH KEY   vnam = 'VARIABLE'
                 INTO       l_var_range.
              First Date = l_var_range-low.
              Second Date = l_var_range-high.
    Does this low and high thing is correct?
    if i do debug, i could see the low values. but i coud see the same low values in High too.
    whats the problem ?
    please help

    Hi ,
    There are some scenarios for using CMOD, for variables in report.
    And as per I understand for you issue, please find my comments
    Scenario : You want to use the values enter by user in some other variable in the same report.
    Please make sure that properties of both the variables are same.
    Use below code:
    DATA: l_s_range TYPE rsr_s_rangesid.
    DATA: loc_var_range LIKE rrrangeexit.
       WHEN 'New Variale'.
            IF i_step = 2.
              LOOP AT i_t_var_range INTO loc_var_range
                      WHERE vnam = 'Varaible in which user has entered value'.
                CLEAR l_s_range.
                l_s_range-low  =   loc_var_range-low  .
                l_s_range-high =   loc_var_range-high .
                APPEND l_s_range TO e_t_range.
              ENDLOOP.
            ENDIF.
    Thanks
    Mayank
    Edited by: Mayank Chauhan on Feb 8, 2011 11:45 AM
    Edited by: Mayank Chauhan on Feb 8, 2011 11:46 AM
    Edited by: Mayank Chauhan on Feb 8, 2011 11:47 AM

  • Mapping arrangement and code efficiency

    Hi all,
    I have a general question about how best to structure and OWB mapping.
    Take the example where I have multiple source tables (Table A, B and C) which are referenced multiple times in one mapping. Is it best to bring in these tables multiple times on the canvas as and when I need them, or is it best to have them placed only once on the mapping and then all references to other transformations/tables to be made from the first drop of the table. From a visual perspective mappings are a lot easier to understand if the tables are copied in more than once, however my main question is around the efficiency of code written underneath...in which example will the most efficient code be written or will it be the same?
    Thanks
    Mitesh

    well, the thing is that a mapping does not have to result in a single SQL statement.
    Row based mapping, e.g. will not.
    So, depending on what the mapping does, it could matter somewhat since the generated code might differ.
    A tricky thing to do, is to make sure that the "flow" in the mapping will be correct (what table get's processed first etc)

  • To check  ABAP Code efficiency

    Hi friends.
    Instead of SQL Trace/SE30/Extended Program check,Is there any SAP Standard or ABAP Program available in SAP R/3 to <b><u>audit</u></b>(To test the efficiency of Source code) the <u><b>Z-Programs</b></u> ?
    Please if any share with me!
    Thanks.
    Surendher Reddy.B

    Hi,
    Get ride of any nested selects. try to select all your data upfront into internal tables and process them instead of loads of selects nested as this increases the number of hits between the application server (front-end) and the database server (back-end).
    Also, use FOR ALL ENTRIES syntax to improve efficiently.
    In SE38 run the menu Environment -> Examples -> Performance examples. This will highlight any areas you may be able to make big savings.
    You can also use the runtime analysis to see where your bottlenecks are.
    If you provide me an e-mail, I will send you some source code you can manipulate for QA checking. However, it is a little hard to understand but you are welcome to view it.
    Cheers
    Colin.

  • How to Debugg the Cmod code in R3

    Hi All,
    I have written a code in CMOD to populate new fields for 2LIS_11_VASCL.
    How do I debugg the code it in R3?
    When I run the check for datasource in RSA3, it is not returning any records?
    Simmi

    you can set a break point in the code..or even in the extractor you have the option to enable the Debug..check box..
    Go to the code..of include..double click on the line you want to place a break -point.

  • [SOLVED] rerunning perl code efficiently

    I am trying to learn perl and for that reason I am looking for the most efficient setup to do coding and not waste time compiling and restarting, etc.
    Here is my current setup: I am using gvim and dwm, and I have one urxvt client open. I code in gvim, the file I am editing is called "tt" (for faster typing) and is located in my ~/bin directory, is chmod +'ed and of course in my path. So what I do is I edit my code in gvim, and when I want to see if my program works, I save the file in gvim (using ":w"), and then go to my urxvt terminal and just type "tt" to execute.
    Anyone have a suggestion how to make this faster or give me some insights as to how they would do this most efficiently?
    Last edited by awayand (2011-07-30 04:59:08)

    Depending on how large your program gets and what it does, it may be quicker to recompile each time to get the speed of a compiled language, but I would not worry about that for now.
    You could use both vim and tmux, so you can save in vim, then switch panes (in mine, this means pressing ^b and then the direction I want to move, as in vim). [Edit: You're probably using dwm keybindings to just switch windows, which is as fast as this will be]
    Also, depending on what your script does, you can execute commands from inside of vim. Try :!ls . If that looks alright to you, you can use :!tt . This comes in handy for other things to, where you can pipe any selection (through visual mode or made manually) to an external command and have the results put in it's place.
    Honestly, programming usually isn't something you try to do as fast as possible. As your program grows, the runtime will matter much more than the amount of time it takes for you to do a context switch.
    Last edited by jac (2011-06-16 11:12:17)

  • IF ELSE statement / CMOD Code in BEX Query

    Hi
    I have a requirement in Inventory flow.
    Material stock value at the end of each quarter has to be calculator based on cycle count indicator. I have all the values on my cube.
    In the report, Calender year and quarter is on the selection screen.
    When user enters 2014 and Q2, Data for April, May and June are displaying on the report. But user want data only for June.
    At the end of quarter 2 is June, so he wants only Material stock value at the end of June.
    If a material stock level is changed in April and May and not changed in June, not data is available for June in my Cube.
    In this case for Quarter 2, if June data is missing, it has to look for May data. Even if MAY data is missing, it will have to look for April.
    Even if April data is missing, it will have to look for March data.
    The result should be
    Plant    Q1    Q2    Q3   Q4
    XYZ     100    100  100    100
    If there is no change to stock level in April, May & June - at the end of Quarter 2, the stock value should be 100 as it was in end of Q1.
    If no change was dont to stock level until December, the stock level should be 100.
    Is there a way out using IF ELSE statements or through CMOD customer exit.
    Regards,
    Elango Murgesan

    HI Elango,
    the user input on CALQuarter always would be Single value??or can we expect ranges as well?
    if single value,
    then we can achieve it by having one more dummy KF.
    lets say. user input is Q2. 
    -> in your dummy KF, restrict the Calquarter/Calmonth to last quarter(i.e Q1)using customer exit and make the logic as you said above(last value based on calmonth).(make this KF hidden, as this is not required to display)
    -> and in another KF restricted with Q2.Same logic, last value on Calmonth.((make this KF hidden, as this is not required to display)
    and now you have 2 KFs in your report.  So in a formula, you can have condition-> if Q2 KF is blank, then Q1KF, else Q2 KF.
    Hope you are getting my idea.. Please try this and let us know.
    ** if Q1 also null, then we can extend customer exit logic to may be last one year, and having last value on based on calendar month, we can still achieve i guess.
    Regards,
    Sakthi.

  • Cmod code to fetch line item data

    Hi Experts,
    I have appended 2lis_11_VAHDR the field X.
    I want to populate this field with the data of field X from VBAP table ( SO Item table).
    But since the data source is a header i.e. it will have only one record aganist each SO.
    In table VBAP, for each SO there may be one or multiple items.
    But for the field X in 2lis_11_VAHDR it should pick only first item ( 10 or 20 or 30 etc) field X value.
    I have tried with this code:
    ===================================
    WHEN '2LIS_11_VAHDR'.
    loop at C_T_DATA into WA_MC11VA0HDR.
    L_tabix = sy-tabix.
    SELECT X FROM VBAP INTO WA_MC11VA0HDR-X
      WHERE VBELN = WA_MC11VA0HDR-VBELN.
    modify C_T_DATA from WA_MC11VA0HDR index l_tabix.
    Endselect.
    Endloop.
    ===============================
    But it is not picking first one i.e. 10, it is picking the value of X against last item 30 ( say 10,20,30 are items in a SO)
    Kindly suggest how to achieve this.
    Thanks & Regards,
    Bhadri M.

    Hi All,
    Thanks for your valuable replies.
    My requirement is met. Please find the final code:
    ======================
    WHEN '2LIS_11_VAHDR'.
    loop at C_T_DATA into WA_MC11VA0HDR.
    L_tabix = sy-tabix.
    *break-point.
    SELECT PERNR FROM VBPA INTO WA_MC11VA0HDR-ZZPERNR WHERE VBELN = WA_MC11VA0HDR-VBELN
                        and PARVW = 'Z2'.
    modify C_T_DATA from WA_MC11VA0HDR index l_tabix.
    ENDSELECT.
    SELECT VBELN POSNR ABGRU FROM VBAP INTO WA_SO_DOCNO
    WHERE VBELN = WA_MC11VA0HDR-VBELN.
    APPEND WA_SO_DOCNO TO LT_SO_DOCNO.
    SORT LT_SO_DOCNO BY VBELN POSNR ASCENDING.
    DELETE ADJACENT DUPLICATES FROM LT_SO_DOCNO COMPARING VBELN.
    CLEAR WA_SO_DOCNO.
    Read table LT_SO_DOCNO into WA_SO_DOCNO with key VBELN = WA_MC11VA0HDR-VBELN.
        RESULT = wa_sy_docst-/BIC/OIYHSTAT.
    WA_MC11VA0HDR-ZZABGRU = WA_SO_DOCNO-ABGRU.
    modify C_T_DATA from WA_MC11VA0HDR index l_tabix.
    ENDSELECT.
    *ENDSELECT.
    ENDLOOP.
    ========================
    It works even with following code as suggested,
    +SELECT X FROM VBAP INTO WA_MC11VA0HDR-X+
    +WHERE VBELN = WA_MC11VA0HDR-VBELN+
    ++and      posnr  = '00010'.
    +but the problem here is '00010' will not be there always in the SO, sometimes it will be directly 20 or 30 or etc
    Closing the thread.
    Points assigned.
    Thanks & Regards,
    Bhadri M.
    Edited by: Bhadri M on Dec 29, 2011 2:28 PM

  • Error in CMOD code

    Hi Friends,
    I am enhancing the extractor 0FC_PAY, I have added about 10 fields to the extract structure and activated it succesfully.
    Now when i write the code i am getting the following  error.
    The specified type has no structure and therefore has no component called VKONT
    I am getting the error in the where condition of the select statement.
    My code is as below
    TYPES :
    begin of  ty_dfkkzp,
    OPBEL       type  dfkkzp-OPBEL,
    BLART       type  dfkkzp-BLART ,
    BUDAT       type  dfkkzp-BUDAT ,
    BLDAT       type  dfkkzp-BLDAT ,
    TBETR       type  dfkkzp-TBETR  ,
    ZZRECEIPT   type  dfkkzp-ZZRECEIPT ,
    ZZPAYCAT  type  dfkkzp-ZZPAYCAT ,
    ZZPAYSRC  type  dfkkzp-ZZPAYSRC ,
    ZZPAYTYPE   type  dfkkzp-ZZPAYTYPE ,
    ZZTENDER  type  dfkkzp-ZZTENDER ,
    end of  ty_dfkkzp.
    Data:
              lt_dfkkzp type  table of ty_dfkkzp
              with  key opbel.
        field-symbolS: <fs_dfkkzp> type ty_dfkkzp,
                       <data> type FKKPAYBW_DELTA.
        select distinct
               OPBEL
               BLART
               BUDAT
               BLDAT
               TBETR
               ZZRECEIPT
               ZZPAYCAT
               ZZPAYSRC
               ZZPAYTYPE
               ZZTENDER
          from dfkkzp
          into table lt_dfkkzp
          for all entries in  C_T_DATA
          where opbel = C_T_DATA-VKONT.
      WHEN '0FC_PAY'.
          loop at C_T_DATA into <data>.
          read table lt_dfkkzp assigning <fs_dfkkzp>
          with key opbel = <data>-vkont.
          if sy-subrc = 0.
             <data>-BLART     = <fs_dfkkzp>-BLART .
             <data>-BUDAT     = <fs_dfkkzp>-BUDAT .
             <data>-BLDAT     = <fs_dfkkzp>-BLDAT .
             <data>-TBETR     = <fs_dfkkzp>-TBETR  .
             <data>-ZZRECEIPT = <fs_dfkkzp>-ZZRECEIPT .
             <data>-ZZPAYCAT  = <fs_dfkkzp>-ZZPAYCAT .
             <data>-ZZPAYSRC  = <fs_dfkkzp>-ZZPAYSRC .
             <data>-ZZPAYTYPE  = <fs_dfkkzp>-ZZPAYTYPE .
             <data>-ZZTENDER  = <fs_dfkkzp>-ZZTENDER .
          endif.
          endloop.
    Can someone please tell me where am i going wrong?.
    My ABAP skills are just elementary.
    Your help is appreciated.
    Regards
    BN

    Hello Friends,
    Thanks for the help so far, I ran into an issue again here.
    The issue is that ouf Functional team has confirmed that the Contract number in the table dfkkzp is held in two fields i.e. SELW1 and SELW2.
    Contract Number will be available in SELW1 when the field SELT1 = K, if this is not the case i have chec other condition which is,
    Contract Number will be available in SELW2 when the field SELT2 = K.
    my select statement is as follows.
    WHEN '0FC_PAY'.
        it_FKKPAYBW_DELTA[] = c_t_data[].
        lv_VTREF = wa_FKKPAYBW_DELTA-VTREF.     
        iF it_FKKPAYBW_DELTA IS NOT INITIAL.
            select
                    SELT1
                    SELT2
                    SELT3
                    SELW1
                    SELW2
                    SELW3
                    BLART
                    BUDAT
                    BLDAT
                    TBETR
                    ZZRECEIPT
                    ZZPAYCAT
                    ZZPAYSRC
                    ZZPAYTYPE
                    ZZTENDER
                    into  table lt_dfkkzp
                    from dfkkzp
           for all entries in it_FKKPAYBW_DELTA
                    where SELW1 = lv_VTREF OR
                                SELW2 = lv_VTREF.
    Till this point it is ok. now my issue is in the following code.
    loop at it_FKKPAYBW_DELTA into wa_FKKPAYBW_DELTA.
                  lv_VTREF =  wa_FKKPAYBW_DELTA-VTREF.
                  v_tabix = sy-tabix.
              read table lt_dfkkzp assigning <fs_dfkkzp>
                             with key SELW1 = lv_VTREF.
              read table lt_dfkkzp assigning <fs_dfkkzp>
                            with key SELW2 = lv_VTREF .   
    Here i am reading lt_dfkkzp twice, because, the below is not possible.
    read table lt_dfkkzp assigning <fs_dfkkzp>
                             *with key SELW1 = lv_VTREF or
                                              SELW2 = lv_VTREF.*
    this will have around 70 million records in Production. I am not sure if this approch of reading the internal table twice.
    Can someone please suggest me how to handle this scenario?.
    Thanks a lot for all your help and suggestions.
    Regards
    BN

  • Cmod code for data extractor enhancement

    hi guys  i need some help writing some abap code
    the requirement is to enhance the datasource to show data..i have data like
    1  b  john   etc...
    1  c  john   etc..
    1  d john   etc...
    the data belongs in the same structure. .. the structure has 15 fields and i could append the structure with a new filed to hold the concatenated value of b, c, d.
    i need it to written out in the data source as
    1 line showing
    1  b c d  john   etc.......
    delete the rest of the extra lines..
    any ideas.?

    Hi Amar,
    You can do this in start routine of transformation.
    Create one internal table to hold the target value ie. combination of a b c and d in one field.
    Now you can keep  looping on source package and collect all the similar values as given below.
    create a temporary variable for storing the value of field1 which is holding all 1 values.
    Loop at source_package into wa_package.
    if sy-tabix = 1.
    temp_field1 = wa_package-field1.
    concatenate wa_table-field2 wa_package-field2 into wa_table-field2.
    endif.
    if temp_field1 = wa_package-field1.
    concatenate wa_table-field2 wa_package-field2 into wa_table-field2.
    else.
    append wa_table into it_table.
    clear wa_table.
    wa_table-field2 = wa_package.
    endif.
    endloop.
    Regards,
    Durgesh.
    endloop.

  • SubVIs and code efficiency

    Hello,
    I would like to know what is better (when thinking about program velocity), to make a huge VI or a lot of subvis distributed in many levels.
    I imagine that this relation (number of sub VIs and program efficiency) will have something to do with the way I pass values between VIs.
    So my second question is what is better, to pass values using global variables, to pass control references and use a lot of property nodes, or to pass it in another way. 
    I tried to find info about this questions but  I had little success,
    I hope someone can help me!
    Best regards, 
    Gabriel
    Solved!
    Go to Solution.

    I have found the answer for my question on the following webcasts: 
    Best Practices for Managing Application Development with the LabVIEW Project
    http://zone.ni.com/wv/app/doc/p/id/wv-167 Tips and Tricks for Improving LabVIEW Application Performancehttp://zone.ni.com/wv/app/doc/p/id/wv-173Software Design Architectures in NI LabVIEWhttp://zone.ni.com/wv/app/doc/p/id/wv-160Design Multirate Applications with LabVIEW Timed Loophttp://zone.ni.com/wv/app/doc/p/id/wv-863
    Message Edited by GPC on 10-01-2009 03:11 PM

  • How to find a string in SAP code

    Hello,
    Does anyone here know how I can find a string inside the SAP code efficiently? I tried finding a custom table name using the Where-used list feature but the results doesn't show the complete/correct results. It missed some user exits where the table name was also used.
    Please help

    Hello Jimmy,
    You can try what Krishna has said there is one more way that is
    goto trxn SE12,
    enter Z* in the table name field,
    it will give a popup box with all the Ztables found in your system...you can find your table maybe it is a little tedious job
    Sravani

  • Where to write code for i_step =0

    Hi,
    I have written code for variable i_step=0 in CMOD.
    I am not able to test the code.
    Could you pls tell us, how to test the code and when this code will be populated.
    Where do i need to set break point , to see the code execution in debugging.
    Thanks

    You will write the logic using CMOD transaction only.You can set the break point the cmod code itself to check your code is working fine or not.
    I_STEP = 0
    The enhancement is not called from the variable screen. The call can come from the authorization check or from the Monitor. This is where you want to put the mod for populating the authorization object.
    Check the sample code
    case i_vnam.
      WHEN 'ZGMGRANT'.  "Query field name
        if i_step = 0.
    BREAK-POINT
          clear wa_ETRANGE.
    *     Gets all grants a user is able to see from ZTable,
    *     which is populated elsewhere 
          select grant_nbr
            from ZGMUSERGRANTS
            into corresponding fields of table it_ZGMUSERGRANTS
           where UNAME eq sy-uname.
    *     Populate Authorisation Object. In i_step 0
    *     E_T_RANGE is used to populate the authorisation object
          loop at it_ZGMUSERGRANTS into wa_ZGMUSERGRANTS.
            wa_ETRANGE-sign = 'I'.
            wa_ETRANGE-opt = 'EQ'.
            CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
              EXPORTING
                INPUT         = wa_ZGMUSERGRANTS-grant_nbr
             IMPORTING
               OUTPUT        = wa_ZGMUSERGRANTS-grant_nbr.
            wa_ETRANGE-low  = wa_ZGMUSERGRANTS-grant_nbr.
            append wa_ETRANGE to E_T_RANGE.
          endloop.
        endif.
      ENDCASE.

Maybe you are looking for

  • [SOLVED] Problem with Kate and his dependencies

    hi, I just read the post which explains how to install kate from other packages of kde. http://bbs.archlinux.org/viewtopic.php?id=51748 I've done what we said last answer, but my problem is that when I try to install kdesdmod with its dependencies, t

  • CHarged for games purchases I didn't purchase

    My itunes account charged me about $250 for game apps I didn't purchase, I tried using the report problem page, but it just wouldn't work for me... Help!! WHo should i contact about this problem and what cna i do to undo this??!!?!?

  • Recommendations for a small portable bluetooth mouse?

    Does anyone have recommendations for a small portable bluetooth mouse? There don't seem to be a lot out there.

  • Will appleworks function if I upgrade to os 10.6 or higher?

    I am currently using an Imac with OS 10.5.8. I use appleworks quite a bit and have thousands of files created with this program. I have heard that if I upgrade to 10.6 or higher that appleworks will not be supported. I can not afford to lose these fi

  • Report Output Data To itab.

    Dear SAP Gurus, I do have requirement to get the output data of <i>H99CWTR0</i> in to my custom report , after that i do need to apply some logic on the output data. So, Here i am using Submit..  EXPORTING list TO MEMORY , after that i used LIST_FROM