Smart form - loop inside a loop

Dear Techies,
  I am new to smartforms. I have a query, in one of the code examples there is a context menu on the main window called "complex selection", but i dont find the same in my editor, what is the reason.
  I want this because i have data in two internal tables. Different tables are generated from secondary depending on the entries in first table. how do i achieve this on the main window.
Similar to loop inside a loop, depending on my first table entries, all the entries belonging to that entry are to be put in table of second entry. i will have tables equal to the entries in first internal table. hope my question is clear.
Please help.
Regards
imran.

Hye..
  Loop in main area will fill only the current table, but i want several tables depending on entries in the first internal table.  The number of tables in the main window will be the number records in the first table.
Regards
imran.

Similar Messages

  • How to avoid the loop inside the loop? as it reduces the performance.

    hi masters,
    i have 2 internal tables having 1 same field. eg table itab having f1, f2, f3 fields and itab1 having f1, f4 and f5 fields. let us consider the data in the itab and itab1 is like below given
    itab-f1   itab-f2   itab-f3                 itab1-f1     itab1-f4   itab1-f5
    10        aa         11                      10             abc       456
    10        bb         15                      10             def        655
    10        ff           13                      10             ghi        456
    11        dd         16                      10             tre         455
    11        zz         24                      11             ftr          256
    11        ii           54                      11             kjh         556
    12        hh         24                      12             fjk          751
    now i want the result in final table like below
    f1         f2       f3         f4         f5
    10        aa      11      abc      456
    10        aa      11      def       655
    10        aa      11      ghi       456
    10        aa      11      tre       455
    10        bb      15      abc      456
    10        bb      15      def       655
    10        bb      15      ghi       456
    10        bb      15      tre       455
    10        ff        13      abc      456
    10        ff        13      def      655
    10        ff        13      ghi      456
    10        ff        13      tre       455
    11        dd      16      ftr        256
    11        dd      16      kjh      556
    11        zz      24      ftr       256
    11        zz      24      kjh      556
    11        ii        54      ftr       256
    11        ii        54      kjh      556
    12        hh      24      fjk       751
    i can get this result using the
    Loop at itab.
    loop at itab1 where f1 = itab-f1.
    process....
    endloop.
    endloop.
    but it is very slow. i want to avoid this loop inside the loop and i want to implement the same program using read table.. like below..
    Loop at itab.
    Read table itab1 with key ....
    process...
    endloop.
    Is it possible? to get multiple records from itab2 using read statement or with READ statement that using CASE Statement or IF statemetnt.
    Plz help me...

    hi,
    please try the following code
    TYPES:
      begin of ty_itab2,
       f1
       f2
       f3
       f4
       f5
      end of ty_itab2.
    DATA:
      lw_tab2tmp type ty_itab2,
      lt_tab2tmp type standard table of ty_itab2.
    sort it_itab by f1.
    loop at it_itab into lw_itab.
      at new f1.
        CLEAR lt_tab2tmp[].
        loop at it_itab1 into lw_itab1 where f1 = lw_itab-f1.
          CLEAR lw_tab2tmp.
          move-corresponding lw_itab1 to lw_tab2tmp.
          append lw_tab2tmp into lt_tab2tmp.
        end loop.
        "while there is no data with f1 in it_itab1
        if lt_tab2tmp is initial.
          lw_tab2tmp-f1 = lw_itab-f1.
          append lw_tab2tmp into lt_tab2tmp.
        endif.
      end at.
      CLEAR lw_tab2tmp.
      MOVE-CORRESPONDING lw_itab to lw_tab2tmp.
      modify lt_tab2tmp from lw_tab2tmp TRANSPORTING f2 f3 where not f1 is initial.
      append lines of lt_tab2tmp into lt_itab2.
    end loop.
    lt_itab2 is the final table.
    There may be some syntactically errors.
    I have not a system to test it now, please test it.

  • Sy-index inside a loop

    Hi All,
    I am trying to enhance a datasource and in that I am writing a loop inside another loop. I am trying to get
    the loop number of the inner loop by using the sy-index inside the inner loop. But, the sy-index is not being changed and it is always remaining as 1.
    I even checked the sy-index in the outer loop and it is the same even there. I do not have any idea why the sy-index is not changing according to the loop number.
    Any Ideas????
    Best Regards,
    Nene.

    Nene,
    I suggest to use your OWN counters ( when using may loops) like
    l_****_out = l_****_out + 1.
    and
    l_****_in = l_****_in + 1.
    Regards,
    Hari

  • Loop Inside loop, time out error.

    Pls look into the below code, In this im looping inside a loop.
    Im looping thru the internal table( say 2000 records ) which has data from a select query, inside this loop  i need to calculate the total of output qty which is available in the another VIEW/TABLE which might return 10 records in each  iteration of the inner loop.
    This process takes huge time to process also gives out runtime out error.
    pls help.
    LOOP AT itablnpln INTO walnpln.
    contot = 0.
    This particular query loop takes large time to process
    SELECT distinct * INTO CORRESPONDING FIELDS OF TABLE itablnp
    FROM zvprdconf where aufnr = walnpln-aufnr and
    j_3asize = walnpln-j_3akordx and stzhl eq ' ' and stokz ne 'X'.
    IF sy-subrc EQ 0.
    *Earlier i used this looping.
    *loop at itablnp into walnp.
    contot = contot + walnp-J_3ALMNGA.
    move walnp-J_3ASIZE to walnpln-J_3ASIZE.
    endloop.
    *Currently tried with the following,
    LOOP AT itablnp ASSIGNING <fs_itablnp>.
    contot = contot + <fs_itablnp>-J_3ALMNGA.
    move <fs_itablnp>-J_3ASIZE to walnpln-J_3ASIZE.
    ENDLOOP.
    walnpln-output = contot.
    move zvprdconf-isdd to walnpln-zdate.
    move zvprdconf-isdz to walnpln-ztime.
    endif.
    ENDLOOP.
    regs,
    Raja

    Dear Naresh,
    Even after changing the code as below, i m getting the same error.pls help.
    IF SY-SUBRC = 0.
       SORT ITABLNPLN.
       DELETE ADJACENT DUPLICATE FROM ITABLNPLN COMPARING ALL FIELDS.
    ENDIF.
    pls find the complete code as below.
    code]
    *& Report  SAPMZLINEPLANRPT
    INCLUDE ZLPR_TOP.
    *Event AT Selection-Screen on Block Param.
    AT SELECTION-SCREEN ON BLOCK sorter.
      CHECK All = 'X'.
    *Event Start-Of-Selection.
    START-OF-SELECTION.
      Data: zstat type jest-stat.
      data: stklocaf type mska-lgort.
      data: stklocas type mska-lgort.
      FIELD-SYMBOLS <fs_itablnp> LIKE LINE OF itablnp.
      CLEAR it_ZVPRODDET.
      SELECT DISTINCT ZVPODbukrs ZVPODaufnr ZVPOD~objnr
      jeststat ZVPODwerks ZVPODarbpl ZVPODJ_3AKORD2
      zvpodplnbez zvpodaufnr zvpodkdauf zvpodkdpos
      zvpodj_3akord1 zvpodj_3akord2 zvpod~j_3akordx
      zvpodj_3absnr zvpodmatnr zvpod~j_4kscat
      zvpodmvgr4 zvpodj_3acada zvpodj_4krcat zvpodmenge
      zvpodposnr zvpodkunnr zvpodaufpl zvpodaplzl
      zvpodplnnr zvpodarbid zvpodsteus zvpodbismt
      zvpodwerks zvpodj_3akvgr6 zvpod~j_3arqda
      zvpodmvgr5 zvpodaudat zvpod~j_3addat
      zvpodvtweg zvpodobjnr zvpod~bukrs
      zvpodfsavd zvpodssavd zvpod~bstkd
      zvpodbstdk zvpodihrez zvpod~bstkd_e
      zvpodbstdk_e zvpodihrez_e zvpod~arbpl
      zvpodvgw01 zvpodkvgr2 zvpod~vsart
      FROM  ZVPOD
      INNER JOIN jest ON ZVPODobjnr = jestobjnr
      INTO CORRESPONDING FIELDS OF table it_ZVPRODDET where
      plnbez in FGM and arbpl in wc and werks in plant
      and SSAVD in eldate
      and J_3AKORD2 in cups and jest~inact ne 'X'.
      SORT it_ZVPRODDET BY aufnr stat.
      LOOP AT it_ZVPRODDET INTO wa_ZVPRODDET.
        IF wa_ZVPRODDET-stat = 'I0045' .  " TECO - compl
          DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
        ELSEIF wa_ZVPRODDET-stat = 'I0009' .  " CNF - Confirmed
          DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
        ELSEIF wa_ZVPRODDET-stat = 'I0012' .  " DLV - Delivered
          DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
        ELSEIF wa_ZVPRODDET-stat = 'I0046' .  " CLSD - Closed
          DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
        ELSEIF wa_ZVPRODDET-stat = 'I0076' .  " DLFL - Del Flag
          DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
        ELSEIF wa_ZVPRODDET-stat = 'E0003' .  " SCLS - Short Close
          CLEAR tj30t.
          SELECT SINGLE txt04
          FROM tj30t INTO tj30t-txt04
          WHERE stsma = 'PRDHOLD' AND
                estat = 'E0003' AND
                txt04 = 'SCLS' AND
                spras = 'EN'.
          IF sy-subrc = 0.
            DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr.
          ENDIF.
        ENDIF.
      Condition for Prod Order released - REL
        IF wa_ZVPRODDET-stat = 'I0002'.
          mreleased = 'Y'.
        else.
          mreleased = 'N'.
        endif.
        zstat = wa_ZVPRODDET-stat.
        IF mreleased = 'N'.
          DELETE it_ZVPRODDET WHERE aufnr = wa_ZVPRODDET-aufnr
          and stat = zstat.
        ENDIF.
      ENDLOOP.
      case mark.
        when All.
          LOOP AT it_ZVPRODDET INTO wa_ZVPRODDET.
            zaufnr = wa_zvproddet-aufnr.
            zarbid = wa_zvproddet-arbid.
            move wa_zvproddet to walnpln.
            append walnpln to itablnpln.
          endloop.
          clear walnpln.
          if not itablnpln is initial.
            SELECT distinct * INTO CORRESPONDING FIELDS OF TABLE itablnp
            FROM zvprdconf FOR ALL ENTRIES IN itablnpln
            where aufnr = itablnpln-aufnr and
            j_3asize = itablnpln-j_3akordx and stzhl eq ' ' and stokz ne 'X'.
            if sy-subrc = 0.
              sort itablnpln by aufnr j_3asize.
              DELETE ADJACENT DUPLICATES FROM ITABLNPLN COMPARING ALL     FIELDS.
            endif.
          endif.
          LOOP AT itablnpln  INTO walnpln.
            contot = 0.
            IF sy-subrc EQ 0.
              LOOP AT itablnp ASSIGNING <fs_itablnp> where aufnr = walnpln-aufnr and j_3asize = walnpln-j_3akordx.
                contot = contot + <fs_itablnp>-J_3ALMNGA.
                move <fs_itablnp>-J_3ASIZE to walnpln-J_3ASIZE.
              ENDLOOP.
              walnpln-output = contot.
              move zvprdconf-isdd to walnpln-zdate.
              move zvprdconf-isdz to walnpln-ztime.
            endif.
            walnpln-wip = walnpln-menge - contot.
            if walnpln-werks = '1000'.
              stklocaf = '1050'.
              stklocas = '1060'.
            elseif walnpln-werks = '2000'.
              stklocaf = '2150'.
              stklocas = '2160'.
            endif.
            select single kunnr into walnpln-ship from vbpa where
            vbeln = walnpln-KDAUF and PARVW = 'WE'.
            zship = walnpln-ship.
            move zship to walnpln-ship.
            select  single kalab into walnpln-zactqty from mska
            where matnr = walnpln-plnbez
            and j_3asize = walnpln-J_3AKORDX and LGORT = stklocaf.
            condense walnpln-kdauf.
            zsales = walnpln-kdauf.
            concatenate zsales 'S' into zso.
            select single kalab into walnpln-zsndqty from mska
            where matnr = walnpln-plnbez
            and j_3asize = walnpln-J_3AKORDX and LGORT = stklocas
            and J_4KSCAT = zso.
            zmatn = walnpln-plnbez.
            zsale = walnpln-KDAUF.
            walnpln-kdauf = zsale.
            walnpln-plnbez = zmatn.
            zcust = walnpln-kunnr.
            walnpln-kunnr = zcust.
            select single bezei into walnpln-season from TVV2T where
            kvgr2 = walnpln-kvgr2 and SPRAS = 'E'.
            select single bezei into walnpln-shipmode from T173T where
            vsart = walnpln-vsart and SPRAS = 'E'.
            STRL = strlen( walnpln-j_3akord2 ).
            if  strl = 4.
              move walnpln-j_3akord2 to walnpln-j_3akord3.
              clear walnpln-j_3akord2.
            endif.
            move zremk to walnpln-remk.
            MODIFY itablnpln FROM  walnpln.
            contot = 0.
            clear itablnp.
          ENDLOOP.
          PERFORM build_fieldcatalog.
          PERFORM build_layout.
          PERFORM display_alv_report.
      endcase.
    [/code]
    regs,
    raja[

  • Making .mov to loop inside flash

    I have a seamless quicktime .mov of clouds I want to use as a background.
    I set my flash animation to loop...but at the end of the .mov file instead of looping it just quits.
    How do I get the quicktime .mov file to loop within flash?
    Using Flash CS4

    Re: Loop inside a loop making performance poor!!!Yup, it probably will be.
    Your nested loops have an advantage in that they give you control over the process of what is happening. Unfortunately due to several factors including context switching between pl/sql and the sql engine this process is all but certain to be slower than doing the work in SQL.
    Instead of nested loops which call a procedure define a cursor directly your routine to get the data, then use a bulk collect - you can read about them in the documentation - to load your collection. One select with a bulk collect is all but certain to be faster than loading each row one item at a time.

  • In smart form

    hi
    in smart form we will write loop into---. what is the need for that. what is the other form available?

    <b>loop into</b> is similar to the <b>loop at itab into wa_itab</b> in the ABAP code...
    if you want to use the work area instead of itab header you write loop into some work area...
    else loop into same itab...

  • Why the control parameters changed when print smart form

    Hi experts:
      I set the control parrameters in my source code to print the smart form, I use the loop table for printing, but I found the print device changed automatically, only the frist page is ok. that means, the control paramenters lost when loop. how to solve it?
    this is my source:
    LOOP AT it_outtab INTO wa_outtab WHERE flag = 'X' .
        ssf_open ls_control_param outopt ls_composer_param.
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            formname           = lf_formname
          IMPORTING
            fm_name            = lf_fm_name
          EXCEPTIONS
            no_form            = 1
            no_function_module = 2
            OTHERS             = 3.
       IF sy-subrc <> 0.
         MESSAGE 'Call SSF_FUNCTION_MODULE_NAME Error' TYPE 'E'.
       ENDIF.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        CALL FUNCTION lf_fm_name
          EXPORTING
            control_parameters = ls_control_param
            zgl_k_stru         = wa_outtab
          EXCEPTIONS
            formatting_error   = 1
            internal_error     = 2
            send_error         = 3
            user_canceled      = 4
            OTHERS             = 5.
       IF sy-subrc <> 0.
         MESSAGE 'Call LF_FM_NAME Error' TYPE 'E'.
       ENDIF.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        ssf_close .
        MOVE-CORRESPONDING outopt TO ls_composer_param.
        ls_composer_param-tdimmed = ' '.
        ls_control_param-no_dialog = 'X'.
        IF outopt-tdpreview = 'X'.
          EXIT.
        ENDIF.
      ENDLOOP.

    Hi Prabhat,
    Please check following point in your smartform design.
    1) In your smartform design, how many pages do you have? (Check the page format and margins, have a look at form painter
        as well)
    2) Check out the navigation from one page to another page.
    3) Debugg the form and check at what point the last page is been added.
    Regards,
    Amee.

  • How to use loop inside table in smart form

    Hi All
    i have to use page break at the end of each pernr. i got table in smart form and print cells on event on sort begin. it is working ok . i have an other itab in  as well .which i want to the same page with respect to the pernr no.
    but the problem is as i loop the 2nd itab. it prints all the record what it has.
    e.g  i have two pernr 54 and 55.
    the records of itab1 prints on page1 and page 2 properly. now i loop at itab2 it also have relevent records of above said pernrs. but i m unable to control those pernrs and loop print all the records on both pages.
    if u get some thing out of it kindly help me
    Regards
    ammad

    hi,
    Place the second loop ie. itab2 inside the first loop of itab1.  And in the conditions tab of looping itab2 give the condition for checking the pernr.
    try to implement this logic.
    loop itab
      at new pernr
        new-page
      endat.
        loop at itab2 where pernr eq itab-pernr.
       endloop.
    endloop.
    revert back for further queries.
    regards
    Rajitha.

  • Looping in smart forms

    HI EXperts,
                       I have a problem in Samrt forms. Can anyone tell me what's the answer of that
    loop at lt_price1 to ls_price1            """"Table that contains material no...    like 8646,8647,8648,8646,8646
       loop at lt_price1 to ls_price2         """loop that counts how many same no. of material in lt_price1 ITAB.
              loop at ltscale to ls_scale   """it;s for scaling (Quantity) of material.
              endloop.
       endloop.
    >>>>>>>>>>>>>>> What can i do that ITAB won't able to read same material row again in lt_price1. can i write a program line that's deletes same no. of material thats in ITAB lt_price1.
    I did all the looping in smart forms but can't to solve my problem.
    Thanks and Regards,
    Shakun.

    You're description is a bit tricky so i might not have understand it well.
    Given your code (and since you  forgot an endloop i just added it:
    loop at lt_price1 to ls_price1 """"Table that contains material no... like 8646,8647,8648,8646,8646
       loop at lt_price1 to ls_price2 """loop that counts how many same no. of material in lt_price1 ITAB.
          loop at _lt_scale to ls_scale """it;s for scaling (Quantity) of material.
         endloop.
       endloop
    * Try this and hope for the best... :)
      delete lt_price1 where matnr eq ls_price1-matnr.
      continue.
    endloop.
    edit.
    But to be honest.. i would do it another way: i would simply make sure that i don;t need to manipulate any data (like deletiong entries from itab) within the smartforms. Instead i would prepare all data in the print program and pass it to the smartform.
    Edited by: Maen Anachronos on Nov 23, 2010 7:26 PM

  • How can I make a control inside a loop in a subVI change value when the calling VI's control changes?

    Hi.
    I think this is a pretty basic LV question, but I have not been able to find a good solution.
    I am attaching VIs that show the problem I am having, but obviously, the real application is a lot complicated, which forces me to try to do it this way.
    The issue is: I have a subVI with a Boolean control inside a loop.  When the control is true I want some action to take place.  When the subVI is run on its own, it works fine, acting properly when I set the boolean control to true via the LV FPGA interface from the host.  However, when I use it as a subVI, in which the top-level VI calls several instances of the subVI, I have the Boolean controls in the top level VI.  What is happening is that the false Boolean value with which the top-level VI starts is passed into the subVIs, and not updated, even though the control is inside the loop.
    Can any one suggest a good solution?
    Thanks,
    AlejandroZ
    Attachments:
    CallingVI.vi ‏7 KB
    subVI.vi ‏8 KB

    Hi.
    I know the example I posted might seem silly, but it was just to illustrate the problem I am having.  In reality this is the application:
    I have some LV FPGA code which uses a few FPGA IO to implement a serial link to communicate with a device.  Most of the time we are getting data from the device, so the serial link is used to send a read command, read in the data and put it into a FIFO.  However, I also wanted the VI to support sending data to the device, so I added an array control to put the data you want to send, and a boolean control to tell it you want to send it.
    Since sending and receiving data are done using the same FPGA IO, they cannot be independent operations, because they would garble each other. Therefore, in the subVI I have a loop in which I first read data if there is any to read, then check the boolean write control to see if there is data to write.
    As I mentioned, this works perfectly for talking to a single device.  However, we run into the issue of this topic when trying to replicate this for several devices.
    One easy solution is to not have the loop in the subVI, and have it in the calling VI (I am favoring this simple solution right now).  The only reason why I have not done this yet, is that the subVI has more than one loop, so I am going to have to create several subVIs.  I just posted to see if there was an even simpler solution...
    There have been some other possibly good solutions proposed here, though I am not sure if they work in LV FPGA.
    Thanks for all your responses.
    AlejandroZ

  • How do we use if statement in labview?moreover can i use if statement inside for loop?

    how do we use if statement in labview?moreover can i use if statement inside for loop?

    The if statement in LabVIEW is the Case structure. You can find that on the Structures palette right next to the For Loop. If you're still on the same subject about terminating a for loop early, then what you do is enclose your functions inside the loop with a case statment and make one of the case's empty except for one or more constants that you might have to wire. Hopefully, the attached picture will explain what I mean. Also, as I mentioned in one of your other posts, I think this technique is not as good as using a while loop. The array in the attached example is the same size no matter what and you may have to handle stripping extra or invalid elements.
    Attachments:
    For_Loop_with_Case.jpg ‏21 KB

  • Standard function module inside a loop.

    Hi Experts,
    I am trying to improve performance program that has a standard abap function module inside a loop. I am some what lost on what to do here. Here below is what the code looks like as of now. I have read that i need to try and not use the function module at all be it is a very complicated function module. Any suggestions will be appreciated.
    DATA: tl_retorno TYPE bapireturn1 OCCURS 0 WITH HEADER LINE. "Retorno
       DATA: wl_bukrs   LIKE acct_det_bf-comp_code,     "Empresa
             wl_process LIKE acct_det_bf-process,       "Chave
             wl_symko   LIKE hrpp_acct_det-symb_acct,   "Conta Simbólica
             wl_momag   LIKE hrpp_acct_det-eg_acct_det, "Agrupamento
             wl_razao   LIKE acct_det_bf-gl_account.    "Conta Razão
    *-->                  <--*
       SORT tg_rubcr BY bukrs lgart.
       LOOP AT tg_rubcr.
         CLEAR: wl_bukrs, wl_process, wl_symko, wl_momag, wl_razao.
         wl_bukrs   = tg_rubcr-bukrs.
         wl_process = tg_rubcr-process.
         wl_symko   = tg_rubcr-symko.
         CLEAR tg_aux.
         IF tg_rubcr-u_momag IS INITIAL. "A rubrica necessita de agrupamento?
           CLEAR wl_momag.
    * Busca Contas Razão sem Agrupamento de Empregados
           CALL FUNCTION 'HRPP_FI_ACCT_DET_HR'
             EXPORTING
               companycode              = wl_bukrs
               process                  = wl_process
               symb_acct                = wl_symko
               eg_acct_det              = wl_momag
               add_modif                = ' '
             IMPORTING
               gl_account_debit         = wl_razao
    *         GL_ACCOUNT_CREDIT        =
    *         POSTING_KEY_DEBIT        =
    *         POSTING_KEY_CREDIT       =
    *         ACCOUNT_TYPE             =
             TABLES
               return_tab               = tl_retorno.
           tg_rubcr-razao = wl_razao.
           tg_aux = tg_rubcr.
           APPEND tg_aux.
         ELSE.  "Não necessita de agrupamento de empregado?
           LOOP AT tg_t52em. "Para todos os agrupamentos
             CLEAR tg_aux.
             CLEAR tl_retorno.
             REFRESH tl_retorno.
             CLEAR wl_momag.
             wl_momag  = tg_t52em-momag.
    * Busca Contas Razão com Agrupamento de Empregados
             CALL FUNCTION 'HRPP_FI_ACCT_DET_HR'
               EXPORTING
                 companycode              = wl_bukrs
                 process                  = wl_process
                 symb_acct                = wl_symko
                 eg_acct_det              = wl_momag
                 add_modif                = ' '
               IMPORTING
                 gl_account_debit         = wl_razao
    *           GL_ACCOUNT_CREDIT        =
    *           POSTING_KEY_DEBIT        =
    *           POSTING_KEY_CREDIT       =
    *           ACCOUNT_TYPE             =
               TABLES
                 return_tab               = tl_retorno.
             tg_rubcr-razao = wl_razao.
             tg_aux = tg_rubcr.
             tg_aux-momag = tg_t52em-momag.
             APPEND tg_aux.
           ENDLOOP.
         ENDIF.
       ENDLOOP.
    * Limpa tabela com rubricas e move todo o conteúdo da auxiliar
       REFRESH tg_rubcr.
       CLEAR tg_rubcr.
       tg_rubcr[] = tg_aux[].
    ENDFORM.                    " busca_conta_razao

    Hi Patrick,
    If you do not want to use the function module then the other option that you can use is do selects from the tables that the FM 'HRPP_FI_ACCT_DET_HR' is using to get the importing "parameter  gl_account_debit         = wl_razao"  outside the loop.
    So steps will be:
    Debug FM 'HRPP_FI_ACCT_DET_HR'  to find out how it getting importing data using exporting parameters.
    Then before the loop is called do a select for all entries on table tg_rubcr. And id muliple tables are used Read statements to populate a final table with gl_account_debit         = wl_razao value.
    Then use the final table to get this value inside the loop.
    Please let me know if you need more details.

  • Is there and alternativ​e to shift registers for saving data across iterations in a subVI operating inside a loop?

    I am creating a subVI state machine (case structure) which will run inside a while loop which will be executing every 250ms. The reason I wanted to make the state machine case structure into a subVI is because I want to execute 64 of the machines within the same loop. The goal is to monitor certain types of voltage changes on 64 I/O channels on a FP2200 RT module and report periodic details about state changes to a database. My thinking was that by executing each independent machine in the same loop structure, I will only worry about one thread. It seems that the alternative of having one state machine thread per I/O channel is probably more than the RT module can handle. Please correct me if I am wrong on that.
    The issue I'm now having is as I'm creating the state machine, I am finding that I need to keep track of some pieces of data from one loop iteration to the next. This is easy enough to do with shift registers but in order to use them, I have to create additional input nodes to my SubVI as well as output nodes. For example, I want to use a queue to buffer some I/O data but as of now, I have to create this queue outside the loop, pull it into the loop across a shift register, feed it to the subVI, and output it to the out Shift register. It would be better if I didn't have to output this queue because there's no reason for anything to have access to it outside the subVI. It just creates an extra set of wires to look at and makes me worry a bit about maintainability. 
    Is there a better way to approach this problem? 

    You could place a while loop inside your sub vi that has a true constant wired to the stop condition. Then add unitialized shift registers to that while loop to keep data between iterations.
    or you could use a feedback node inside the sub vi

  • How to avoid data selection inside the loop?

    Hello Experts,
    I am working on one performance item and I have already applied some changes to the original version.
    Now, If I compare my new program with old program, I have good improvement in performance. I am checking if I can do anything on statements that are top on the below list. I think 40% for Modify statement is acceptable after my research (Below run is updating around 20M records which is real time volume for this application).
    As we can see 34% of run time to going for one SELECT query on custom table. Take a look at below high level flow of my program to understand above select query.
    1. Select data from ZABC
    2. Select data from Variant Table (Var1, Var2, Var3 etc.., 12 in real time)
    3. Loop Variant Table
    4. Select data from X, Y, Z table for Var<n>.
    5. Populate final internal table from ZABC, X, Y and Z table
    6. Modify ZTABLE with Final Internal table data
    7. End Loop on Variant Table
    As described in the flow of the program, ZABC table data is common for all the variants and need not to fetch multiple times. Hence I am doing it only once in my program. Below is that select query:
    select rrcty ryear rbukrs racct rcntr sum( amt1) as amt1  "Like I have 32 amount fields in original query
               from zabc
                into table i_zabc
                where ryear in r_year    " Two records in ranges with I and EQ
                and rvers = '001'
                and rrcty in r_rrcty        "Three records in ranges with I and EQ
                and rldnr = 'DT'
                group by rrcty ryear rbukrs racct rcntr
                order by rrcty ryear rbukrs racct rcntr.
    ZABC table is again having huge volume of data and we are fetching millions of records with above query. That is primary reason to take long time. May be that is okay as I am already using Indexes of this table. But, I am not comfortable with it as it can reach max. memory point and through run time error. Fetch Cursor is one reliable option that I can see here, but with that, I should move ZABC selection inside the variant loop which can cause fetching ZABC data 12 times (Let me know If I am missing anything here).
    Now, third statement in my trace results, with 10% of overall time is this:
    loop at i_abc assigning <fs_abc>. 
    loop at i_table assigning <fs_table> where low <= <fs_abc>-racct and high >= <fs_abc>-racct. 
    endloop. 
    endloop. 
    6 million executions with this complex WHERE condition is causing this statement to get 3rd position in trace results. I tried below two options which are, I think, taking even more time - (I am still monitoring these options)
    1) Removed WHERE condition on LOW, HIGH and applied filter inside the loop.
    2) Removed WHERE condition on HIGH only and applied filter inside the loop.
    Any suggestions on how to proceed with ZABC selection and I_TABLE loop.
    Let me know if you have any questions on above compose.

    Since I looked at this case before, let me try some quick suggestions:
    Is table ZABC related to table X, Y and/or Z and can the selection be limited by applying those 12 selection variants?
    If yes, try a join select involving these tables that could make your step 1 obsolete and replace steps 4 and 5.
    This might also get rid of the "loop inside loop" problem. Generally, make sure that the inner table is declared as a sorted table with a key that consists of the fields as used in the WHERE-condition of the inner loop. Use secondary keys for internal tables if your ABAP release permits and the task at hand warrants it.
    Finally, look at PACKAGE SIZE option for the (join) select to reduce memory consumption.
    Thomas

  • How to pass a value from inside a while loop outside the loop

    Hello to everybody, I have been searching through the forum but I have not found a certain answer for my problem. I would try to explain my problem as breefly as posible:
    I have to send by a BNC2120 two signals and acquire an other one thats comes from a preassure sensor. That part is done by introducing simulating and acquiring DAQmx inside while loops.It is sycronized by my self, proving such diferent values (is not the optimum, but is only the first prototype) and works as I expected. Well, then I want to sample some of the values of these signals, that is done with relays and local variables to get the value in the instant I want to sample. Here begin my problems: I want to extract the sample values out of the while loops without restarting them, I mean: I do not want to stop the while loops because the acquisition and the generation of the signal must be continuous, but I do not know if it is posible to put the while loops in "standby" until I operate with the values I have sampled and then the signal generator and the acquiere continues from when it has stoped before. Particulary I want to obtain the value of the top while loop (inside a case) when the counter arrives at 15.
    I have proved to do with local variables, global variables, making a state machine, with event cases, with flat secuences...I have been reading about and proving diferent posible solutions for this week and the whole past week and I have not found the solution.
    If any of you know how I can do this thing, I would be loved to listen your opinions. My proyect is above: 
    Thank you a lot in advance.
    Sinceresly,
    Miguel.
    Attachments:
    maq_estados_event_case.vi ‏239 KB

    It definately sounds like what you really want is a Producer/Consumer.  It is an architecture that uses Queues to pass data from a data generation loop (producter, your DAQ loop) and a data processor (consumer).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

