Problem in move-corresponding

Hi Experts,
I am doing a report on material history and as per my requirement I need to display all the corresponding Po ( ebeln ) against the particular matnr.
But I am facing a problem in displaying matnr which do not have a single Po raised against it. I am pasting a pinch of my code please have look and advice me...
I want to display a matnr which have no ebeln ...but I am able to display all matnr which have its corresponding ebeln.
SELECT MARA~MATNR MARA~MTART MARD~WERKS MARD~LABST MARD~INSME MARD~SPEME FROM MARA INNER JOIN MARD ON MARA~MATNR EQ MARD~MATNR
INTO CORRESPONDING FIELDS OF TABLE IT_MARA
WHERE MARA~MATNR IN MATNR AND MARD~WERKS IN WERKS.
  LOOP AT IT_MARA.
    MOVE IT_MARA-MATNR TO IT_TAB-MATNR.
    MOVE IT_MARA-WERKS TO IT_TAB-WERKS.
    MOVE IT_MARA-LABST TO IT_TAB-LABST.
    MOVE IT_MARA-INSME TO IT_TAB-INSME.
    MOVE IT_MARA-SPEME TO IT_TAB-SPEME.
    COLLECT IT_TAB.
  ENDLOOP.
  IF NOT IT_TAB IS INITIAL.
    SELECT * FROM EKPO INTO CORRESPONDING FIELDS OF TABLE IT_EKPO
       FOR ALL ENTRIES IN IT_TAB WHERE MATNR EQ IT_TAB-MATNR
       AND WERKS EQ IT_TAB-WERKS AND PSTYP EQ '0' AND BSTYP EQ 'F'
       AND ELIKZ EQ ' ' AND LOEKZ NE 'L'.
  ENDIF.
  LOOP AT IT_TAB.
    MOVE-CORRESPONDING IT_TAB TO IT_FIRST.
    LOOP AT IT_EKPO WHERE MATNR EQ IT_TAB-MATNR
                      AND WERKS EQ IT_TAB-WERKS.
      MOVE IT_EKPO-EBELN TO IT_FIRST-EBELN.
      MOVE IT_EKPO-EBELP TO IT_FIRST-EBELP.
      APPEND IT_FIRST.
      CLEAR: IT_FIRST-LABST,IT_FIRST-INSME,IT_FIRST-SPEME.
    ENDLOOP.
  ENDLOOP.
Please advice
Karthik

Changes are below.
>
Karthik R wrote:
>  
>   LOOP AT IT_TAB.
>     MOVE-CORRESPONDING IT_TAB TO IT_FIRST.
>     LOOP AT IT_EKPO WHERE MATNR EQ IT_TAB-MATNR
>                       AND WERKS EQ IT_TAB-WERKS.
>       MOVE IT_EKPO-EBELN TO IT_FIRST-EBELN.
>       MOVE IT_EKPO-EBELP TO IT_FIRST-EBELP.
>       APPEND IT_FIRST.
>       CLEAR: IT_FIRST-LABST,IT_FIRST-INSME,IT_FIRST-SPEME.
>     ENDLOOP.
>     ***IF SY-SUBRC NE 0.
>           This is where materials do not have a PO assigned
>     ***ENDIF
>   ENDLOOP.
>
> Please advice
> Karthik

