Need logic in loop

Hi Experts,
I need a logic in internal table loop.
Ex:
vbeln matnr werks quantity
1234 AAAA 0001  10.000
2345 AAAA 0001  20.000
2345 BBBB 0001  30.000
3456 AAAA 0001  35.000
I need a logic that for every new Material i need to know how many records are there in internal table for that material.
like...
sort itab ascending by matnr.
loop at itab.
at new matnr.
i need no: of records for that matnr ( AAAA) i.e. 3..
endloop.
i am confused where to use this at new...
can anyone provide the best logic in terns of performance?
Giri

One method with MATNR as the first field in the internal table
matnr vbeln werks quantity
AAAA 1234 0001 10.000
AAAA 2345 0001 20.000
BBBB 2345 0001 30.000
AAAA 3456 0001 35.000
one internal table with fields
MATNR COUNT
Sort tb_data by matnr.
loop at tb_data.
  at new matnr.
     clear wf_count.
  endat.
  wf_count = wf_count +1 .
  at end of matnr.
     tb_summary-matnr = tb_data-matnr.
     tb_summary-count  = wf_count.
     append tb_summary.
  endat.
endloop.

Similar Messages

  • I can't see Loops in Acid WAV format on Logic's loop Browser

    Hi everybody,
    I recently bought a bunch of loops in Acid WAV format that claims to be compatible with Apple Loops. I can see them and even I can hear them on my finder but they don't show up in Logic's loops browser which makes them useless...
    They are placed in the correct file, I'm sure of that... I am suspicious of their real compatibility
    Can anyone help me with this problem?
    Thanks
    Fran

    I'm sure it's just a slip of the keyboard, but I presume by "they are placed in the correct file" you mean "folder". Just checking — which folder is that? On which drive?
    There are lots of reasons why 3rd-party Loops might not work at first, including permissions problems, unrecommended locations, still being compressed or archived…
    "Get Info…" (Command-I) on one of the files & see if it's locked & if you have read/write permission.
    Let us know all the above stuff, & we can take it from there.

  • Logic 9 loops have disappeared and cant be located in Apple Loops Index folder

    my logic 9 loops have disappeared and cant be located in the Apple Loops Index folder. Folder is empty??????

    Which version of Logic Pro 9?
    DVD version or something else?

  • Do I need Logic Pro 8.0.1 Update, and if so, how do I get it now?

    Do I need Logic Pro 8.0.1 Update, and if so, how do I get it now?
    Tuesday, 2008-07-29
    Due to prolonged illness, I purchased the Logic Studio Upgrade version (I already had Logic Pro 7.2.3, with dongle) only last week. Logic Studio Upgrade version initially installs Logic Pro version 8.0.0. I then dutifully set out to download both the Logic Pro 8.0.1 Update and the Logic Pro 8.0.2 Update.
    As of this week, all attempts and maneuvers to simply get the Logic Pro 8.0.1 Update have failed. I cannot even find it, let alone download it!
    Yes, I've tried the relabeling juggling act to fool Software Update into eventually listing and providing both the Logic Pro 8.0.1 Update and the Logic Pro 8.0.2 Update—but no luck, not any longer. These moves may have worked up until relatively recently, but they do not work now, at least as of this week.
    All searching of Apple's site(s) and Support pages results in nada—Apple itself no longer lists any such file/dmg/download/update anywhere! All previous links are either dead or just dump one back on to the Logic Pro 8.0.2 Update page.
    (In my many searches, I noted what seemed to me to be a majority of opinion that the Logic Pro 8.0.1 Update was a dog, especially in Mac OS X Leopard 10.5.2 or 10.5.3. Many users reported crashes, panics, and.or freezes. Is this why Apple has pulled the update and rendered it extinct?)
    I Googled, I Asked Why, I Cuiled—but no Logic Pro 8.0.1 Update, except as that which lurked in the murky warez waters. Still, frustrated as I was, I did even try all such I could find . . . but no third party-hosted update worked at all.
    I am concerned because in all my previous experience with Apple and its applications, ample information is made readily available about the contents of any update and an explanation of its relationship to previous updates. By this latter I mean: Apple indicates that update "x" incorporates the previous updates "u" and "v"; therefore one can proceed safely to install update "x" even if one missed updates "u" and "v" or for whatever reason did not install them.
    So . . . do I need Logic Pro 8.0.1 Update, if I am then going to further update with the Logic Pro 8.0.2 Update? Does Logic Pro 8.0.2 Update incorporate the changes made in Logic Pro 8.0.1 Update? Will I be missing (critically?) something(s) in Logic Pro 8.0.1 Update if I in fact do not ever get it or install it? And how would I know? Apple has not only removed the update and all traces of it, but Apple has also removed all information about Logic Pro 8.0.1 Update—it is now literally as if it never existed.
    So what's a po' boy to do? Logic Pro 8.0.1 Update cannot now be found on VersionTracker or MacUpdate or anywhere else. To date, no user group or organization or educational institution or program or audio-related company posted it or archived it.
    Where/how can I get a copy of the Logic Pro 8.0.1 Update?
    If I can't, what do I do?
    If I can't, what do I miss?
    And where is Apple's support for Logic Studio/Logic Pro in all of this?
    Earnestly hoping,
    j.

    Rodger,
    Thank you for your gracious welcome . . .
    and thank you for your swift response . . .
    and thank you for your information (and encouragement!).
    Yes, I read that too, but searched in vain for the specifity of, say, your direction:
    "Go ahead and update to 8.0.2, as it contains the 8.0.1 update."
    So I shall!
    Again, many thanks.

  • Need logic for calculate the balance quantity in open sales order

    hi all
    i need logic to calcuclate the balance quantity in open sales order ,
    where i am using VBAK header and VBAP item , and VBFA for document flow tables
    i need to have the balance quantity , for the open sales order
    especially taking with respect to  VBFA-VBTYP_N = M for invoice creation and N for canellation
    any one please help me

    thank you but i am clear abt it
    will you please anyother way to calucaluate the logic ,
    and i need to populate in bukets also for the terms of 5 years
    Edited by: sridhar loganathan on Nov 25, 2008 6:43 AM

  • Need help for loop at screen

    Hi All,
    This is Rajani. I need help on LOOP AT SCREEN statement.
    I have 3 selection blocks in the selection screen.
    First block contains two radio buttions, the second block contains 6 parameters and the third block contains 3 parameters.
    If the first radiobutton is selected, then the parameters in the third block should be grayed out.
    In the similar way for the second radiobutton.
    Please let me know my mistake from the following code :
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
      PARAMETERS : P_SALES TYPE C RADIOBUTTON GROUP G1 MODIF ID R1,
                   P_OPS   TYPE C RADIOBUTTON GROUP G1 MODIF ID R1,
                   P_MONTH TYPE SPMON OBLIGATORY MODIF ID R1.
    SELECTION-SCREEN END   OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
      PARAMETERS : P_SADIS TYPE BZIRK MODIF ID M1,
                   P_CUGRP TYPE KDGRP MODIF ID M1,
                   P_SADCH TYPE VTWEG MODIF ID M1,
                   P_SADIV TYPE SPART MODIF ID M1,
                   P_CUPAR TYPE HIEZU04 MODIF ID M1,
                   P_MAGRP TYPE MVGR1 MODIF ID M1,
                   P_PRHIE TYPE PRODH1 MODIF ID M1.
      SELECT-OPTIONS:  S_MATNR FOR S889-MATNR.
      PARAMETERS :     P_PLANT TYPE WERKS_EXT.
    SELECTION-SCREEN END   OF BLOCK B2.
    SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-003.
        PARAMETERS :  P_WERKS TYPE WERKS_EXT MODIF ID M2,
                      P_MATGR TYPE PMNUX MODIF ID M2,
                      P_MRPCN TYPE DISPO MODIF ID M2.
    SELECTION-SCREEN END   OF BLOCK B3.
    *INITIALIZATION.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'M1'.
        IF P_OPS = 'X'.
          SCREEN-INPUT = '0'.
        ENDIF.
        MODIFY SCREEN.
      ENDIF.
        IF SCREEN-GROUP1 = 'M2'.
        IF P_SALES = 'X'.
          SCREEN-INPUT = '0'.
        ENDIF.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.

    Hi,
    This is your expected solution.
    TABLES: mara.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : p_sales TYPE c RADIOBUTTON GROUP g1 USER-COMMAND ucom   DEFAULT 'X',  "MODIF ID r1
    p_ops TYPE c RADIOBUTTON GROUP g1 .  "MODIF ID r1
    PARAMETERS: p_month TYPE spmon OBLIGATORY ." MODIF ID r1
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS : p_sadis TYPE bzirk MODIF ID m1,
    p_cugrp TYPE kdgrp MODIF ID m1,
    p_sadch TYPE vtweg MODIF ID m1,
    p_sadiv TYPE spart MODIF ID m1,
    p_cupar TYPE hiezu04 MODIF ID m1,
    p_magrp TYPE mvgr1 MODIF ID m1,
    p_prhie TYPE prodh1 MODIF ID m1.
    SELECT-OPTIONS: s_matnr FOR mara-matnr.
    PARAMETERS : p_plant TYPE werks_ext.
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETERS : p_werks TYPE werks_ext MODIF ID m2,
    p_matgr TYPE pmnux MODIF ID m2,
    p_mrpcn TYPE dispo MODIF ID m2.
    SELECTION-SCREEN END OF BLOCK b3.
    AT SELECTION-SCREEN.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF p_sales = 'X'.
          IF screen-group1 = 'M2'.
            screen-input = '0'.
          ENDIF.
        ENDIF.
        IF p_ops IS NOT INITIAL.
          IF screen-group1 = 'M1'.
            screen-input = '0'.
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    Close this thread if you got soloution.
    Regards,
    Peranandam

  • Restart logic and looping logic in process flow

    Is there any restart logic and looping logic in Oracle Warehouse Builder, process flow?

    Hi,
    The answer is NO. The curent version does not have restartable functionality. You have to have your own design for this.
    ta
    mahesh

  • Need logic for po item

    Hi iam trying to get the po line item latest changedby name to display in my report
    can you give me the logic to get the changed by name for theline item.
    i have written the code but if i change the line item 20 then in the out put the changedby name is being displayed for line itema 10 ,20, 30 i e for all line items .but i want the changeby name to be displayed only for the particular line item which was changed.
    *& Report  ZMR_PO_AUDIT_RPT                                            *
    *&  Purpose - Report on PO release details for auditing.               *
    Program ID  :  ZMR_PO_AUDIT_RPT                                     *
    Title       :  Purchase Release Audit Report                        *
    Create Date :  19.03.2007                                           *
    Author      :  Marina Gosman (JH IT services)                       *
    Tech. Spec  :                                                       *
    Change Req #:                                                       *
    Changed by  |  Description of change                    |  Date     *
    MarinaG     | Change the report Heading to Purchase     |           *
                 | Order Action Audit Report R3DK912376      |23.03.07   *
    MarinaG     | Fix a select bug. R3DK912384              |23.03.07   *
    MarinaG     | Change report heading by removing fields  |27.03.07   *
                 | R3DK912404                                |           *
    MarinaG     | Add exception checkbox which will only    |3.04.07    *
                 | show the same GR, Released and Created    |           *
                 | username R3DK912444.                      |           *
    MarinaG     | Add GR Value and Vendor Name FP#1919      |28.08.07   *
                 | R3DK912809                                |           *
    MarinaG     | Add line item no., display line items for |11.10.07   *
                 | GR period and GR date FP#1919 R3DK912960  |           *
    REPORT ZSAMPLE3 NO STANDARD PAGE HEADING LINE-SIZE 200
    MESSAGE-ID zv.
    Database Tables
    TABLES: ekko,t16fd,cdhdr,cdpos,t000,lfa1,t024,ekbe,mkpf.
    TYPE-POOLS slis.
    Type Declaration
    *TYPE-POOLS: kkblo.
    Structures
    DATA:BEGIN OF st_output,
         ebeln  LIKE ekko-ebeln,
         batxt  LIKE t161t-batxt,
         banfn  LIKE eban-banfn,
         bukrs  LIKE ekko-bukrs,
         frggr  LIKE ekko-frggr,
         frgsx  LIKE ekko-frgsx,
         frgct  LIKE t16fd-frgct,
         udate  LIKE cdhdr-udate,
         utime  like cdhdr-utime,
         username LIKE cdhdr-username,
         lifnr  LIKE ekko-lifnr,        " vendor
         name1  LIKE lfa1-name1,        " vendor name
         ebelp  LIKE ekpo-ebelp,        " line no.
         afnam  LIKE ekpo-afnam,        " requisitioner
         netwr  LIKE ekpo-netwr,
         ekgrp  LIKE ekko-ekgrp,
         eknam  LIKE t024-eknam,
         ernam  LIKE ekko-ernam,
         grnam  LIKE ekbe-ernam,
         bedat  LIKE ekko-bedat,
         budat  LIKE ekbe-budat,
         belnr  LIKE ekbe-belnr,                                "R3DK912960
         dmbtr  LIKE ekbe-dmbtr,                                "R3DK912960
    Indira
         cdate  LIKE cdhdr-username,
    Indira
    END OF st_output.
    Indra
    DATA: l_ponum LIKE ekko-ebeln,
          l_poline LIKE ekpo-ebelp.
    DATA: BEGIN OF t_EKbe OCCURS 0,
          ebeln LIKE EKbe-ebeln,
          belnr LIKE EKbe-Belnr,
          budat LIKE EKbe-Budat,
          cputm LIKE EKbe-cputm,
          END OF T_EKbe.
    DATA: BEGIN OF T_mkpf OCCURS 0,
           mblnr LIKE mkpf-mblnr,
           usnam LIKE mkpf-usnam,
           END OF T_mkpf.
    Internal Tables
    DATA: t_cdhdr LIKE cdhdr OCCURS 0 WITH HEADER LINE,
          t_cdhdr1 LIKE cdhdr OCCURS 0 WITH HEADER LINE,
          po_ekko LIKE ekko OCCURS 0 WITH HEADER LINE.
    Indra
    DATA: t_cdpos LIKE cdpos OCCURS 0 WITH HEADER LINE.
    indra
    DATA: BEGIN OF tbl_output OCCURS 0.
            INCLUDE STRUCTURE st_output.
    DATA: END OF tbl_output.
    DATA: BEGIN OF tbl_ekpo OCCURS 0.
            INCLUDE STRUCTURE ekpo.
    DATA: END OF tbl_ekpo.
    DATA: BEGIN OF tbl_ekbe OCCURS 0.
            INCLUDE STRUCTURE ekbe.
    DATA: END OF tbl_ekbe.
    DATA:  BEGIN OF t_ekko OCCURS 0,
              ebeln TYPE ebeln,
              ebelp TYPE ebelp,                                 "R3DK912960
              belnr TYPE MBLNR,                                 "R3DK912960
              bukrs TYPE bukrs,
              bsart TYPE bsart,
              bedat TYPE bedat,
              budat TYPE budat,
              ernam TYPE ernam,
              grnam TYPE ernam,
              dmbtr TYPE dmbtr,                                 "R3DK912960
           END OF t_ekko.
    DATA: c_tcode(25) TYPE c.
    DATA: st_fieldcat    TYPE slis_fieldcat_alv.
    DATA: tbl_fieldcat   TYPE slis_t_fieldcat_alv.
    DATA: st_event       TYPE slis_alv_event.
    DATA: tbl_events     TYPE slis_t_event.
    DATA: fieldname(30)  TYPE c.
    DATA: st_layout      TYPE slis_layout_alv.
    DATA: g_status       TYPE slis_formname VALUE 'STANDARD01'.
    DATA: g_user_command TYPE slis_formname VALUE 'USER_COMMAND'.
    DATA: st_status      TYPE slis_status.
    DATA: tbl_status     TYPE slis_status OCCURS 0 WITH HEADER LINE.
    DATA: f_ebeln        LIKE ekko-ebeln.
    DATA: cursorfield    LIKE ekko-ebeln.
    DATA: ws_ebeln       LIKE ekko-ebeln,
          ws_netwr       LIKE ekpo-netwr,
          ws_ernam       LIKE ekbe-ernam,
          rs_selfield    TYPE slis_selfield,
          ws_dmbtr       LIKE ekbe-dmbtr.                       "R3DK912809
    RANGES: r_kunnr FOR vbak-kunnr OCCURS 0.
    Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK title WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_bukrs  FOR ekko-bukrs OBLIGATORY,
                    s_ekorg  FOR ekko-ekorg OBLIGATORY,
                    s_ebeln  FOR ekko-ebeln,
                    s_groups FOR ekko-ekgrp,
                    s_lifnr  FOR ekko-lifnr,
                    s_bedat  FOR ekko-bedat,
                    s_budat  FOR ekbe-budat,
                    s_bsart  FOR ekko-bsart.
    SELECTION-SCREEN END OF BLOCK title .
    SELECTION-SCREEN BEGIN OF BLOCK title2 WITH FRAME TITLE text-001.
    PARAMETERS: p_gr AS CHECKBOX DEFAULT 'X',
                p_excep AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK title2 .
    *& AT SELECTION SCREEN
    AT SELECTION-SCREEN.
      IF NOT p_gr IS INITIAL.
        IF s_budat IS INITIAL.
          MESSAGE s000 WITH 'Please enter Goods Receipt Date.'.
          STOP.
        ENDIF.
      ELSE.
        IF s_bedat IS INITIAL.
          MESSAGE s000 WITH 'Please enter Purch Doc Date.'.
          STOP.
        ENDIF.
      ENDIF.
                       START-OF-SELECTION.
    START-OF-SELECTION.
      PERFORM select_data.         " Select data
      PERFORM sort_table.
      PERFORM get_events.          " Include header in display
      PERFORM get_eventstatus.     " Set the GUI status
      PERFORM get_layout.          " Define ALV Layout
      PERFORM get_fieldcat.        " Fill report fields
      PERFORM create_report.       " Write ALV format
    AT LINE-SELECTION.
      PERFORM user_command USING sy-ucomm
                                 rs_selfield.
          FORM user_command                                             *
    -->  R_UCOMM                                                       *
    -->  RS_SELFIELD                                                   *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
      DATA: l_ta TYPE sy-tcode VALUE 'SLIS_DUMMY'.
      CLEAR: f_ebeln.
      CASE r_ucomm.
        WHEN 'CF1'.
          READ TABLE tbl_output INDEX rs_selfield-tabindex.
          IF sy-subrc = 0.
            f_ebeln = tbl_output-ebeln.
          ENDIF.
          SET PARAMETER ID 'BES' FIELD f_ebeln.
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
    Begin of R3DK912404
        WHEN 'EXIT' OR 'CANC'.
          LEAVE PROGRAM.
    End of R3DK912404
        WHEN 'OTHERS'.
      ENDCASE.
    ENDFORM.                    "user_command
          FORM STANDARD_02                                              *
    -->  EXTAB                                                         *
    FORM standard_01 USING  extab TYPE slis_t_extab.
      SET PF-STATUS 'STANDARD01' EXCLUDING extab .
    ENDFORM.                    "standard_01
    *&      Form  get_events
          setup report headings
    -->  p1        text
    <--  p2        text
    FORM get_events.
      CLEAR st_event.
      st_event-name = 'TOP_OF_PAGE'.
      st_event-form = 'PROCESS_TOP_OF_PAGE'.
      APPEND st_event TO tbl_events.
    ENDFORM.                    " get_events
          FORM get_eventstatus                                          *
    FORM get_eventstatus.
      CLEAR st_status.
      st_status-callback_pf_status_set = 'STANDARD_01'.
      APPEND st_status TO tbl_status.
    ENDFORM.                    " get_eventstatus
    *&      Form  get_layout
          text
    -->  p1        text
    <--  p2        text
    FORM get_layout.
      CLEAR st_layout.
      st_layout-zebra = 'X'.
    ENDFORM.                    " get_layout
    *&      Form  get_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM get_fieldcat.
      PERFORM write_fieldcat USING 'EBELN' 'TBL_OUTPUT' 'EKKO' 'X' 1 ' '.
      PERFORM write_fieldcat USING 'BUKRS' 'TBL_OUTPUT' 'EKKO' 'X' 2 ' '.
    Begin of R3DK912960
      PERFORM write_fieldcat USING 'EBELP' 'TBL_OUTPUT' 'EKPO' 'X' 3 ' '.
    End of R3DK912960
      PERFORM write_fieldcat USING 'UDATE' 'TBL_OUTPUT' ' ' ' ' 4
      'Doc. Date'.
      PERFORM write_fieldcat USING 'UTIME' 'TBL_OUTPUT' ' ' ' ' 13
      'Doc. Time'.
    Begin of R3DK912960
      PERFORM write_fieldcat USING 'BUDAT' 'TBL_OUTPUT' ' ' ' ' 5
      'GR Date'.
    End of R3DK912960
      PERFORM write_fieldcat USING 'ERNAM' 'TBL_OUTPUT' ' ' ' ' 6
    'Created By'.
      PERFORM write_fieldcat USING 'USERNAME' 'TBL_OUTPUT' ' ' ' ' 7
    'Released By'.
      PERFORM write_fieldcat USING 'GRNAM' 'TBL_OUTPUT' ' ' ' ' 8
    'Goods Receipted By'.
      PERFORM write_fieldcat USING 'CDATE' 'TBL_OUTPUT' ' ' ' ' 9
      'Changed By'.
      PERFORM write_fieldcat USING 'NETWR' 'TBL_OUTPUT' ' ' ' ' 10
    'Total Value'.
      PERFORM write_fieldcat USING 'EKGRP' 'TBL_OUTPUT' 'EKKO' ' ' 11 ' '.
    Begin of R3DK912809
      PERFORM write_fieldcat USING 'DMBTR' 'TBL_OUTPUT' ' ' ' ' 12
    'GR Value '.
      PERFORM write_fieldcat USING 'NAME1' 'TBL_OUTPUT' ' ' ' ' 13
    'Vendor Name'.
    End of R3DK912809
    ENDFORM.                    " get_fieldcat
          FORM process_top_of_page                                      *
    FORM process_top_of_page.
      SKIP.
      ULINE.
      FORMAT COLOR COL_HEADING INTENSIFIED OFF .
    Begin of R3DK912376
    WRITE:/ 'Report Name     :  PO Release Audit Report',
      WRITE:/ 'Report Name     :  Purchase Order Actions Report',
    End of R3DK912376
           / 'Run Date        : ', sy-datum,
           / 'Run Time        : ', sy-uzeit,
    Begin of R3DK912404
         / 'Document Type   : ', c_tcode,
    End of R3DK912404
           / 'Company code    : ', s_bukrs-low.
      IF NOT s_bukrs-high IS INITIAL.
        WRITE: 'To', s_bukrs-high.
      ENDIF.
      WRITE:/ 'Purch Org       : ', s_ekorg-low.
      IF NOT s_ekorg-high IS INITIAL.
        WRITE: 'To', s_ekorg-high.
      ENDIF.
    Begin of R3DK912404
    WRITE:/ 'Purchase Order  : ', s_ebeln-low.
    IF NOT s_ebeln-high IS INITIAL.
       WRITE: 'To', s_ebeln-high.
    ENDIF.
    WRITE:/ 'Purchasing Grp  : ', s_groups-low.
    IF NOT s_groups-high IS INITIAL.
       WRITE: 'To', s_groups-high.
    ENDIF.
    WRITE:/ 'Vendor          : ', s_lifnr-low.
    IF NOT s_lifnr-high IS INITIAL.
       WRITE: 'To', s_lifnr-high.
    ENDIF.
      WRITE:/ 'Goods Receipt Date:', s_budat-low.
      IF NOT s_budat-high IS INITIAL.
        WRITE: 'To', s_budat-high.
      ENDIF.
    End of R3DK912404
      WRITE:/ 'Purch Doc Date  : ', s_bedat-low.
      IF NOT s_bedat-high IS INITIAL.
        WRITE: 'To', s_bedat-high.
      ENDIF.
    Begin of R3DK912404
    WRITE:/ 'Purch Doc Type  : ', s_bsart-low.
    IF NOT s_bsart-high IS INITIAL.
       WRITE: 'To', s_bsart-high.
    ENDIF.
    End of R3DK912404
      ULINE.
      FORMAT COLOR COL_HEADING INTENSIFIED OFF.
    ENDFORM.                    " process_top_of_page
    *&      Form  create_report
          text
    -->  p1        text
    <--  p2        text
    FORM create_report.
      SORT tbl_output BY ebeln ebelp.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          it_events                = tbl_events
          i_interface_check        = ' '
          i_callback_program       = 'ZSAMPLE3'
          i_callback_pf_status_set = g_status
          i_callback_user_command  = g_user_command
          is_layout                = st_layout
          it_fieldcat              = tbl_fieldcat
          i_default                = 'X'
          i_save                   = 'X'
        TABLES
          t_outtab                 = tbl_output
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " create_report
    *&      Form  select_data
          select records for specified selections
    -->  p1        text
    <--  p2        text
    FORM select_data.
      CLEAR: c_tcode, t_cdhdr, t_ekko, tbl_output.
      REFRESH: t_cdhdr, t_ekko, tbl_output, tbl_fieldcat.
      IF NOT p_gr IS INITIAL.
        SELECT DISTINCT a~ebeln "R3DK912960
        SELECT a~ebeln                                          "R3DK912960
               b~ebelp                                          "R3DK912960
               b~belnr
               a~bukrs
               a~bsart
               a~bedat
               b~budat
               a~ernam
               b~ernam
    INTO TABLE t_ekko
    FROM ekko AS a
    INNER JOIN ekbe AS b
    ON aebeln = bebeln
    Begin of R3DK912384
    AND b~bewtp = 'E'
    AND b~bwart = '101'
    End of R3DK912384
    WHERE a~bukrs IN s_bukrs AND
        a~ebeln IN s_ebeln AND
        a~ekgrp IN s_groups AND
        a~lifnr IN s_lifnr AND
        a~bsart IN s_bsart AND
        a~ekorg IN s_ekorg and
        a~bedat IN s_bedat AND
        b~budat IN s_budat AND
        a~frgke = 'R'
        ORDER BY aebeln bbudat DESCENDING.
    Begin of  R3DK912809 R3DK912960
        DELETE ADJACENT DUPLICATES FROM T_EKKO COMPARING EBELN.
    End of  R3DK912809 R3DK912960
      ELSE.
      SELECT DISTINCT a~ebeln       "R3DK912960
        SELECT a~ebeln                                          "R3DK912960
               b~ebelp                                          "R3DK912960
               b~belnr
               a~bukrs
               a~bsart
               a~bedat
               b~budat
               a~ernam
               b~ernam
            INTO TABLE t_ekko
            FROM ekko AS a
            LEFT JOIN ekbe AS b
            ON aebeln = bebeln
    Begin of R3DK912384
            AND b~bewtp = 'E'
            AND b~bwart = '101'
    End of R3DK912384
            WHERE a~bukrs IN s_bukrs AND
                  a~ebeln IN s_ebeln AND
                  a~ekgrp IN s_groups AND
                  a~lifnr IN s_lifnr AND
                  a~bsart IN s_bsart AND
                  a~ekorg IN s_ekorg AND
                  a~bedat IN s_bedat AND
                  a~frgke = 'R'
                  ORDER BY aebeln bbudat DESCENDING.
    Begin of  R3DK912809 R3DK912960
        DELETE ADJACENT DUPLICATES FROM T_EKKO COMPARING EBELN.
    End of  R3DK912809 R3DK912960
      ENDIF.
      sort t_ekko by ebeln ebelp budat descending.
    sivanew
      delete adjacent  duplicates from t_ekko comparing ebeln ebelp .
    sivanew
    IF sy-subrc EQ 0.            "R3DK912809
      IF NOT t_ekko[] IS INITIAL.                               "R3DK912809
        PERFORM process_data.
    Begin of R3DK912444
        IF NOT p_excep IS INITIAL.
          PERFORM get_exceptions.
        ENDIF.
    End of R3DK912444
      ENDIF.
    ENDFORM.                    " select_data
    *&      Form  write_fieldcat
          text
         -->P_0190   field name, if the SAP name used desc will be
                     automatically get from SAP table
         -->P_0191   Internale structure or table name
         -->P_0192   SAP table for field description
         -->P_0193   format
         -->P_1      Position
         -->P_0195   Custom Description
    FORM write_fieldcat USING name tab st key pos desc.
      st_fieldcat-fieldname = name.
      st_fieldcat-tabname = tab.
      st_fieldcat-ref_tabname = st.
      st_fieldcat-key = key.
      st_fieldcat-col_pos = pos.
      st_fieldcat-seltext_m = desc.
      IF pos = 12.
        st_fieldcat-outputlen = 40.
      ENDIF.
      APPEND st_fieldcat TO tbl_fieldcat.
      CLEAR st_fieldcat.
    ENDFORM.                    " write_fieldcat
    *&      Form  process_record
          text
    -->  p1        text
    <--  p2        text
    FORM process_record.
      DATA:l_ebeln LIKE ekko-ebeln.
      LOOP AT t_cdhdr.
        CLEAR: l_ebeln, ws_ebeln, ws_netwr, ws_ernam.
        MOVE t_cdhdr-objectid TO l_ebeln.
        CALL FUNCTION 'ME_EKKO_SINGLE_READ'
          EXPORTING
            pi_ebeln = l_ebeln
          IMPORTING
            po_ekko  = po_ekko.
    Begin of R3DK912809 R3DK912960
       SELECT SUM( dmbtr ) INTO ws_dmbtr
         FROM ekbe WHERE ebeln = l_ebeln
                     AND vgabe = '1'
                     AND bewtp = 'E'
                     GROUP BY ebeln.
       ENDSELECT.
    End of R3DK912809
        SELECT SINGLE dmbtr INTO t_ekko-dmbtr
           FROM ekbe WHERE ebeln = t_ekko-ebeln
                       AND ebelp = t_ekko-ebelp
                       AND belnr = t_ekko-belnr
                       AND vgabe = '1'
                       AND bewtp = 'E'.
        MODIFY T_EKKO.
    End of R3DK912960
        SELECT SINGLE ernam INTO t_ekko-grnam
             FROM ekbe WHERE ebeln = t_ekko-ebeln
                         AND ebelp = t_ekko-ebelp
                         AND ELIKZ = 'X'.
        MODIFY T_EKKO.
        SELECT ebeln SUM( netwr ) INTO (ws_ebeln, ws_netwr)
         FROM ekpo WHERE ebeln = l_ebeln       R3DK912960
           FROM ekpo WHERE ebeln = t_ekko-ebeln                 "R3DK912960
           GROUP by ebeln.
        ENDSELECT.
        IF sy-subrc EQ 0.
          IF s_groups IS INITIAL.
            PERFORM build_output.
          ELSE.
            IF po_ekko-ekgrp IN s_groups.
              PERFORM build_output.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " process_record
    *&      Form  get_customer
          Get Customers if sales office specified
    -->  p1        text
    <--  p2        text
    *&      Form  build_output
          text
    -->  p1        text
    <--  p2        text
    FORM build_output.
      DATA: l_line   LIKE ekpo-ebelp.
      DATA: l_requisitioner LIKE ekpo-afnam.
      IF po_ekko-frgke = 'R'.
        CLEAR: tbl_output.
        tbl_output-udate = t_cdhdr-udate.
        tbl_output-utime = t_cdhdr-utime.
        tbl_output-username = t_cdhdr-username.
        tbl_output-ebeln = po_ekko-ebeln.
        tbl_output-bukrs = po_ekko-bukrs.
        tbl_output-lifnr = po_ekko-lifnr.
        tbl_output-name1 = ' '.
        tbl_output-lifnr = po_ekko-lifnr.
        tbl_output-ekgrp = po_ekko-ekgrp.
       tbl_output-ernam = po_ekko-ernam.
        tbl_output-ernam = t_ekko-ernam.
        tbl_output-budat = t_ekko-budat.
       tbl_output-grnam = t_ekko-grnam.
        tbl_output-bedat = t_ekko-bedat.
        tbl_output-dmbtr = t_ekko-dmbtr.                        "R3DK912809
        tbl_output-ebelp = t_ekko-ebelp.
        SORT T_CDHDR1.
       sivanew
       read table t_cdhdr1 with key
                      objectid = t_cdhdr-objectid binary search.
       if sy-subrc = 0.
         tbl_output-cdate = t_cdhdr1-username.
       endif.
        read table t_cdhdr1 with key
                       tcode = 'ME22N' binary search.
        if sy-subrc = 0.
          SELECT * FROM cdpos INTO TABLE t_cdpos
                 WHERE objectid = t_cdhdr1-objectid AND
                       objectclas = 'EINKBELEG' AND
                 changenr = t_cdhdr1-changenr.
          IF sy-subrc = 0.
            l_ponum = t_cdpos-tabkey+3(10).
            l_poline = t_cdpos-tabkey+13(6).
          ENDIF.
        ENDIF.
        IF tbl_output-ebeln = l_ponum AND tbl_output-ebelp = l_poline.
          READ TABLE t_cdhdr1 WITH KEY changenr = t_cdpos-changenr
                                      tcode = 'ME22N' BINARY SEARCH.
          IF sy-subrc = 0.
            tbl_output-cdate = t_cdhdr1-username.
          ENDIF.
        ENDIF.
    ENDIF.
      select ebeln belnr budat cputm   from ekbe into table t_ekbe
                        where vgabe = '1' and
                              ebeln = t_cdhdr-objectid.
      sort t_ekbe by   budat descending cputm descending.
      delete adjacent duplicates from t_ekbe comparing ebeln.
      loop at t_ekbe.
        select mblnr usnam from mkpf into table t_mkpf
                                 where mblnr = t_ekbe-belnr.
        if sy-subrc = 0.
          read table t_mkpf with key
                           mblnr = t_ekbe-belnr binary search.
          move t_mkpf-usnam to   tbl_output-grnam.
        endif.
      endloop.
        Indra
    Get the user changed the record
       IF t_cdhdr-tcode = 'ME22N'.
         SELECT * FROM cdpos INTO TABLE t_cdpos
                WHERE objectid = t_cdhdr-objectid AND
                      objectclas = 'EINKBELEG' AND
                changenr = t_cdhdr-changenr.
         IF sy-subrc = 0.
           l_ponum = t_cdpos-tabkey+3(10).
           l_poline = t_cdpos-tabkey+13(6).
         ENDIF.
       ENDIF.
    indra
    Display creator or changer
       IF tbl_output-ebeln = l_ponum AND tbl_output-ebelp = l_poline.
         READ TABLE t_cdhdr WITH KEY changenr = t_cdpos-changenr
                                     tcode = 'ME22N' BINARY SEARCH.
         IF sy-subrc = 0.
           tbl_output-cdate = t_cdhdr-username.
         ENDIF.
       ENDIF.
    Indra
      SELECT SINGLE * FROM t024
             WHERE ekgrp = po_ekko-ekgrp.
      IF sy-subrc EQ 0.
        tbl_output-eknam = t024-eknam.
      ENDIF.
      tbl_output-netwr = ws_netwr.
      SELECT SINGLE name1 FROM lfa1
        INTO tbl_output-name1
        WHERE lifnr = po_ekko-lifnr.
    Get Document descriptions
      SELECT SINGLE batxt FROM t161t
             INTO tbl_output-batxt
             WHERE spras = 'E' AND
                   bsart = po_ekko-bsart AND
                   bstyp = po_ekko-bstyp.
    Get Release code descriptions
      SELECT SINGLE frgct FROM t16fd
                   INTO tbl_output-frgct
                   WHERE spras = 'E' AND
                         frggr = po_ekko-frggr AND
                         frgco = po_ekko-frgsx.
      APPEND tbl_output.
    ENDIF.
    ENDFORM.                    " build_output
    *&      Form  SORT_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM sort_table.
    SORT tbl_output BY ebeln ebelp ascending  udate  utime DESCENDING.
    SORT tbl_output BY ebeln  ascending  udate  utime DESCENDING.
    delete adjacent  duplicates from tbl_output comparing ebeln ebelp .
    ENDFORM.                    " SORT_TABLE
    *&      Form  PROCESS_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM process_data.
      LOOP AT t_ekko.
        c_tcode = 'Purchase Orders'.
       SELECT * FROM cdhdr UP TO 1 ROWS INTO TABLE t_cdhdr "R3DK912960
        SELECT * FROM cdhdr   into table t_cdhdr
                WHERE objectclas = 'EINKBELEG' AND
                     objectid = t_ekko-ebeln AND
                        tcode = 'ME28'.
        SORT T_CDHDR BY UDATE DESCENDING  UTIME DESCENDING.
        delete adjacent duplicates from t_cdhdr  comparing objectid.
         siva
           SELECT * FROM cdhdr UP TO 1 ROWS INTO TABLE t_cdhdr1
    *"R3DK912960
        SELECT * FROM cdhdr  INTO TABLE t_cdhdr1
                WHERE objectclas = 'EINKBELEG' AND
                     objectid = t_ekko-ebeln AND
                        tcode = 'ME22N'.
        SORT T_CDHDR1 BY UDATE descending UTIME DESCENDING.
        delete adjacent duplicates from t_cdhdr1 comparing objectid.
       sivanew
       if c_tcode = 'ME22N'.
         SELECT * FROM cdpos INTO TABLE t_cdpos
                      WHERE objectid = t_cdhdr1-objectid AND
                            objectclas = 'EINKBELEG' AND
                      changenr = t_cdhdr1-changenr.
         IF sy-subrc = 0.
           l_ponum = t_cdpos-tabkey+3(10).
           l_poline = t_cdpos-tabkey+13(6).
         ENDIF.
       ENDIF.
    *sivanew
       IF sy-subrc = 0.
         delete adjacent  duplicates from t_cdhdr comparing objectid.
        PERFORM process_record.   " process each document
       ENDIF.
      ENDLOOP.
    ENDFORM.                    " PROCESS_DATA
    *&      Form  get_exceptions
          text
    -->  p1        text
    <--  p2        text
    form get_exceptions.
    Display a report which shows the same released, goods receipted and
    created by user
      LOOP AT tbl_output.
        IF tbl_output-username <> tbl_output-ernam OR
           tbl_output-ernam <> tbl_output-grnam.
          DELETE tbl_output.
        ENDIF.
      ENDLOOP.
    endform.                    " get_exceptions

    Hi,
    first of all you should read the following thread ABAP Development It is really hard to read code without proper formatting.
    It looks like you use change documents to get user name for last change. For each document you use last change document and hence you have same name for every item. I am not sure if it is possible (it should be) but for each item you need to look for last change document corresponding to this item. 
    Cheers

  • Need logic in Internal table processing

    Hi all,
    I have requirement like this.
    i cretaed  three internal tables
    1) first Internal table can store total uploaded data from flat file..means line by line( Here each line is one record)
    2) Second internal can store all fields which are fetched based on table which is given on selction screen.
    3)now i cretaed one internal table with one variable
    4) i used spilt statement on first internal table ( which store all flat file recrds) into third internal table.
    so , my third internal table has first records values of first internal table in one column.
    Now my probelm...i need to populate bapi structre tables with values of third internal table based on field names of second internal table. i am not able to do logic.
    Is there any pointers to know soultion
    Note:we know which fields values from flat values  needs to populate Bapi structure table..
    Thanks in advance,
    regards,
    JBR

    check this program may be u will get the logic
    *& Report  ZBAPI_MATERIAL_SAVEDATA
    *& PURPOSE : THIS REPORT USES BAPI MATERIAL SAVE DATA TO UPDATE AND CREATE
    *&           THE MATERIAL
    REPORT  ZBAPI_MATERIAL_SAVEDATA NO STANDARD PAGE HEADING MESSAGE-ID (ZHNC).
    TYPES:BEGIN OF TY_MAT,
           MATERIAL(4),
           IND_SECTOR(1),
           MATL_TYPE(4),
           MATL_GROUP(9),
           BASE_UOM(3),
           BASE_UOM_ISO(3),
           PLANT(4),
           DEL_FLAG(1),
           PUR_GROUP(3),
           BASE_QTY(13),
           STGE_LOC(4),
           MRP_IND(1),
           SALES_ORG(4),
           DISTR_CHAN(2),
           DEL_FLAG1(1),
           MIN_ORDER(13),
           LANGU(2),
          MATL_DESC(40),
       END OF TY_MAT.
    DATA: IT_DATA TYPE TABLE OF TY_MAT,
          WA_DATA LIKE LINE  OF IT_DATA.
    *decalraing flag
    data: v_flag value ''.
    *DECLARING WORK AREAs  TO BE PASSED TO THE FUNCTION MODULE.
    DATA: BAPI_HEAD LIKE BAPIMATHEAD,
          BAPI_CLIENTDATA LIKE BAPI_MARA,
          BAPI_CLIENTDATAX LIKE BAPI_MARAX,
          BAPI_PLANTDATA LIKE BAPI_MARC,
          BAPI_PLANTDATAX LIKE  BAPI_MARCX,
          BAPI_STORAGELOCATIONDATA LIKE BAPI_MARD,
          BAPI_STORAGELOCATIONDATAX LIKE BAPI_MARDX,
          BAPI_SALESDATA LIKE BAPI_MVKE,
          BAPI_SALESDATAX LIKE BAPI_MVKEX,
          BAPI_MAKT LIKE BAPI_MAKT,
          BAPI_RETURN LIKE BAPIRET2.
    *INTERNAL TABLE TO HOLD THE MATERIAL DESCRIPTION
    DATA: BEGIN OF IT_MAKT OCCURS 0.
    INCLUDE STRUCTURE BAPI_MAKT.
    DATA END OF IT_MAKT.
    DATA:BEGIN OF IT_RET OCCURS 0.
    INCLUDE STRUCTURE BAPIRET2.
    DATA END OF IT_RET.
    *INTERNAL TABLE TO HOLD HEADER DATA
    DATA: IT_EXCEL TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
    *SELECTION-SCREEN ELEMENTS
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETER: FNAME TYPE RLGRAP-FILENAME OBLIGATORY DEFAULT 'C:\Documents and Settings\Administrator\Desktop\MATMAS.XLS' .
    PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY,
                P_BEGROW TYPE I DEFAULT 1 NO-DISPLAY,
                P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY,
                P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY.
    SELECTION-SCREEN END OF BLOCK B1.
    *DECLARATION OF EXCELAL TABLE
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR FNAME.
    PERFORM F_GET_FILE USING FNAME.
    START-OF-SELECTION.
    PERFORM F_XLS_ITAB USING FNAME
                       CHANGING IT_EXCEL.
    PERFORM F_MOVE_DATA.
    perform F_GET_DATA.
    *&      Form  F_GET_FILE
          text
         -->P_FNAME  text
         <--P_SY_SUBRC  text
    FORM F_GET_FILE  USING    P_FNAME LIKE FNAME.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
       PROGRAM_NAME        = SYST-REPID
       DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
      STATIC              = ' '
      MASK                = ' '
      CHANGING
        FILE_NAME           = P_FNAME
    EXCEPTIONS
      MASK_TOO_LONG       = 1
      OTHERS              = 2
    IF SY-SUBRC <> 0.
    MESSAGE E006(ZHNC).
    ENDIF.
    ENDFORM.                    " F_GET_FILE
    *&      Form  F_XLS_ITAB
          text
         -->P_FNAME  text
         <--P_IT_EXCEL  text
    FORM F_XLS_ITAB  USING    P_FNAME
                     CHANGING P_IT_EXCEL.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        FILENAME                      = FNAME
        I_BEGIN_COL                   = P_BEGCOL
        I_BEGIN_ROW                   = P_BEGROW
        I_END_COL                     = P_ENDCOL
        I_END_ROW                     = P_ENDROW
      TABLES
        INTERN                        = IT_EXCEL
    EXCEPTIONS
       INCONSISTENT_PARAMETERS       = 1
       UPLOAD_OLE                    = 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.
    ENDFORM.                    " F_XLS_ITAB
    *&      Form  F_MOVE_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM F_MOVE_DATA .
    DATA : LV_INDEX TYPE I.
    FIELD-SYMBOLS <FS>.
    *--- Sorting the internal table
    SORT IT_EXCEL BY ROW COL.
    CLEAR IT_EXCEL.
    LOOP AT IT_EXCEL.
    MOVE IT_EXCEL-COL TO LV_INDEX.
    *--- Assigning the each record to an internal table row
    ASSIGN COMPONENT LV_INDEX OF STRUCTURE WA_DATA TO <FS>.
    *--- Asigning the field value to a field symbol
    MOVE IT_EXCEL-VALUE TO <FS>.
    AT END OF ROW.
    APPEND WA_DATA TO IT_DATA.
    CLEAR WA_DATA.
    ENDAT.
    ENDLOOP.
    ENDFORM.                    " F_MOVE_DATA
    *&      Form  F_GET_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM F_GET_DATA .
    LOOP AT IT_DATA INTO WA_DATA.
    MOVE-CORRESPONDING WA_DATA  TO  BAPI_HEAD.
    BAPI_HEAD-BASIC_VIEW ='X'.
    BAPI_HEAD-SALES_VIEW ='X'.
    BAPI_HEAD-PURCHASE_VIEW ='X'.
    BAPI_HEAD-STORAGE_VIEW ='X'.
    MOVE-CORRESPONDING WA_DATA TO BAPI_CLIENTDATA.
    BAPI_CLIENTDATAX-MATL_GROUP = 'X'.
    BAPI_CLIENTDATAX-BASE_UOM = 'X'.
    BAPI_CLIENTDATAX-BASE_UOM_ISO = 'X'.
    MOVE-CORRESPONDING WA_DATA TO BAPI_PLANTDATA.
    BAPI_PLANTDATAX-PLANT = BAPI_PLANTDATA-PLANT.
    BAPI_PLANTDATAX-DEL_FLAG = 'X'.
    BAPI_PLANTDATAX-PUR_GROUP = 'X'.
    BAPI_PLANTDATAX-BASE_QTY = 'X'.
    MOVE-CORRESPONDING WA_DATA TO BAPI_STORAGELOCATIONDATA.
    BAPI_STORAGELOCATIONDATA-PLANT = BAPI_PLANTDATA-PLANT.
    BAPI_STORAGELOCATIONDATAX-PLANT = BAPI_STORAGELOCATIONDATA-PLANT.
    BAPI_STORAGELOCATIONDATAX-STGE_LOC = BAPI_STORAGELOCATIONDATA-STGE_LOC.
    BAPI_STORAGELOCATIONDATAX-MRP_IND = 'X'.
    MOVE-CORRESPONDING WA_DATA TO BAPI_SALESDATA.
    BAPI_SALESDATAX-SALES_ORG = BAPI_SALESDATA-SALES_ORG.
    BAPI_SALESDATAX-DISTR_CHAN = BAPI_SALESDATA-DISTR_CHAN.
    BAPI_SALESDATAX-DEL_FLAG = BAPI_SALESDATA-DEL_FLAG.
    BAPI_SALESDATAX-MIN_ORDER = 'X'.
    REFRESH IT_MAKT.
    IT_MAKT-LANGU = WA_DATA-LANGU.
    IT_MAKT-MATL_DESC = WA_DATA-MATL_DESC.
    APPEND IT_MAKT.
    CLEAR IT_RET.
    REFRESH IT_RET.
    PERFORM F_CALL_BAPI.
    READ TABLE IT_RET WITH KEY TYPE = 'S'.
    IF SY-SUBRC EQ 0.
    PERFORM F_BAPI_COMMIT.
    WRITE:/ 'MATERIAL CREATED OR UPDATED SUCESSFULLY WITH MATERIAL NO',WA_DATA-MATERIAL.
    ELSE.
    MESSAGE E000(ZHNC) WITH 'ERROR IN CREATING THE MATERIAL'.
    *WRITE: / 'ERROR IN CREATIN MATERIAL',IT_RET-MESSAGE.
    *PERFORM F_DOWNLOAD.
    ENDIF.
    *ENDIF.
    ENDLOOP.
    ENDFORM.                    " F_GET_DATA
    *&      Form  F_CALL_BAPI
          text
    -->  p1        text
    <--  p2        text
    FORM F_CALL_BAPI .
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
      EXPORTING
        HEADDATA                   = BAPI_HEAD
       CLIENTDATA                 =  BAPI_CLIENTDATA
       CLIENTDATAX                =  BAPI_CLIENTDATAX
       PLANTDATA                  =  BAPI_PLANTDATA
       PLANTDATAX                 =  BAPI_PLANTDATAX
       STORAGELOCATIONDATA        =  BAPI_STORAGELOCATIONDATA
       STORAGELOCATIONDATAX       =  BAPI_STORAGELOCATIONDATAX
       SALESDATA                  =  BAPI_SALESDATA
       SALESDATAX                 =  BAPI_SALESDATAX
    IMPORTING
       RETURN                     =  IT_RET
    TABLES
       MATERIALDESCRIPTION        = IT_MAKT
      UNITSOFMEASURE             =
      UNITSOFMEASUREX            =
      INTERNATIONALARTNOS        =
      MATERIALLONGTEXT           =
      TAXCLASSIFICATIONS         =
      RETURNMESSAGES             =
      PRTDATA                    =
      PRTDATAX                   =
      EXTENSIONIN                =
      EXTENSIONINX               =
    APPEND IT_RET.
    ENDFORM.                    " F_CALL_BAPI
    *&      Form  F_BAPI_COMMIT
          text
    -->  p1        text
    <--  p2        text
    FORM F_BAPI_COMMIT .
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      WAIT         =
    IMPORTING
      RETURN        =
    ENDFORM.                    " F_BAPI_COMMIT

  • Need logic to retrieve common fields in two internal tables

    Hi,
    I need to get the common data from the internnal table IT_BSEG and IT_ZFI_CSHLW_DIRE tables please help me out in sorting out this porblem.
    the fields in IT_BSEG are Account number,Profit center,company code,document type etc.
    where as the fields in IT_CSHFLW_DIRE are Account number from,Account number to,company code from,company code to and profit center.
    so how to check whether a record which is in It_BSEG,exists in IT_CSHFLW_DIRE..?
    Thanks,
    Kumar

    Solution 1.
    LOOP AT ITAB1.
    LOOP AT ITAB2
    WHERE ( ACCOUNT_FROM LE ITAB1-ACCOUNT AND
                   ACCOUNT_TO GE ITAB1-ACCOUNT )
          AND (COMPANY_FROM LE ITAB1-COMPANY AND
                   COMPANY_TO      GE ITAB1-COMPANY
           AND (PROFIT_CENTER  EQ LE ITAB1-PROFIT_CENTER ).
    <Your logic>.
    ENDLOOP.
    ENDLOOP.
    soultions 2.
    RANGES: COMPANY_CODE FOR <Your data dictionary reference>
                    ACCOUNT             FOR <Your data dictionary reference>.
    LOOP AT ITAB2.
    REFRESH: COMPANY_CODE, ACCOUNT.
    CLEAR: COMPANY_CODE, ACCOUNT.
    MOVE: I TO COMPANY_CODE-SIGN,
                I TO ACCOUNT-SIGN.
    MOVE: BT TO COMPANY_CODE-OPTION,
                BT TO ACCOUNT-OPTION.
    MOVE:  ITAB2-COMPANY_FROM   TO COMPANY_CODE-LOW,
                 ITAB2-ACCOUNT_FROM    TO ACCOUNT-LOW.
    MOVE:  ITAB2-COMPANY_TO   TO COMPANY_CODE-HIGH.
                 ITAB2-ACCOUNT_TO    TO ACCOUNT-HIGH.
    APPEND: COMPANY_CODE, ACCOUNT.
    LOOP AT ITAB1 WHERE  ACCOUNT  IN  ACCOUNT         "<----range
                                  AND company      IN company_code    "<----range
                                  AND profit_center eq ITAB2-PROFIT_CENTER.
    *<You code>
    ENDLOOP.
    ENDLOOP.
    Please note both approach have different <b>bussines logic</b>.
    It depends on your bussiness logic which table data you are looking in which table.
    Regards,
    A.Singh

  • Need logic to develop input paramaeter (dynamic selection)

    Hi All,
    A Function Module needs to be developed with the following are the input parameters
    A     Plant(Optional)
    B     Application(Optional)
    C     Material(Optional)
    D       Date and Timestamp(Mandatory only if none of the above are provided)
       If there is no value in the  'D'parameter, then it will apply the logic mentioned below in the function module.
         The function module should do following checks
         (a) If  A is provided then B and C should not be null.
         (b) If C is provided then B should not be null.
                        Or
         (c ) The user should provide data and timestamp in YYYYMMDDHHMMSS format. 
              This date range should not be more than 14 days.
    My questions is,
    (1)How to bring parameter 'D' manitory if paramaeter A,B and C is not provided.
    (2)how to make a check if A is provided , B and C should not be null
    (3) how to make a check if B is provided B should not be null.
    (4)How to check the user has entered the date not more than 14 days.
    can any one help me out in this logics ...
    Regards,
    Sri

    HI,
    IF  A ,B and C is initial.
    give message as d is madatory.
    endif.
    if A is not initial.
    check B and C is not intial.
    do the things.
    endif.
    if  B is not intial.
    check C is not initial.
    endif.
    4th one i am not clear wat ur syaing.
    if the user enterd date is todays date.
    get todays date into local variable.
    check the 14 days.

  • Logic Pro loops disappear when I re-index?

    I'm trying to delete some of the loops in logic to save some space on my SSD as I know I will never touch some of then.
    However I located them in finder and moved them to the trash, but when I try and re-index my loops library, I enter my password and the Logic Index goes blank, as if to say their are no loops, until I restart Logic Pro 9 then they all re-appear (Inclkuding the ones I have deleted using finder)
    Why can I not re-index my loops without losing them all?

    Hi iamtherealmungo,
    I'm not sure if you have tried these specific steps but here is an article with instructions on rebuilding the index that I thought might be helpful:
    Logic Pro and Express: Rebuilding the Loop Index
    http://support.apple.com/kb/ht3443
    Cheers,
    - Ari

  • Need Logic in sql

    Declare @table table (EMPIID int, NAME VARCHAR(10),Updatedate datetime)
    INSERT into @table values(111,'Muthu','02/13/2014')
    INSERT into @table values(222,'Mari','02/14/2014')
    INSERT into @table values(222,'Raja','02/13/2014')
    INSERT into @table values(222,'Muthu','02/14/2014')
    INSERT into @table values(333,null,null)
    INSERT into @table values(444,'Rahul','02/02/2014')
    Select * from @table
    I need a output from above table with below logic.
    1.For the Emp name that are tied to more than one empid then don’t use these empname for any empids, need to display with some other dumppy name with emp id.
    here name muthu belongs to empid 222 so that i need an output for this situation
    111 marimuthu '02/13/2014' -- no need to display name muthu belongs to 222.
    2) For rest of the names pick the one to the empid if only one name found; otherwise pick the Names with greatest updateDate.
    So my final output for above table records should be comes like this
    Empid
    Name
    updateDate
    1111
    marimuthu
    null
    2222
    muthu
    02/14/2014
    3333
    Muhtu00003333(dumppy)
    null            
    4444
    Rahul
    02/02/2014

    Should it be  111,'Muthu','02/13/2014'  rather than ?
    1111
    marimuthu
    null
    Declare @table table (EMPIID int, NAME VARCHAR(10),Updatedate datetime)
    INSERT into @table values(111,'Muthu','02/13/2014')
    INSERT into @table values(222,'Mari','02/14/2014')
    INSERT into @table values(222,'Raja','02/13/2014')
    INSERT into @table values(222,'Muthu','02/14/2014')
    INSERT into @table values(333,null,null)
    INSERT into @table values(444,'Rahul','02/02/2014')
    select * from 
    Select empiid,coalesce(name,'dummy') name,updatedate,row_number() over (partition by empiid order by updatedate desc) rn
     from @table
     ) as der where rn=1
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Need Clarification on Looping in Message Mapping.

    Hi All,
      I'm trying to implement the Dynamic emailing as explained in the Michals blog.
    /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
    I have this partially working for the scenario I have.
    XI will be receiving a ORDRSP IDoc from an external system and XI needs to do the following.
    1) Check the value of <b> E1EDP01-ABGRU </b> equals to Z2. If any of the E1EDP01-ABGRU has a value of Z2, it should do the following
             a) Get the email address from the E1EDKA1-ILNNR and map it to the TO field as shown in the blog.
              b) Get the values of BELNR-E1EDK01, MENEE, VPREI, POSEX, PEINH, ABGRT from the E1EDP01 segment and concatenate them all and map it to the Content tag as explained in Michals blog.
      I have this process partially working. The XI interface is only mapping for the first occurrence of E1EDP01 and not the subsequent occurrences of E1EDP01 which matches the criteria ( E1EDP01-ABGRU = Z2)
    Any help in getting fixing this problem??
    Thanks

    Make sure to define multiple target messages in your message and interface mappings, for the mail package message definition (occurrence = 0...unbounded).
    Also, in the logic of your message mapping, you need to create a new mail package message only if  E1EDP01-ABGRU = 'Z2'. Use it like this:
    ABGRU   ---   EqualS   ---   createIf   ---   Mail
    Constant[Z2]
    Regards,
    Henrique.

  • Do we Need Logical System to be maintained for server to server distributio

    Hi all,
    I need to distribute the IDocs from R/3 system to a newly configured XI System or Server.
    I requested to create a Logical system to my R/3 system and to assign that logical system to R/3 client and got it done.
    But in the transaction code BD64 it is asking for reciever logical system.
    My problem is, Can we create logical system in XI server and assign it to XI client?
    Can we maintain that logical system in R/3 system?
    If not what should be given as reciever logical system.
    Thanks in advance,
    Gangolu.

    You will have to create your logical systems in R/3 only for both R/3 and XI. You don't have to do anything in XI.
    Regards,
    Ravi
    Note : Please mark the helpful answers and close the thread if the issue is resolved.