Maybe you are looking for

  • I moved my iTunes folder and now I can't make iTunes find it again.

    I moved my entire iTunes folder from \\dc1\JEly$\MyMusic\iTunes\iTunesMusic to C:\Documents and Settings\John Ely\My Documents\My Music\iTunes . I did this to try to make MediaSync for Blackberry work. (Which has been a major headache.) But now iTune

  • Lightroom not showing up in Creative Cloud "your apps" list with others, thus is not updating

    I use several Adobe programs, among them Lightroom. However, in my Creative Cloud window, accessible in the header bar on my desktop, the other apps show up under "Your Apps", but not Lightroom 5. Therefore, it is not updating to 5.2. How can this be

  • Problem in passing selection screen values using CALL TRANSACTION.

    Hi All I am facing problem in transfering selection screen values to the called transaction. I am trying to pass the path of the transaction filer but to no avail. The variable for filepath is not empty. Below is my code: DATA: lt_bdcdata TYPE TABLE

  • How to insert into a table using a procedure in a trigger

    I have following trigger and based on the some condition, it should inser a row in to a table using the procedure: CREATE OR REPLACE TRIGGER RSSC.RR_SERV_ADD_ON_REQ_bu before update on RSSC.RR_SERV_ADD_ON_REQ for each row DECLARE lr_appr_trans_hdr AP

  • MIRO BADI 'INVOICE_UPDATE'

    I am using BADI 'INVOICE_UPDATE' to update a flag 'ZLSPR' in header data on SAVE in MIRO transaction. but the method 'CHANGE_AT_SAVE' in this BADI only has import parameters. No export parameters. Can anyone advice: 1) if I can use this method to cha