Looping and append related prob

hi experts,
i need to populate a final internal table from 4 diffrent internal tables,
namely it_vbrk,
it_vbrp,
it_lips, it_mch1
logic here
**loop at it_vbrk into wa_vbrk.
wa_final -   = wa_vbrk----
loop at it_vbrp from idx.   then i use parallel cursor, as i needed multiple items based on single vbrk-vbeln
wa_final---- = wa_vbrk ---
loop at it_lips into wa_lips." based on some cond on where clause
    here also i ve to used loop , as there r multiple batch no .
wa_final - = wa_lips-
loop at it_mch1 into wa_mch1 where charg = wa_lips-charg
wa_final --- = wa_mch1 .
APPEND wa_final TO it_final.
    CLEAR wa_final.
    endloop.
endloop.
    endloop  
  ENDLOOP."
but in this code data getting populated are wrong ones,
can u plz tell me  the exact sequence how to used endloops and append work area values and clear that.
i getting confused ,plz help

Hi,
Reading data from 4 database table into different internal table and then read these table into a final internal table using 'FOR ALL ENTRIES'.
Use this code, its working:-
*          RANGES DECLARATION
*          RANGE VALUE TO BE USED FOR THE ORDER TYPE
RANGES : r_auart FOR aufk-auart. "for order type
*          TYPE DECLARATION
TYPES :
* for table aufk (work order details)
        BEGIN OF t_aufk,
          aufnr TYPE aufk-aufnr, " order number
          ktext TYPE aufk-ktext, " description
          objnr TYPE aufk-objnr, " object number
        END OF t_aufk,
* for table jest (object status details)
        BEGIN OF t_jest,
          objnr TYPE jest-objnr, " object number
        END OF t_jest,
* for table afko (basic finish date details)
        BEGIN OF t_afko,
          aufnr TYPE afko-aufnr, " order number
          gltrp TYPE afko-gltrp, "basic finish date
        END OF t_afko,
* for table qmel (notification number details)
        BEGIN OF t_qmel,
          aufnr TYPE qmel-aufnr, " order number
          qmnum TYPE qmel-qmnum, " notification number
        END OF t_qmel,
* final table from which the records need to be displayed
        BEGIN OF t_final,
          aufnr TYPE aufk-aufnr, " order number
          ktext TYPE aufk-ktext, " description
          qmnum TYPE qmel-qmnum, " notification number
          flag(1), " for selection of records
        END OF t_final.
*          INTERNAL TABLE & WORK AREA DECLARATIONS
* TYPE OF T_AUFK
* internal table to select records for damaged order types
DATA : it_aufk TYPE STANDARD TABLE OF t_aufk,
* work area for damaged order types
       wa_aufk TYPE t_aufk.
* TYPE OF T_JEST
* internal table to select object number based upon user status
DATA : it_jest TYPE STANDARD TABLE OF t_jest,
* work area to select object number based upon user status
       wa_jest TYPE t_jest.
* TYPE OF T_AFKO
* internal table to select the basic finish date corresopnding to work order
DATA : it_afko TYPE STANDARD TABLE OF t_afko,
* work area to select the basic finish date corresopnding to work order
       wa_afko TYPE t_afko.
* TYPE OF T_QMEL
* internal table to select the notification number corresopnding to object number
DATA : it_qmel TYPE STANDARD TABLE OF t_qmel,
* work area to select the notification number corresopnding to object number
       wa_qmel TYPE t_qmel.
* TYPE OF T_FINAL
* final internal table to select final records to be displayed
DATA : it_final TYPE STANDARD TABLE OF t_final,
* final work area to select final records to be displayed
       wa_final TYPE t_final.
*          INITIALIZATION
*          TO INITIALIZE ALL THE VARIABLES TO BE USED
*          IN THE PROGRAM
INITIALIZATION.
  r_auart-sign = 'I'.             " for inclusive
  r_auart-option = 'BT'.          " for between operator
  r_auart-low = 'PM01'.           " order type(low value)
  r_auart-high = 'PM02'.          " order type(high value)
  APPEND r_auart.                 " append values for range
*          START-OF-SELECTION
START-OF-SELECTION.
*          CLEAR ALL THE CONTENTS OF ALL INTERBAL TABLES
  REFRESH it_jest.
  REFRESH it_aufk.
  REFRESH it_afko.
  REFRESH it_qmel.
  REFRESH it_final.
*          select user status from TJ02T for TXT04(status of an object)
*          into variable V_ISTAT
  SELECT SINGLE
    istat
  FROM tj02t
  INTO (v_istat)
  WHERE
    txt04 EQ 'TECO' AND
    spras EQ 'E'.
*          select object number based upon the user status selected
  SELECT
    objnr
  FROM jest
  INTO TABLE it_jest
  WHERE
    stat EQ v_istat.
  IF sy-subrc  0.
    MESSAGE e003.
  ELSE.
*         select into it_aufk table: object number, description and
*         object number based on object number selected and order type
*         in PM01 and PM02
    SELECT
      aufnr
      ktext
      objnr
    FROM aufk
    INTO TABLE it_aufk
    FOR ALL ENTRIES IN it_jest
    WHERE
      objnr EQ it_jest-objnr AND
      auart IN r_auart.
    IF sy-subrc  0.
      MESSAGE e002.
    ELSE.
*         select into it_afko table: order number and basic finish date
*         based upon order number selected and basic finish date as
*         v_cdate variable
      SELECT
        aufnr
        gltrp
      FROM afko
      INTO TABLE it_afko
      FOR ALL ENTRIES IN it_aufk
      WHERE
        aufnr EQ it_aufk-aufnr AND
        gltrp LE sy-datum.
*         select into it_qmel table: order number and notification
*         number based on the order number selected
      SELECT
        aufnr
        qmnum
      FROM qmel
      INTO TABLE it_qmel
      FOR ALL ENTRIES IN it_aufk
      WHERE
        aufnr EQ it_aufk-aufnr.
    ENDIF.
  ENDIF.
*          READ THE RECORDS FOMR THE ABOVE POPULATED INTERNAL TABLE
*          INTO WORK AREA AND THEN POPULATE THE FINAL INTERNAL
*          TABLE
* read internal table it_jest into work area wa_jest
  LOOP AT it_jest INTO wa_jest.
* read it_aufk based on object number from wa_jest
    READ TABLE it_aufk INTO wa_aufk WITH KEY objnr = wa_jest-objnr.
* if records found
    IF sy-subrc EQ 0.
* read it_afko for order number and description based on order number
      READ TABLE it_afko INTO wa_afko WITH KEY aufnr = wa_aufk-aufnr.
* if records found
      IF sy-subrc EQ 0.
        wa_final-aufnr = wa_afko-aufnr. "move order number to it_final
        wa_final-ktext = wa_aufk-ktext. "move description to it_final
      ELSE.
* if no record found then move to next loop pass
        CONTINUE.
      ENDIF.
    ELSE.
* if no record found then move to next loop pass
      CONTINUE.
    ENDIF.