Maybe you are looking for

  • Calling DB connection from another class

    Hi I am trying to create a method in another class to call another method that checks for userid in DB? What is the best way to set this up? I.e. calling method? //calling method below line private boolean setuserExist(String username) {      else re

  • How to use call back and user session id based conversation with web service in weblogic 6.1 sp2 ?????????

    Hi, every one: Here's my question of my day - >>> I am using weblogic 6.1 SP2 right now - running on Unix and Win 2K, and I got a web service up and running called Price Update web service through which user can pick up a price and push a deal to ano

  • How to set my default application...not working

    My company has nearly all adobe applications installed from PageMaker 6.5 through InDesign 5.5. We use them all frequently. I'm trying to set my defaults on the Mac Pros and it is not working. Specs if Needed: OSX 10.6.8  Model Identifier:          M

  • Search Function in iTunes Store Non-Responsive

    I have an iPhone running iOS 7.0.4 (11B554a). Regardless of using wifi, data , or cable, the "Search" function inside the iTunes store appears as a white screen - No previous searches or keyboard dispalys. I have logged out in Settings>iTunes&AppStor

  • How to add a certificate to keystore using keytool?

    Hi all, I am trying to connect a server from my application which requires a certificate for secure connection. I am using Jdeveloper. Should I use command prompt and use keytool command after going to jdk home of jdeveloper and add the certificate?