Similar Messages

  • Problem with move-corresponding

    Hi,
    I have these codes below:
    TYPES: BEGIN OF t_employee1,
            carrid LIKE spfli-carrid,
            connid LIKE spfli-connid,
            countryfr LIKE spfli-countryfr,
          END OF t_employee1.
    DATA: i_employee TYPE STANDARD TABLE OF spfli WITH HEADER LINE,
          i_employee1 TYPE STANDARD TABLE OF t_employee1 WITH HEADER LINE.
    SELECTION-SCREEN BEGIN OF BLOCK b1.
    SELECT-OPTIONS: s_carrid FOR spfli-carrid.
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
      SELECT * FROM spfli INTO TABLE i_employee
    WHERE carrid IN s_carrid.
        MOVE-CORRESPONDING i_employee TO i_employee1.
    But when i debug the program, carrid, connid and countryfr of i_employee do not move to i_employee1...
    is there somethig wrong with my codes???
    Thanks a lot!

    Change ur code as shown below:
    TYPES: BEGIN OF t_employee1,
    carrid LIKE spfli-carrid,
    connid LIKE spfli-connid,
    countryfr LIKE spfli-countryfr,
    END OF t_employee1.
    DATA: i_employee TYPE STANDARD TABLE OF spfli WITH HEADER LINE,
    i_employee1 TYPE STANDARD TABLE OF t_employee1 WITH HEADER LINE.
    SELECTION-SCREEN BEGIN OF BLOCK b1.
    SELECT-OPTIONS: s_carrid FOR spfli-carrid.
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
    SELECT * FROM spfli INTO TABLE i_employee
    WHERE carrid IN s_carrid.
    if sy-subrc = 0.
    loop at i_employee.
    MOVE-CORRESPONDING i_employee TO i_employee1.
    append i_employee1.
    endloop.

  • Move-corresponding in table type Field-Symbols

    Hi,
        I have to use one statement in field-symbol similar to "move-corresponding" in normal internal table.Is it possible to use statement similar to "Move-corresponding in field-symbols".
    For Eg:
    Field-symbols <FA_IT> type standard table.
    data:begin of wa_ekk,
       f1 type i,
       f2 type werks_d,
       f4 type posnr,
       end of wa_ekk,
    it_ekk  like standard table of wa_ekk.
    begin of wa_final,
       f1 type i,
       f2 type werks_d,
       f3 type i,
       f4 type n,
    end of wa_final,
    it_final like standard table of wa_final.
    assign it_ekk to <fs_it>.
    Loop at <fs_it>.
    *???????-i dont know how to move the value to it_final
    *---I know I can use assign component statement
    *-to move each field  to the target field
    but for that we need to know the field name or index position of the structure-
    Endloop.
    My requirment is now i want to move the content of <fs_it> into it_final internal table.
    I know that In normal itab we can use "move-corresponding" to move the value from it_ekk to it_final.
    In the same way how to use it in field-symbol concept.
    Requirement:Real time Processing of Internal table
    1) Content of it_ekk:
    f1   f2       f4
    12  1000  0023
    23  2000  0037
    2)After ASSIGN statement:
    Content of <fs_it> is:
    f1   f2       f4
    12  1000  0023
    23  2000  0037
    3)Now I want to move the content of <fs_it> to it_final
    Output of It_final:
    F1   F2    F3    F4
    12  1000   ---    0023
    23  2000   ---    0037
    Regards,
    Vigneswaran S

    Andrey's code is going to work only if you are running it in a non-unicode system.
    See code below for a Unicode system using similar effect to "Move-Corresponding" statement.
    FIELD-SYMBOLS: <fs_ekk> LIKE wa_ekk,
                   <fs_final> LIKE wa_final.
    ASSIGN it_ekk TO <fs_it> .
    LOOP AT <fs_it> ASSIGNING <fs_ekk>.
      ASSIGN <fs_ekk> TO <fs_final> CASTING.
      CLEAR <fs_final>-f3.
      APPEND <fs_final> TO it_final.
    ENDLOOP.
    Hope this solves your problem and please don't forget to reward points.
    Cheers,
    Sougata.

  • Change "MOVE-CORRESPONDING" statement to MOVE statement in FM

    Hello Guys,
    I have created a datasource based on FM standard template RSAX_BIW_GET_DATA. In the source code in this template, there is a LOOP statement and below that there is a "MOVE-CORRESPONDING" statement.
    LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'PGMID'.
            MOVE-CORRESPONDING l_s_select TO l_r_pgmid.
            APPEND l_r_pgmid.
    ENDLOOP.
    My customer does not allow MOVE-CORRESPONDING statement for performance reasons. Hence I need to change it to MOVE statement. But I do not know the structure of l_s_select and I am not well at ABAP. So How do I write MOVE statement here.
    Can anybody help on this?
    Regards
    Utpal

    Hi Tibollo,
    Thanks for your prompt reply. Your suggestion has solved my problem. One input to this from  my side. It will not accept FIELDNM because it is not present in l_r_pgmid. Remind you l_r_pgmid is declard as a range and ranges does not have FIELDNM.
    Anyway, that portion I have modified and it worked. Thanks a lot. I am rewarding u points.
    Regards
    Utpal

  • Statement not accesible  : "MOVE-CORRESPONDING ebkn TO *ebkn."

    hi guys,
    (system upgraded from 4.6 to 6.0 and made unicode compatible)
                    thr r two problems........
    1. "MOVE-CORRESPONDING ebkn TO *ebkn." is not accessible, is it something related to mirror image......... how to resolve this.
    2. Refresh it_tab - "Refresh and clear statements are not accesible" .
      These are present inside includes..... ( is it somewhere related to use of subroutines prior to the use of refresh or clear statement......)
    Those tables are defined prior to the statement Refresh or Clear.......

    Hi Mohd,
    please paste error message(s) in detail:
    source name(s)
    source line(1)
    full error message including message class, type and number
    If you get W messages (warnings), you may ignore them.
    Regards,
    Clemens

  • Move-corresponding , Append , modify, .........

    Hi..the following table is a program on internal table...
    Tables: MARA, MARD, MAKT.
    Select-options: S_MATNR, S_WERKS, S_LGORT
    FIELD NAME: MARA-MTART, MARA-MATNR, MARA-MBRSH, MAKT-MAKTX, MARD-WERKS, MARD-LGORT, MARD-LABST.
    Internal Tables: Standard Internal table for MARD, MARA, MAKT, OUTTAB with header line.
    Processing Flow:
    1. Select Material data into Internal table based on selection from MARD
    2. Select Material data into Internal table based on selection from MARA
    3. Select Material data into Internal table based on selection from MAKT
    4. Move-corresponding MARD to OUTTAB. Append OUTTAB.
    5. Loop at OUTTAB. Read Table MARA & MAKT and modify OUTTAB.
    6.  Write OUTTAB to Screen.
    I have doubt on Move-corresponding , modify....I have write the code as giving below,,,bt I am not getting proper ouput...data is not selecting from MATNR from selection screen.
    tables: MARA, MARD, MAKT.
    data: begin of i_mara occurs 0,
          MTART type MARA-MTART,  
          MATNR type MARA-MATNR,  
          MBRSH type MARA-MBRSH,  
               end of i_mara.
    data: begin of i_mard occurs 0,
          WERKS type MARD-WERKS,  
          LGORT type MARD-LGORT,  
          LABST type MARD-LABST,  
          end of i_mard.
    data: begin of i_makt occurs 0,
          MAKTX type MAKT-MAKTX,   
          end of i_makt.
    data: begin of wa,
          col1 type MARD-WERKS,
          col2 type MARD-LGORT,
          col3 type MARD-LABST,
          end of wa.
    data: i_outtab like table of wa with header line.
    select-options: S_MATNR for MARA-MATNR,  
                   S_WERKS for MARD-WERKS,  
                   S_LGORT for MARD-LGORT.  
    perform select_data_mard.   (I am not including the data inside this )
    perform select_data_mara.
    perform select_data_makt.
    perform fill_second-outtab.    ( I am including )
    FORM fill_second-outtab .
    loop at i_outtab.
    move-corresponding i_mard to i_outtab.
    append i_outtab.
    endloop.
    ENDFORM.                    " fill_second-outtab
    perform read_mara.
    perform read_makt.
    perform read_mard.
    clear i_outtab.
    wa-col1 = mara-MATNR.
    wa-col2 = mard-WERKS.
    wa-col3 = mard-LGORT.
    modify i_outtab from wa.
    loop at i_outtab into wa.
    write: / wa-col1, wa-col2, wa-col3.
    endloop.
    Thanks in advance.

    Thanks
    ok I am posting my complete code
    If my code is too complicated or wrong , then you can just go through the problem(which I have written at beginning)  and give some hints.
    Thanks
    tables: MARA, MARD, MAKT.
    *********************Data Declearation**************************
    *This is the internal table for mara .*
    data: begin of i_mara occurs 0,
          MTART type MARA-MTART,  
          MATNR type MARA-MATNR,  
          MBRSH type MARA-MBRSH, 
                end of i_mara.
    **This is the internal table MARD table.*
    data: begin of i_mard occurs 0,
          WERKS type MARD-WERKS,  
          LGORT type MARD-LGORT,  
          LABST type MARD-LABST,  
          end of i_mard.
    **This is the internal table for table MAKT.*
    data: begin of i_makt occurs 0,
          MAKTX type MAKT-MAKTX,  
          end of i_makt.
    **Declare outtabb**
    data: begin of wa,
          col1 type MARD-WERKS,
          col2 type MARD-LGORT,
          col3 type MARD-LABST,
          end of wa.
    data: i_outtab like table of wa with header line.
    *******************start of selection screen***********************
    select-options: S_MATNR for MARA-MATNR,  
                   S_WERKS for MARD-WERKS,  
                   S_LGORT for MARD-LGORT. 
    *****************end of selection screen***************************
    ***selecting data from databse*******
    *******************start of main program***************************
    start-of-selection.
    *selection from table MARD*
    perform select_data_mard.
    **select data from MARA*
    perform select_data_mara.
    **select data from MAKT*
    *perform select_data_makt.
    *move-corressponding outtab*
    perform fill_second-outtab.
    *read table mara.*
    perform read_mara.
    *read table makt.*
    perform read_makt.
    **read table mard.
    perform read_mard.
    clear i_outtab.
    wa-col1 = mara-MATNR.
    wa-col2 = mard-WERKS.
    wa-col3 = mard-LGORT.
    append wa to i_outtab.
    loop at i_mard into wa.
    write: / wa-col1, wa-col2, wa-col3.
    endloop.
    *********************end of main program******************
    *&      Form  select_data_mard
          text
    -->  p1        text
    <--  p2        text
    FORM select_data_mard .
    select WERKS LGORT LABST
    from MARD
    into table i_mard.
    ENDFORM.                    " select_data_mard
    *&      Form  select_data_mara
          text
    -->  p1        text
    <--  p2        text
    FORM select_data_mara .
    select MTART MATNR MBRSH
    from MARA
    into table i_mara.
    ENDFORM.                    " select_data_mara
    *&      Form  select_data_makt
          text
    -->  p1        text
    <--  p2        text
    FORM select_data_makt .
    select MAKTX
    from MAKT
    into table i_makt.
    ENDFORM.                    " select_data_makt
    *&      Form  fill_second-outtab
          text
    -->  p1        text
    <--  p2        text
    FORM fill_second-outtab .
    loop at i_outtab.
    move-corresponding i_mard to i_outtab.
    append i_outtab.
    endloop.
    ENDFORM.                    " fill_second-outtab
    *&      Form  read_mara
          text
    -->  p1        text
    <--  p2        text
    FORM read_mara .
    read table i_mara with key
    matnr = mara-matnr.
    ENDFORM.                    " read_mara
    *&      Form  read_makt
          text
    -->  p1        text
    <--  p2        text
    FORM read_makt .
    read table i_makt with key
    MAKTX = makt-maktx.
    ENDFORM.                    " read_mard
    *&      Form  read_mard
          text
    -->  p1        text
    <--  p2        text
    FORM read_mard .
    read table i_mard with key
    werks = MARD-WERKS
    lgort = mard-lgort.
    ENDFORM.                    " read_mard

  • Move corresponding query

    hi all,
    i have 2 internal tables.
    I moving data from internal table 1 to imnternal table 2.
    My problems is that the two internal tables have same fields
    data: begin of itab occurs 0,
       matnr like mara-matnr,
       maktx like makt-maktx,
    end of itab.
    data: begin of itab1 occurs 0,
    maktx like makt-maktx,
       matnr like mara-matnr,
    end of itab1.
    I have data in itab and trying to move to itab2.
    loop at itab.
    move-corresponding itab to itab1.
    append itab1.
    endloop.
    I am not getting any values ,i guess the field in itab1 should be in the same order.
    I have itab1 as i declared is there any way that i can from itab to itab1.
    iam not from programming background and i knew that there was something like move corresponding fields --
    pls let me know
    thanks

    hi preeti,
    one important sugestion.
    never use move corresponding. it will result in very low performance.
    so alwys declare the 2nd itab in the same order itself.
    data: begin of itab occurs 0,
    matnr like mara-matnr,
    maktx like makt-maktx,
    end of itab.
    data: begin of itab1 occurs 0,
    <b>matnr like mara-matnr,</b>
    maktx like makt-maktx,
    end of itab1.
    <b>thn do this.
    if itab[] is not initial.
    itab1[] = itab[].
    else.
    write "no data in itab".
    endif.
    </b>
    but what u wrote in ur question correct.
    chk ur itab has data. as i did in my code.
    rgds
    anver
    if helped mark points

  • Move corresponding Concept

    Helo Experts,
    Plz tell what is the problem in my code.Data is not coming in internal talbe it_error, even on the correct condition
    loop at record.
    if record-BUKRS_001 = 'XYZ' and record-EKORG_002 ne '2000' .
    if sy-subrc eq 0.
    MOVE-CORRESPONDING record TO it_error.
    APPEND record TO it_error.
          endif.
          endif.
    endloop.
    Ravi

    Hi,
    if u r using move corresponding then both the internaal tables sould ahve same stucture...
    here is small eg just go through the code ...
    data: begin of itab occurs 0,
      name(20) type c,
      comp(20) type c,
      city(20) type c,
      END OF ITAB.
    data: begin of itab1 occurs 0,
      name(20) type c,
      city(20) type c,
      END OF ITAB1.
    itab1-name = 'Rajat11'.
    itab1-city = 'Delhi2222'.
    append itab1.
    itab1-name = 'Rajat22'.
    itab1-city = 'Delhi1'.
    append itab1.
    itab1-name = 'Rajat33'.
    itab1-city = 'Delhi2'.
    append itab1.
    loop at itab1 .
    move-corresponding itab1 to itab.
    append itab.
    endloop.
    loop at itab.
    write:/ itab-name.
    write:/ itab-city.
    write:/ itab-comp.
    endloop.
    i hope u will get solution..
    Thanks & Regards
    Ashu Singh

  • Move-corresponding itab1 to itab2

    Hi guys,
    is it possible for a move-corresponding to transfer all entries of itab1 to itab2 by just using this code:
    move-corresponding itab1 to itab2????
    or move-corresponding is only for one entry? thanks a lot!
    always,
    mark

    Hi
    Hi
    Move: transfer the data from a structure to another one in according to the length of original structure;
    Move-corresponding: transfer the data from a structure to another one in according to the name of the fields, so in your case:
    data: begin of t_cash, "cash transactions
    D1(08), "Post Date
    D2(40), "Employee Name
    D3(40), "Employee Vendor Id
    end of t_cash.
    data: begin of t_card, "card transactions
    D1(08), "Post Date
    D2(40), "Employee Name
    D4(25), "Merchant Name
    end of t_card.
    If you use MOVE, u shoudl consider T_CARD is shorter than T_CASH: the last field D4 is long 25 CHAR, but the last field D3 is long 40 char. So u'll loose the last 15 digit of T_CASH
    MOVE T_CASH TO T_CARD.
    is like
    T_CARD = T_CASH(73).
    If you use MOVE-CORRESPONDING, u'll transfer only the information of the field D1 and D2:
    MOVE-CORRESPONDING T_CASH TO T_CARD.
    is like
    T_CARD-D1 = T_CASH-D1.
    T_CARD-D2 = T_CASH-D2.
    Now the problem is ECC 6.00 is unicode release, so the statament MOVE-CORRESPONDING can't be used if the original and destination variable have a different structure.

  • Since itunes and apple tvs latest update I have had problem wtching movies on apple tv via my itunes can any one help, movie takes a very long time to load sometimes never, it use to work really well, whats going on please help?

    Since itunes and apple tvs latest update I have had problem wtching movies on apple tv via my itunes can any one help, movie takes a very long time to load sometimes never, it use to work really well, whats going on please help?

    You might find useful information in item D1 of Time Machine Troubleshooting.

  • Problem with movies imported from iPad3

    Whenever I import footage into imovie, the footage looks good. When I put that footage into a project it stutters.
    It doesnt matter if I specify 24fps or 30fps, the movie judders and stutters.
    I do not have this problem with movie footage imported from any other device.
    Any ideas?

    Whenever I import footage into imovie, the footage looks good. When I put that footage into a project it stutters.
    It doesnt matter if I specify 24fps or 30fps, the movie judders and stutters.
    I do not have this problem with movie footage imported from any other device.
    Any ideas?

  • Problems downloading movies since upgrading to mavericks

    Ever since upgrading to mavericks when it was first released, I have had nothing but problems downloading movies in iTunes. What normally would take no more than 30 minutes to download a movie and iTunes extras has now turned into waiting more than 3 hours with no less than 4 error messages saying iTunes cannot download the movie and I have to relaunch iTunes or reboot my entire system. It is getting quite annoying and I can't seem to find a solution.
    Any help would be greatly appreciated.
    Thank you in advance.

    I upgraded to Mavericks on two computers and have display problems too! I have CC on one Macbook Pro (2011) and CS6 on another (2012) and I'm now almost positive my display problems are triggered by InDesign. I don't have to be doing anything special, and I don't have to be working in InDesign at the time, but InDesign has to be open and I get things like this:
    Once it turns magenta or green, that's when I have to boot the system. I can still work with the glitchy display before it turns colors and if I'm still able to quit InDesign while it's glitching, the display goes back to normal. Same on both computers and the 2011 one has a new logic board in it.
    At first I thought it had something to do with connecting my hard drive or my external display, but the display issues happened with both computers with nothing hooked up. Those are ruled out now. I took my 2012 computer to Apple and they told me it was a software issue and all my hardware is ok. Obviously they didn't fix the software issue because it's still happening.
    This is not normal and needs to be fixed soon!

  • Problem sybcing movies

    I'm having a syncing issue. I manually sync ATV and for some reason, the movies I have recently purchased directly on atv are not showing up in my itunes menu so I can't watch them on my imac. However, if I purchase on my computer and then sync the movie is on my imac and atv. what am I doing wrong? This has never been an issue before. I thought it might be because I recently bought an external HD and now store itunes on it but that would mean I should have problems syncing both right?

    Sorry, the subject should say "Problem syncing movies"

  • HT1390 Report problem with movie rental

    I rented the movie "Hunger Games". After the download had completely finished I wanted to watch the movie in iTunes and had trouble, the sound was on and off, the picture sometimes blurry and interrupted.
    How can I report a problem in movie rentals?

    Log in to the Store. Click on "Account" in your Quick Links. When you're in your Account information screen, go down to Purchase History and click "See all".
    Find the item that is not playing properly. If you can't see "Report a Problem" next to the item, click the "Report a problem" button. Now click the "Report a Problem" link next to the item.

  • Problems importing .mov file

    I am all of a sudden having problems importing .mov files from my camera in iPhoto '08. Can't get them to import in Image Capture either...On the import preview screen, all that comes up are empty "boxes". If I highlight one of the boxes, it shows that it is .mov file, the size of the file, etc. but if i try to do the import, iPhoto just locks up.

    iPhoto does not like very large movie files for importing directly from the camera. If you get it on the desktop you should be able to import it. I've imported 200MB movies with no problem.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 6 and 7 libraries and Tiger and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

Maybe you are looking for