* read it_qmel for description based on the order number selected above
    READ TABLE it_qmel INTO wa_qmel WITH KEY aufnr = wa_final-aufnr.
* if records found
    IF sy-subrc EQ 0.
      wa_final-qmnum = wa_qmel-qmnum. "move notification number to it_final
    ENDIF.
* finally append the records into the final internal table
    APPEND wa_final TO it_final. "append wa_final into it_final
    CLEAR wa_final. "clear work area
    CLEAR wa_aufk.  "clear work area
    CLEAR wa_qmel.  "clear work area
  ENDLOOP.
Hope this helps you.
Thanks & Regards,
Tarun Gambhir

Similar Messages

  • Help in loop and at new

    Hallow I have a program that call to smart form. The user have to put course number and employee number and  the program check if the student pass the course send sf and if don’t  send other sf .my problem is when the user put just course number in, other words he wont to print sf of all the student that do some course , I don’t now how to call to smart form in loop because all the time I have a new student and the program have to check if the student pass the course or not and send sf accordingly.
    I heard about at new but I don’t now how to use it or if its fitting my need .
    regards
    IF pernr IS INITIAL .
    *--For-Empty-Pernr--
      SELECT objid_e 
      FROM yhr_score_page
      INTO wa_score_tab-objid_e
      WHERE objid_e IN c_course.
        IF sy-subrc = 0.
          APPEND wa_score_tab TO score_tab.
          CLEAR wa_score_tab.
        ENDIF.
      ENDSELECT.
    ELSE.
      SELECT objid_e 
        FROM yhr_score_page
        INTO wa_score_tab-objid_e
        WHERE objid_e IN c_course
        AND objid_p = pernr.
        IF sy-subrc = 0.
          APPEND wa_score_tab TO score_tab.
          CLEAR wa_score_tab.
        ENDIF.
      ENDSELECT.
    ENDIF.
    This is  the call fo the smart form
    IF sum_n GE passed_nuric. " if student pass course use first function
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname               = 'YHR_SCORE_SMART_FORM_PASS'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
       IMPORTING
         fm_name                  = /1bcdwb/sf00000005
    EXCEPTIONS
      NO_FORM                  = 1
      NO_FUNCTION_MODULE       = 2
      OTHERS                   = 3
      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 '/1BCDWB/SF00000005'
        EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
      CONTROL_PARAMETERS         =
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
          score_tab2                 = wa_score_tab2
          sum_all                    = sum_all
          sum_n                      = sum_n
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
        TABLES
          score_tab                  = score_tab
    EXCEPTIONS
      FORMATTING_ERROR           = 1
      INTERNAL_ERROR             = 2
      SEND_ERROR                 = 3
      USER_CANCELED              = 4
      OTHERS                     = 5
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *--dont pass--
    ELSE.
      READ TABLE score_tab INDEX 1 INTO wa_score_tab.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname               = 'YHR_SCORE_SMART_FORM'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
       IMPORTING
         fm_name                  = /1bcdwb/sf00000002
    EXCEPTIONS
      NO_FORM                  = 1
      NO_FUNCTION_MODULE       = 2
      OTHERS                   = 3
      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 '/1BCDWB/SF00000002'
        EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
      CONTROL_PARAMETERS         =
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
          score_tab                  = wa_score_tab
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
    EXCEPTIONS
      FORMATTING_ERROR           = 1
      INTERNAL_ERROR             = 2
      SEND_ERROR                 = 3
      USER_CANCELED              = 4
      OTHERS                     = 5
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

    LOOP AT itab.
    AT NEW stud.
      perform xxxx.
    ENDAT.
    ENDLOOP.
    Refer SF
    Refer this link for Smartforms
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d937ec90-0201-0010-0ca8-b6cb3b6dd1ef
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b590fd97-0301-0010-db90-d09ff93cee5a
    Subroutine in smartform
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/ccab6730-0501-0010-ee84-de050a6cc287
    Style and mailing the Smartform output
    https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
    Table,Template,Loop and Command in Smartform
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985

  • How do I move data from a DAQ into and out of loops and structures?

    I have a set of RTD probes set up to read data into LabView through a DAQ. This block of code is in a while loop
    that executes alongside of several other loops simultaneously. I need to use the data from the RTD probes in other
    loops and case structures specifically for logic tests.
    The problem is that I can't seem to bring the dynamic data out of the DAQ containing while loop or into the other structures.
    Any ideas?
    I have had some success with using multiple DAQs and stopping all others while I need the data inside of a case structure.
    Is there a way to reference data from a DAQ or to run multiple DAQs that read the same data from the same channels without getting a "Task in use error"?
    Thanks,
    -David

    Search the forums for Prodcuer/consumer architecture.
    This uses queues to pass data from the producer loop (such as your data acquisition loop) to other "consumer" loops.  These are the other loops where you want to use the data.
    You won't be able to use multiple DAQ Read functions at the same time.  As you've seen you get error -50103 about the resources already being in use.

  • PO line item details from BAPI_PO_GETDETAIL1 and append to BAPI_PO_CHANGE

    Hi,
    The requirement is to get PO line item details from BAPI_PO_GETDETAIL1 and save it in the internal table and append that internal table into  the BAPI_PO_CHANGE.
    But i am getting dump in this program.
    TABLES: ekpo.
    DATA: BEGIN OF po_details.
            INCLUDE STRUCTURE BAPIMEPOITEM. "Include the structure of Dictionary Reference.
    DATA: END OF po_details.
    DATA: BEGIN OF po_details1.
            INCLUDE STRUCTURE BAPIMEPOITEM. "Include the structure of Dictionary Reference.
    data: END OF po_details1.
    DATA: it_po_details LIKE STANDARD TABLE OF po_details,
    wa_po_details like line of it_po_details.
    data: it_po_details1 like standard table of po_details,
    wa_po_details1 like line of it_po_details1.
    PARAMETERS: p_ebeln LIKE ekpo-ebeln DEFAULT '4500000016'.
    CALL FUNCTION 'BAPI_PO_GETDETAIL1'
      EXPORTING
        PURCHASEORDER = p_ebeln
      TABLES
        POITEM        = it_po_details.
    loop at it_po_details into po_details.
      read table it_po_details into wa_po_details with key PO_item = p_ebeln.
      move-corresponding po_details to po_details1.
      CALL FUNCTION 'BAPI_PO_CHANGE'
        EXPORTING
          PURCHASEORDER = p_ebeln
        TABLES
          POITEM        = it_po_details.
      append po_details to it_po_details1.
      LOOP AT it_po_details1 INTO wa_po_details1.
        WRITE:/ wa_po_details1-PO_item,
           wa_po_details1-MATERIAL,
           wa_po_details1-SHORT_TEXT,
           wa_po_details1-PLANT.
      ENDLOOP.
    endloop.

    HI,
    1st you check for the following following  authorization objects are checked:                                                                               
    M_BEST_BSA (document type in PO)                                                                               
    M_BEST_EKG (purchasing group in PO)                                                                               
    M_BEST_EKO (purchasing organization in PO)                                                                               
    M_BEST_WRK (plant in PO)          
    and to change the PO below is the eg for changing the short text:-
    TABLES: ekpo.
    DATA: BEGIN OF po_details.
            INCLUDE STRUCTURE bapimepoitem. "Include the structure of Dictionary Reference.
    DATA: END OF po_details.
    DATA: BEGIN OF po_details1.
            INCLUDE STRUCTURE bapimepoitem. "Include the structure of Dictionary Reference.
    DATA: END OF po_details1.
    DATA: it_po_details LIKE STANDARD TABLE OF po_details,
    wa_po_details LIKE LINE OF it_po_details.
    DATA: it_po_details1 LIKE STANDARD TABLE OF po_details,
    wa_po_details1 LIKE LINE OF it_po_details1,
    poheader  LIKE  bapimepoheader,
    return  LIKE STANDARD TABLE OF  bapiret2 WITH HEADER LINE,
    poitemx LIKE STANDARD TABLE OF  bapimepoitemx WITH HEADER LINE.
    PARAMETERS: p_ebeln LIKE ekpo-ebeln DEFAULT '5600010646'.
    CALL FUNCTION 'BAPI_PO_GETDETAIL1'
      EXPORTING
        purchaseorder = p_ebeln
      IMPORTING
        poheader      = poheader
      TABLES
        poitem        = it_po_details.
    LOOP AT it_po_details INTO po_details.
      READ TABLE it_po_details INTO wa_po_details INDEX 1.
      MOVE-CORRESPONDING po_details TO po_details1.
      MOVE: po_details-po_item TO poitemx-po_item,
            'X' TO poitemx-short_text.
      APPEND poitemx.
      CALL FUNCTION 'BAPI_PO_CHANGE'
        EXPORTING
          purchaseorder = p_ebeln
          poheader      = poheader
        TABLES
          return        = return[]
          poitem        = it_po_details[]
          poitemx     =
          poitemx[].
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      APPEND po_details TO it_po_details1.
      LOOP AT it_po_details1 INTO wa_po_details1.
        WRITE:/ wa_po_details1-po_item,
        wa_po_details1-material,
        wa_po_details1-short_text,
        wa_po_details1-plant.
      ENDLOOP.
    ENDLOOP.

  • I was performing the new ios update to my 4S this morning.  Now the phone is stuck in an enless reboot loop and I can't fix it

    I attempted to update my 4S with the latest iOS.  Now my phone is in an enless boot loop and I cannot stop it, even after powering off and on...

    Error 1604:
    This error is often related to USB timing. Try changing USB ports, using a different dock connector to USB cable, and other available USB troubleshooting steps (troubleshooting USB connections. If you are using a dock, bypass it and connect directly to the white Apple USB dock connector cable. If the issue persists on a known-good computer, the device may need service.
    If the issue is not resolved by USB isolation troubleshooting, and another computer is not available, try these steps to resolve the issue:
    Connect the device to iTunes, confirm that the device is in Recovery Mode. If it's not in Recovery Mode, put it into Recovery Mode.
    Restore and wait for the error.
    When prompted, click OK.
    Close and reopen iTunes while the device remains connected.
    The device should now be recognized in Recovery Mode again.
    Try to restore again.
    If the steps above do not resolve the issue, try restoring using a known-good USB cable, computer, and network connection.
    From Apple Support page >
    iTunes: Specific update-and-restore error messages and advanced troubleshooting

  • Please, help. I have a simpple problem with selects and appends

    Hi experts,
    I want to append the data from pi_temp to pi_inter in every LOOP.
    What I have to do? Thanks a lot !!!! thank u!
    CODE:
    FORM get_interconsultes_data  TABLES pi_inter STRUCTURE zbw_interconsultes.
    DATA: pi_temp LIKE TABLE OF zbw_interconsultes.
    SELECT ZISH_POS_INTER~FALNR
        INTO table i_inter
        FROM ZISH_POS_INTER
      where ( ( ZISH_POS_INTER~DATA_CREACIO IN rg_erdat )
      OR ( ZISH_POS_INTER~DATA_RESPOSTA IN rg_updat ) ).
    DELETE ADJACENT DUPLICATEs FROM i_inter.
    loop at i_inter.
      SELECT *
        INTO CORRESPONDING FIELDS OF TABLE pi_temp
        FROM ( ZISH_CAP_INTER LEFT OUTER JOIN ZISH_POS_INTER
          ON ZISH_CAP_INTEREINRI = ZISH_POS_INTEREINRI
          AND   ZISH_CAP_INTERPATNR = ZISH_POS_INTERPATNR
         AND ZISH_CAP_INTERFALNR = ZISH_POS_INTERFALNR
         AND  ZISH_CAP_INTERSERVEI_PETI = ZISH_POS_INTERSERVEI_PETI
         AND  ZISH_CAP_INTERER_PETI = ZISH_POS_INTERER_PETI
         AND  ZISH_CAP_INTERSERVEI_REALIT = ZISH_POS_INTERSERVEI_REALIT
        AND  ZISH_CAP_INTERER_REALIT = ZISH_POS_INTERER_REALIT
         AND  ZISH_CAP_INTERDATA_CREACIO = ZISH_POS_INTERDATA_CREACIO
        AND  ZISH_CAP_INTERHORA_CREACIO = ZISH_POS_INTERHORA_CREACIO )
        where ZISH_CAP_INTER~FALNR = i_inter-episodi.
    *MOVE-CORRESPONDING pi_temp to pi_inter.?????????????????
    endloop.

    DATA: pi_temp LIKE TABLE OF zbw_interconsultes.
    data: ls_temp like line of pi_temp.
    data: ls_inter like line of pi_inter.
    loop at i_inter.
    SELECT *
    INTO CORRESPONDING FIELDS OF TABLE pi_temp
    FROM ( ZISH_CAP_INTER LEFT OUTER JOIN ZISH_POS_INTER
    ON ZISH_CAP_INTER~EINRI = ZISH_POS_INTER~EINRI
    AND ZISH_CAP_INTER~PATNR = ZISH_POS_INTER~PATNR
    AND ZISH_CAP_INTER~FALNR = ZISH_POS_INTER~FALNR
    AND ZISH_CAP_INTER~SERVEI_PETI = ZISH_POS_INTER~SERVEI_PETI
    AND ZISH_CAP_INTER~ER_PETI = ZISH_POS_INTER~ER_PETI
    AND ZISH_CAP_INTER~SERVEI_REALIT = ZISH_POS_INTER~SERVEI_REALIT
    AND ZISH_CAP_INTER~ER_REALIT = ZISH_POS_INTER~ER_REALIT
    AND ZISH_CAP_INTER~DATA_CREACIO = ZISH_POS_INTER~DATA_CREACIO
    AND ZISH_CAP_INTER~HORA_CREACIO = ZISH_POS_INTER~HORA_CREACIO )
    where ZISH_CAP_INTER~FALNR = i_inter-episodi.
    * Loop PI_TEMP in to work aread(LS_TEMP) move to other work area(LS_INTER)
    * and append workarea(LS_INTER) to table PI_INTER
      loop at pi_temp into ls_temp.
        MOVE-CORRESPONDING ls_temp to ls_inter.
        append ls_inter to pi_inter.
      endloop.
    endloop.
    Hope this helps.
    Regards,
    Rich Heilman

  • Idoc Configuration and interfaces related to 810

    Hi,
      Can any one tell me the entire configuration of ALE and EDI810 supported tools?
    Thanks
    Shobi

    <b>Hi,
    ALE
    To develop a new custom ALE scenario, comprises 5 steps:
    1.     Design and develop the custom IDoc with it’s segments and a new message type
    2.     Configure the ALE environment with the new IDoc and message type (customer model, partner profiles and linking IDoc to message type)
    3.     Develop the outbound process which does the following:
    •     Populates the custom IDoc with control info and functional data
    •     Sends the IDoc to the ALE layer for distribution
    •     Updates status and handles errors
    4.     Configure the ALE inbound side (partner profiles with inbound process code)
    5.     Develop the inbound process which does the following:
    •     Reads the IDoc into a BDC table; selects other data that is required
    •     Runs transaction using call transaction or BDC session
    •     Updates status and handles errors
    Below is a pictorial representation of the flow of a complete ALE scenario from the sending system to the receiving system.
    Figure 1: ALE Scenario model
    1.1.     ALE Example
    For the purposes of this example we will develop a small ALE scenario. This scenario is described below.
    “The receiver of an internal service must be able to reverse (cancel) the invoice receipt which will then cancel the applicable billing document automatically on the service provider’s system.”
    Figure 2: Example Purchasing & Selling scenario
    We will develop a custom IDoc to carry the billing number from the Service Receiver’s system to the Service Provider’s system. We will populate the IDoc in a user exit on the sending side and we will process the transaction on the receiving side using a custom function module and a BDC transaction call.
    No rule conversion, segment filtering or version conversion will be implemented in the model as described in Figure 1.
    Requirements
    •     Working ALE environment - See ALE Basis Configuration Guide;
    •     ALE scenario design together with the business requirement;
    •     Development access; and
    •     ALE configuration access.
    NOTES:
    1.     All IMG references to transactions are located in the transaction SALE which is the ALE portion of the IMG
    2.     This is one way of developing a scenario where no message control exists. If message control exist (EG. On purchase orders) then NAST can be used to call an outbound function module that would create the required IDocs.
    3.     Extensive knowledge of IDocs and ALE basis configuration is required in order to understand this guide.
    2.     OUTBOUND PROCESSING
    2.1.     Create IDoc type (WE30) Client independent
    The IDoc type refers to the IDoc structure that you will require for your development. In our case the IDoc type is called ZINVRV01. This IDoc type will have 1 segment called Z1INVRV with 2 fields, LIFNR & XBLNR, in this segment. If you require many segments or nested segments then they are also created using the same procedure.
    We will create the IDoc of the following structure:
    ZINVRV01
    Purchasing and Selling - Invoice receipt reversal
    Z1INVRV     P&S - Segment 1
         Segment fields     
              LIFNR     Vendor account number
              XBLNR     Reference document number
    Figure 3: IDoc type ZINVRV01
    To create the IDoc type, follow these next few steps:
    •     Enter transaction WE30 (ALE -> Extensions -> IDoc types -> Maintain IDoc type)
    •     Type in ZINVRV01 and click on Basic IDoc type, click the Create icon
    •     Click on Create new (we are creating an IDoc from scratch but you may want to copy another IDoc if it is similar to your requirements) and enter a description, and press enter
    •     Click on ZINVRV01 and then on the Create icon
    •     Enter Z1INVRV as the segment type (must start with Z1), check mandatory if the segment must exist (in this case check it), enter 1 in minimum number and 1 as maximum number. (Make the maximum number 9999999999 if there are going to be many of these segments in each IDoc. IE. When line items are passed via IDocs), click on Segment editor
    •     Enter a description for your segment type and create
    •     Enter a description for your segment, enter each field required in your IDoc, in our case type LIFNR across for Field name, DE structure and DE documentation, repeat for XBLNR and press enter to validate.
    •     Save and generate, press back
    •     To release the segment choose Goto, Release from the menu
    •     Check the box on the line of your new segment
    •     Save, back and enter
    •     Your IDoc type structure should be displayed with your new segment
    •     Save and back
    •     To release the IDoc type choose Extras, Release type from the menu and Yes
    Your IDoc is now ready for use. If you need to add fields or segments to your IDoc type, you will need to cancel the release of the IDoc type as well as the segment release using a similar procedure followed above (except now you uncheck the release box for the segment and you choose cancel release for the IDoc type).
    2.2.     Create message type (WE81) Client independent
    To create a new message type, follow these next few steps:
    •     Enter transaction WE81 (ALE -> Extensions -> IDoc types -> Maintain message type for intermed. Structure -> Create logical message type)
    •     Choose Create logical message type by double clicking on it
    •     Click on change icon to enter change mode
    •     Click on New entries to add a new type
    •     Enter the required message type, in our case it is ZINVRV and an appropriate description
    •     Save and exit.
    Your message type has now been created. The next step will be to link it to the IDoc.
    2.2.1.     Link message to IDoc type (WE82 & BD69) Client independent
    To link the message type to the IDoc type follow these next few steps:
    •     Enter transaction WE82 (ALE -> Extensions -> IDoc types -> Maintain message type for intermed. Structure -> EDI: Message Types and Assignment to IDoc Types)
    •     Click on change icon to enter change mode
    •     Click on New entries to create the link
    •     Enter the message type ZINVRV and the BasicIDoc type as ZINVRV01
    •     Save and exit
    •     Enter transaction BD69 (ALE -> Extensions -> IDoc types -> Maintain message type for intermed. Structure -> Assign message type to IDoc for ALE)
    •     Click on change icon to enter change mode
    •     Click on New entries to create the link
    •     Enter the message type ZINVRV and the BasicIDoc type as ZINVRV01
    •     Save and exit
    Your IDoc is now linked to your message type. We still need to link object types and add the message to the model before we can use the message.
    2.2.2.     Maintain object type for message type (BD59) Client independent
    The ALE objects are used to create links between IDocs and applications objects, to control the serialisation, to filter messages in the customer model and to use listings.
    For our own message type and IDoc you must maintain object types for the links.
    If you want to check the serialisation for the message type, then you must maintain object types for the serialisation. If no serialisation object has been maintained for a given message type, then the serialisation will not be checked for this message type.
    To add an object type to our message type, follow these next few steps:
    •     Enter transaction BD59 (ALE -> Extensions -> ALE object maintenance -> Maintain object types)
    •     Type in your message type ZINVRV and press enter
    •     Click on New entries
    •     Enter your object type, LIFNR (We need to use the vendor as a filter object), the segment name where LIFNR resides, Z1INVRV, a number 1 for the sequence followed by the actual field name LIFNR
    •     Save and exit.
    You have now created an object that we’ll use as a filter object in the customer model to direct the flow of messages to the various logical systems based on the vendors in the filter of the message type ZINVRV.
    We now need to add our new message type to the distribution model.
    2.3.     Configuring the Distribution Model
    This task is performed on your ALE reference client.
    2.3.1.     Manual Configuration (BD64) Client dependent
    To manually configure the customer distribution model, read the ALE configuration procedure, and follow these steps:
    •     Perform the Maintain customer distribution model directly function. (ALE -> Distribution customer model -> Maintain customer distribution model directly)
    •     Specify the customer model you want to maintain and the logical system that is to be the sender of the messages OR create a new model. (Create model ALE with logical system ALELS1C400)
    •     Choose the receiving systems to which the sending system must forward message type ZINVRV to.
    •     For each receiving logical system allocate the message type necessary for communication to the receiving systems as per ALE configuration procedure.
    •     Create filter objects (in our case LIFNR as the object type with the associated vendor number, 0000018001 with leading zeros, in the object area) for the message types.
    •     Save the entries.
    NOTES:
    You cannot maintain a message type between the same sender and receiver in more than one customer distribution model.
    Only the owner is authorised to modify the model.
    To change the owner of a model, choose the 'Maintain ownership of customer distribution model' function. Make sure that all changes will be distributed to all systems that know the corresponding model. To do so, you can use the correction and transport system.
    To transport the customer distribution model you should use the Distribute customer model function of the IMG as described below.
    2.3.2.     Distribute customer model (BD71) Client dependent
    After the customer model has been created centrally, it must be distributed to the other remote systems. This entails first of all setting up the communication for the distributed systems and then sending the model.
    2.3.2.1.     Distribute Model (BD71) Client dependent
    This task is performed on your ALE reference client. To distribute the customer distribution model, read the ALE configuration procedure and follow these steps:
    •     Make the settings for the communication with the other decentral systems, you have not set them yet.
    •     Define the RFC destination for R/3 connections whose names correspond to the name of the corresponding logical system.
    •     Create the output partner profile.
    •     Distribute the customer model
    •     Specify the name of the customer model.
    •     You must specify the target system to which you want to distribute the customer model.
    •     You must repeat this function for every distributed logical system.
    2.3.2.2.     Maintain sending system partner profile (WE20) Client dependent
    With this function, you define the partner profiles for all outbound and inbound messages on the basis of the customer distribution model.
    After you have defined and distributed the customer model, you will have to maintain the partner profiles locally. To do this read the ALE configuration procedure.
    •     Enter the output mode (background, immediately) and the package size for outbound processing.
    Requirements
    •     The customer model must be maintained.
    •     RFC destinations must be maintained.
    •     The customer model must be distributed.
    •     To ensure that the appropriate persons in charge are informed if a processing error occurs, you must make settings in: Error processing Maintain organisational units.
    2.4.     Populate & distribute IDoc using ABAP
    An IDoc consists of a control record with structure edidc and one or more data records with structure edidd. The control record contains the sender and recipient of the IDoc, as well as information on the type of message.
    To be able to pass an IDoc to the ALE layer, you must set up a field string with structure edidc and an internal table with structure edidd. They are used to call function module master_idoc_distribute, which performs the save to the database and triggers the dispatch if necessary.
    2.4.1.     Example code
    The code displayed below does the following:
    •     populates our IDoc segment Z1INVR with the 2 fields XBLNR and LIFNR, populates the segment name and appends this to an internal table used to store the IDoc data;
    •     populates the control record info with the message type and IDoc type; and
    •     calls the MASTER_IDOC_DISTRIBUTE function module which distributes the IDoc as configured in the customer distribution model.
    *--- Data declaration statements
    DATA:          C_INVREV_SEGNAME(7) TYPE C VALUE 'Z1INVRV',
              C_INVREV_MESTYPE(6) TYPE C VALUE 'ZINVRV',
              C_INVREV_IDOC_TYPE(8) TYPE C VALUE 'ZINVRV01',
              Z1INVRV LIKE Z1INVRV,
              C_INVREV_DOCTYPE LIKE BKPF-BLART VALUE 'YY',
              IDOC_CONTROL LIKE EDIDC,
              T_COMM_CONTROL LIKE EDIDC OCCURS 0 WITH HEADER LINE,
              IDOC_DATA LIKE EDIDD OCCURS 0 WITH HEADER LINE.
    *--- Move the document header into a structure
    LOOP AT DOC_HEAD_TAB INTO DOC_HEAD.
    ENDLOOP.
    *--- Move the document item data into a structure
    LOOP AT DOC_ITEM_TAB INTO DOC_ITEM WHERE NOT ( LIFNR IS INITIAL ).
    ENDLOOP.
    *--- Populate the IDoc segment’s field with the required data
    CLEAR Z1INVRV.
    Z1INVRV-LIFNR = DOC_ITEM-LIFNR.          “Store vendor number for filter
    Z1INVRV-XBLNR = DOC_HEAD-XBLNR.          “Billing number
    IDOC_DATA-SEGNAM = C_INVREV_SEGNAME.     “Segment name
    IDOC_DATA-SDATA = Z1INVRV.               “Segment data
    APPEND IDOC_DATA.                    “Populate IDoc internal table
    *--- Move the control data info required for the distribution
    IDOC_CONTROL-MESTYP = C_INVREV_MESTYPE.
    IDOC_CONTROL-DOCTYP = C_INVREV_IDOC_TYPE.
    *--- Call the distribute function with the required parameters
    CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE' IN UPDATE TASK
              EXPORTING
                   MASTER_IDOC_CONTROL          = IDOC_CONTROL
              TABLES
                   COMMUNICATION_IDOC_CONTROL     = T_COMM_CONTROL
                   MASTER_IDOC_DATA               = IDOC_DATA
              EXCEPTIONS
                   ERROR_IN_IDOC_CONTROL               = 1
                   ERROR_WRITING_IDOC_STATUS          = 2
                   ERROR_IN_IDOC_DATA               = 3
                   SENDING_LOGICAL_SYSTEM_UNKNOWN      = 4
                   OTHERS                         = 5.
    Figure 4: Outbound processing example code
    NOTE:
    For debugging purposes, use transaction WE05 (IDoc overview) to see check your IDoc status, or to see whether an IDoc was created/
    3.     INBOUND PROCESSING
    3.1.     Create Function Module
    This function module is called when a message type, of type ZINVRV, comes into the receiving system. This needs to be configured and is dealt with later in this section. The function module is passed the IDoc as a parameter.
    Example parameters
    Import parameters     Reference field     Opt Y/N
    INPUT_METHOD     BDWFAP_PAR-INPUTMETHD     N
    MASS_PROCESSING     BDWFAP_PAR-MASS_PROC     N
    Export Parameters     Reference field     Opt Y/N
    WORKFLOW_RESULT     BDWFAP_PAR-RESULT     N
    APPLICATION_VARIABLE     BDWFAP_PAR-APPL_VAR     N
    IN_UPDATE_TASK     BDWFAP_PAR-UPDATETASK     N
    CALL_TRANSACTION_DONE     BDWFAP_PAR-CALLTRANS     N
    Table Parameters     Reference field     Optional Y/N
    IDOC_CONTRL     EDIDC     
    IDOC_DATA          EDIDD     
    IDOC_STATUS     BDIDOCSTAT     
    RETURN_VARIABLES     BDWFRETVAR     
    SERIALIZATION_INFO     BDI_SER     
    Exceptions
    WRONG_FUNCTION_CALLED
    Example code
    The code displayed below does the following:
    •     populates a BDC table with the IDoc info;
    •     calls the transaction via a BDC call; and
    •     updates the IDoc status according to the BDC error status.
    EXTRACT FROM: Z_IDOC_INPUT_ZINVRV
    *--- Declaration of local variables
    DATA: C_SEGNAM(10) TYPE C VALUE 'Z1INVRV'.
    *-Loop through the IDOCs
    LOOP AT IDOC_CONTRL.
    *---Loop through the data for the IDOC
         LOOP AT IDOC_DATA WHERE DOCNUM = IDOC_CONTRL-DOCNUM.
              CASE IDOC_DATA-SEGNAM.
                   WHEN C_SEGNAM.
    *                    Here we get the info from the idoc table
                        IT_Z1INVRV = IDOC_DATA-SDATA.
              ENDCASE.
              PERFORM REV_INV.
         ENDLOOP.
         PERFORM UPDATE_IDOC_STATUS.
    ENDLOOP.
    FORM REV_INV               "Reverse invoice form
    *--- Local variables & constants
    DATA: C_TCODE LIKE BKPF-TCODE VALUE 'VF11'.  "BDC transaction code
    *--- Now we can build the bdc table to call the reversal transaction start of screen 109
    CLEAR BDC_TAB.
    BDC_TAB-PROGRAM  = 'SAPMV60A'.
    BDC_TAB-DYNPRO   = '109'.
    BDC_TAB-DYNBEGIN = 'X'.
    APPEND BDC_TAB.
    *--- Document number
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = 'KOMFK-VBELN(01)'.
    BDC_TAB-FVAL = IT_Z1INVRV-XBLNR.     "Billing document number
    APPEND BDC_TAB.
    *--- OK Code for screen 109
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = 'BDC_OKCODE'.
    BDC_TAB-FVAL = 'SICH'.
    APPEND BDC_TAB.
    *--- Now we can call transaction 'VF11' with the populated bdc table. The transaction is called inside the idoc-contrl loop, so a transaction will be called for every idoc (journal). the transaction is called in no-display mode ('N') because this code runs in background as it is called by ale.  The update is specified to be synchronous ('S') because we have to wait for the result to update the idoc status correctly.
    CALL TRANSACTION C_TCODE USING BDC_TAB MODE 'N' UPDATE 'S'.
    *--- Store the return code for use in another form (status update)
    RETURN_CODE = SY-SUBRC.
    *--- Here we check the return code, if there was an error, we put the transaction in a bdc session for the user to review and correct.
    IF SY-SUBRC NE 0.
         CALL FUNCTION 'BDC_OPEN_GROUP'
              EXPORTING
                   CLIENT = SY-MANDT
                   GROUP  = 'ZINVRV'
                   USER   = C_ALE_USER
                   KEEP   = 'X'.
         CALL FUNCTION 'BDC_INSERT'
              EXPORTING
                   TCODE     = C_TCODE
              TABLES
                   DYNPROTAB = BDC_TAB.
         CALL FUNCTION 'BDC_CLOSE_GROUP'
              EXCEPTIONS
                   NOT_OPEN    = 1
                   QUEUE_ERROR = 2
                   OTHERS      = 3.
    ELSE.                              "No problems
         C_EXISTS = 'N'.
      Select from the billing document table to get sales doc number
         SELECT * FROM VBRP WHERE VBELN = IT_Z1INVRV-XBLNR.
        Select from the sales document table to get user status number
              SELECT SINGLE * FROM VBAP WHERE VBELN = VBRP-AUBEL AND
                   POSNR = VBRP-AUPOS.
        Select from the status table to change the user status to pending
              SELECT * FROM JEST WHERE OBJNR = VBAP-OBJNR AND
                   STAT LIKE C_USER_STATUS.
                   IF JEST-STAT = C_US_PENDING.   "User status is pending
                        JEST-INACT = C_UNCHECKED.    "Make pending the active status
                        UPDATE JEST.
                        C_EXISTS = 'Y'.            "I.E. An entry is already in table
                   ELSEIF JEST-INACT = C_UNCHECKED AND JEST-STAT NE C_US_PENDING.
                        JEST-INACT = C_CHECKED.      "Make everything else inactive
                        UPDATE JEST.
                   ENDIF.
              ENDSELECT.
              IF C_EXISTS = 'N'.    "I.E. Pending has never been a status before
                   JEST-OBJNR = VBAP-OBJNR.
                   JEST-STAT  = C_US_PENDING.
                   JEST-INACT = C_UNCHECKED.      "Make pending the active status
                   INSERT JEST.
              ENDIF.
         ENDSELECT.       "Select from VBRP (Billing document table)
    ENDIF.
    ENDFORM.                               " REV_INV
    FORM UPDATE_IDOC_STATUS.                                              
    *--- Now we check the CALL TRANSACTION return code and set IDOC status
         CLEAR IDOC_STATUS.                                                  
         IF RETURN_CODE = 0.                                                 
              WORKFLOW_RESULT = '0'.                                            
              IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.                          
              IDOC_STATUS-STATUS = '53'.                                        
              IDOC_STATUS-UNAME = SY-UNAME.                                     
              IDOC_STATUS-REPID = SY-REPID.                                     
              IDOC_STATUS-MSGTY = SY-MSGTY.                                     
              IDOC_STATUS-MSGID = SY-MSGID.                                     
              IDOC_STATUS-MSGNO = SY-MSGNO.                                     
              IDOC_STATUS-MSGV1 = SY-MSGV1.                                     
              IDOC_STATUS-MSGV2 = SY-MSGV2.
              IDOC_STATUS-MSGV3 = SY-MSGV3.                        
              IDOC_STATUS-MSGV4 = SY-MSGV4.                        
              RETURN_VARIABLES-WF_PARAM = 'Processed_IDOCs'.       
              RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.    
              APPEND RETURN_VARIABLES.                             
         ELSE.                                                  
              WORKFLOW_RESULT = '99999'.                           
              IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.             
              IDOC_STATUS-STATUS = '51'.                           
              IDOC_STATUS-UNAME = SY-UNAME.                        
              IDOC_STATUS-REPID = SY-REPID.                        
              IDOC_STATUS-MSGTY = SY-MSGTY.                        
              IDOC_STATUS-MSGID = SY-MSGID.                        
              IDOC_STATUS-MSGNO = SY-MSGNO.                        
              IDOC_STATUS-MSGV1 = SY-MSGV1.
              IDOC_STATUS-MSGV2 = SY-MSGV2.                         
              IDOC_STATUS-MSGV3 = SY-MSGV3.                         
              IDOC_STATUS-MSGV4 = SY-MSGV4.                         
              RETURN_VARIABLES-WF_PARAM = 'ERROR_IDOCS'.            
              RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.     
              APPEND RETURN_VARIABLES.                              
         ENDIF.                                                  
         APPEND IDOC_STATUS.                                     
    ENDFORM.                               " UPDATE_IDOC_STATUS
    Figure 5: Inbound processing example code
    3.1.1.     Debugging inbound FM
    Use transaction WE19 to test inbound function module in debugging mode. Also use WE05 to view the IDocs and their statuses.
    3.2.     Maintain ALE attributes
    The inbound function module needs to be linked to the message type and the message type needs to be linked to the appropriate inbound process code at the partner profile level before the scenario is enabled. These steps are described below in detail.
    3.2.1.     Link Message Type to Function Module (WE57) Client independent
    To link a message (ZINVRV) type to a function module (Z_IDOC_INPUT_ZINVRV) follow these steps:
    •     Enter transaction WE57 (ALE -> Extensions -> Inbound -> Allocate function module to logical message)
    •     Select an entry (EG. IDOC_INPUT_ORDERS) and copy
    •     Type in module name Z_IDOC_INPUT_ZINVRV
    •     Type in basic IDoc type as ZINVRV01
    •     Type in message type as ZINVRV
    •     Type object type as IDOCINVOIC (Invoice document) - Used for workflow
    •     Direction should be set to 2 for inbound
    •     Enter and save
    3.2.2.     Define FM settings (BD51) Client independent
    •     Enter transaction BD51 (ALE -> Extensions -> Inbound -> Define settings for input modules)
    •     Click on New entries
    •     Type in the name of the new function module Z_IDOC_INPUT_ZINVRV
    •     Enter 0 for mass processing in the output column
    •     Save and Exit
    3.2.3.     Maintain process codes (WE42) Client dependent
    A process code needs to be maintained on each client. It then needs to be linked to the message via the partner profiles on each client. This allows the various clients to use a unique function module for the same message type.
    To maintain the process code follow these steps:
    •     Log on to the appropriate receiving system client
    •     Execute WE42 (ALE -> Extensions -> Inbound -> Maintaining process codes inbound)
    •     Choose Inbound with ALE service
    •     Choose Processing with function module
    •     Click on Processing with function module and choose create icon
    •     Click on New Entries
    •     Type in process code ZINR and give it a description and save
    •     Now you are asked to Please maintain codes added in ALE entry methods, enter and choose Z_IDOC_INPUT_FIRVSL and copy it. You should choose a FM similar to your one.
    •     Enter your process code ZINR
    •     Enter your function module Z_IDOC_INPUT_ZINVRV
    NOTE: The next 6 steps are used in workflow error handling.
    •     Enter IDPKFIDCMT in object type
    •     Enter MASSINPUTFINISHED in End event
    •     Enter IDOCINVOIC in IDoc object type
    •     Enter INPUTERROROCCURREDFI in IDoc start event
    •     Enter INPUTFINISHEDFI in IDoc End event
    •     Enter IDOCINVOIC in Application object type
    You will need to determine the task associated with object IDOCINVOIC, and then assign the appropriate position to it. This position will then receive the application error messages via workflow.
    To set up the workflow area please consult the Workflow config guide.
    3.3.     Create inbound partner profile
    For each message type you need to maintain the inbound partner profiles.
    3.3.1.     Maintain receiving system partner profile (WE20) Client dependent
    To maintain inbound partner profiles read the document ALE configuration procedure:
    •     Add the message type ZINVRV with process code ZINR.
    •     Enter the output mode (background, immediately) for inbound processing and NO message code.
    •     Enter the position S and choose the ALE administrator 50000085. This position will then receive all the technical ALE errors via workflow.
    3.4.     Test
    Once the inbound function module has been debugged the scenario should be ready to test in its entirety. If problems occur, read through the relevant areas of this document to check your configuration or code.</b>
      Foe EDI 810 Mapping Refer  <b>http://www.altova.com/videos.asp?type=0&video=edimapping</b>.
    Online demo you can see,
    Thanks
    Manju

  • Urgent - I have written select query between loop and endloop, Ple help out

    Can any one help out me on this select query. I have written select query between loop and endloop. When I execute the program it will take too much time in this query. Please help me out. Its very urgent.
    LOOP AT l_i_invoices ASSIGNING <l_invoices>.
          CLEAR alv_wa.
          alv_wa-bukrs = <l_invoices>-bukrs.
          alv_wa-gsber = <l_invoices>-gsber.
          CLEAR l_instid.
          CONCATENATE <l_invoices>-belnr <l_invoices>-gjahr INTO l_instid.
          SELECT top_wi_id FROM sww_wi2obj INTO TABLE l_i_swwwihead
                  WHERE catid   = c_catid_business_object
                    AND instid  = l_instid
                    AND typeid  = c_typeid_invoice
                    AND removed = space
                    AND ( wi_rh_task = c_task_buyer_message
                       OR wi_rh_task = c_task_buyer_message2 ).
          IF sy-subrc = 0.
            <l_invoices>-flag = 'X'.
          ELSE.
            <l_invoices>-flag = ' '.
          ENDIF.
          MODIFY l_i_invoices FROM <l_invoices> TRANSPORTING flag
                                WHERE belnr = <l_invoices>-belnr
                                   AND gjahr = <l_invoices>-gjahr.
          APPEND alv_wa TO i_alv.
        ENDLOOP.
    Thanks in advance.

    Here is a way to solve this problem.
    Choose somewhere before this loop processing to use that select. Therefore, you'll need use FOR ALL ENTRIES <that_loop_table> clause, and in the WHERE condition you need to specify that same fields.
    This way, you will have an internal table with all data you'll need to check.
    Then, inside your loop statement, use the READ TABLE command with the clause WITH KEY field = value, to read that record and use the value found.
    Like this sample:
      SELECT bukrs lifnr umsks umskz augdt augbl zuonr gjahr belnr buzei
             waers xblnr blart gsber ebeln zfbdt zbd1t zlsch
      INTO TABLE tg_bsak
      FROM bsak
      FOR ALL ENTRIES IN tl_bkpf_sel
      WHERE bukrs EQ tl_bkpf_sel-bukrs AND
            lifnr IN s_lifnr AND
            augbl EQ tl_bkpf_sel-belnr.
    LOOP AT tg_bseg INTO wa_bseg.
        READ TABLE tg_bsak INTO wa_bsak WITH KEY bukrs = wa_bseg-bukrs
                                                 gjahr = wa_bseg-gjahr
                                                 belnr = wa_bseg-belnr
                                                 BINARY SEARCH.
    if sy-subrc = 0.
    * do something
    endif.
    ENDLOOP.

  • Employee numbers and 010 relations

    I want to select all 010 relations and the employees involved. Is following code a good way or are there easier solutions?
      DATA: BEGIN OF temp,
              boss  TYPE sobid,
              delg  TYPE sobid,
              begda TYPE begda,
              endda TYPE endda,
            END OF temp.
      SELECT DISTINCT h2~sobid h1~sobid h1~begda h1~endda
      INTO (temp-boss, temp-delg, temp-begda, temp-endda)
      FROM hrp1001 AS h1 INNER JOIN hrp1001 AS h2
        ON h1~objid = h2~objid
      WHERE h1~rsign EQ 'A'
        AND h1~relat EQ '010'
        AND h2~rsign EQ 'A'
        AND h2~relat EQ '008'.
        delegations-bpernr = temp-boss.
        delegations-dpernr = temp-delg.
        delegations-begda = temp-begda.
        delegations-endda = temp-endda.
        APPEND delegations.
        CLEAR temp.
      ENDSELECT.

    Hi
    The extraction of relationship can be quite simple.
    Please use FM "RH_READ_INFTY_1001". It is a simpler solution than joining.
    Reward Points, if helpful.
    Regards
    Waz

  • I had my iphone 3GS  and then upgraded to 6.1.3. Now the phone is in a loop and reboots everytime the Apple logo comes up. I held teh home power and connected to itunes to retore, but it won't restore. any ideas?

    I had my iphone 3GS  and then upgraded to 6.1.3. Now the phone is in a loop and reboots everytime the Apple logo comes up. I held teh home power and connected to itunes to retore, but it won't restore. any ideas?

    Hey harikrishnandhk,
    Thanks for the question. I understand you are having issue with your iPhone 3GS. You are definitely taking the correct steps, as you'll want to restore the iPhone in recovery mode. For information on doing so, see this article:
    iOS: Unable to update or restore
    http://support.apple.com/kb/HT1808
    If you don't see the "Connect to iTunes" screen, try these steps again. If you see the "Connect to iTunes" screen but the device does not appear in iTunes, see this article and its related links.
    Thanks,
    Matt M.

  • Report Generation tool kit for MS office (Opening an existing excel file and appending to the bottom)

    I don't have any problems creating and filling an excel sheet with data. I use the New Report.vi, Easy Title.vi, and Easy Text.vi to create the file. I then save and dispose properly.
    What I don't seem to be able to do is open the exsting file and append data to the end of the sheet.
    Thanks in advance for your help.
    todd

    Hi Todd,
    You can do this by creating a new Excel report with the existing excel file path wired to the "template" input. Then use "Excel Get Last Row.vi" (located under Report Generation\Excel Specific\Excel General) to obtain the location of the last row. Then use that location to input new data into the file.
    Hope this helps,
    Dan

  • Why cant we use sy-index in loop and endloop?where exactly we used sy-index

    hi
    can u help me for this

    Hi...
    Genereally Sy-index is used in iterative cases like
    while....endwhile
    and
    Do.... Enddo
    In LOOP ..... Endloop.... We should use SY-TABIX....
    It would be more consistent we use sy-tabix as we loop at internal table so this SY-TABIX points to the current record its reading...
    we can use sy-index but rarely depends on condition.....
    SY-INDEX and SY-TABIX will not be same always in LOOP and ENDLOOP
    Rewards points if satisfied..
    Regards
    Narin Nandivada

  • What is diff b/w Include Structure and Append Structure at Database Level

    Hi Experts,
    Could you please let me know what is the main difference between .Include Structure and .Append Structure at SE11?
    Thanks in advance and for good answer will give good points.
    Sekhar

    Hi,
    1. Append Structures
    Append structures can only be assigned to a single table.
    Append structures are created in the custome rnamespace ( ZZ or YY)
    In case of new versions of the standard table during upgrade, the append structures are automatically appended to the new version of the standard table
    Append structures can not be used with cluster and pool tables
    Append structures are created in transaction SE11. Display the standard table fields and press the Append structure button.
    When you press the button, SAP sugests a name for the new append structure. After you has accepted the name,
    a screen will be shown where you can enter the new fields.
    Remember to activate.
    2. Customizing Includes
    Some of the SAP standard tables contains special include statements called Customizing includes. In contrast to Append structures,
    Note that customizing includes are created by SAP, but the customer supply the fields for the include.
    Customizing includes begin with CI_ and is part of the customer namespace
    One Customizing include can be inserted into more than one table.
    You can find Customizing includes in SE11 under structures.
    Try to take a look at table RKPF which uses the Customizing include CI_COBL (In an IDES system). Next try to add a field to CI_COBL, and activate it. If you go back to table RKPF you will se that your new field has been added.
    Regards,
    Ferry Lianto

  • Loops and building a library

    I am a college student in songwriting and music technology. I am working in both Protools and Logic and I find Logic best for writing and Protools best for editing. I want to build even a larger loop library than what is available in Logic Pro 9. I have noticed that I can buy loops a la carte or large packages of loops and save ( Loopmasters.com has a producer package for $694) . I am concerned about format and the ability to manipulate these loops. Midi vs. audio files. Can anyone give me advice for the best way to approach building this massive library of loops?

    If you choose to buy loops formatted for the Apple brand (Apple Loops) these audio files are optimized for the use of Logic Pro. So beat matching , tempo and Key changes will work as expected. If you have purchase the Logic Studio Box version, you will find an Apple Loop creating program in your Utility Folder. With it you can start to make your own Apple Loops from any file. And Logic can read rex files that time stretch well and broadcast wave files that contains data for tempo matching and so on. Also when using non apple loops in your project you can right click on the loop, follow the menu to export and create loops in your Apple Loops Browser as well.

  • Why won't my audio loops and MIDI loops sync together in a project?

    I have a number of guitar riffs in a project that I've been making into loops, as I wish to use these as ideas which I arrange in a new project. I've been saving the edited regions of the riffs by going to Region>Add To Apple Loops Library> and saving it as a loop, which is supposed to conform to tempo as stated. These are a blue icon with a little soundwave icon in it.
    I have been doing the same with drum loops that I have created using the piano roll. These have a green icon with a note inside it.
    I want to use these to create arrangements in a new file. Obviously I need them both to conform to various tempos together.
    Why are my guitar riff loops comforming to my global tempo track, but as soon as I add a drum loop and change the tempo, the drum loop will conform but not the guitar.
    I've also tried exporting each of the guitar riff (regions) as audio files because I read something in the manual about the audio files needing to be saved in as SDII to conform to tempo, but that doesn't work either.
    What's the deal?

    I'm no guru, I'm a neophyte, but I'm interested in the problem anyway.
    "I have a number of guitar riffs in a project that I've been making into loops... I've been saving the edited regions of the riffs by going to Region>Add..."
    I assume all of these regions are audio regions. Do they all have an anchor assigned to whatever you consider the downbeat?
    "I've also tried exporting each of the guitar riff (regions) as audio files..."
    Once imported anew, again, is there an anchor indicated. I think that may be key.
    You say that sometimes they work? What have you changed when they do? The tempo?
    -- Gerry

Maybe you are looking for