Internal table reltd issue

Hi,
I have got 3 tables:
it_extnout (old)
Fld1     Fld2     Fld3     Fld4     Fld5     Fld6     Fld7
ABC     123     70     JKL     5.00     A     Q
it_extnin (new)
Fld1     Fld2     Fld3     Fld4     Fld5     Fld6     Fld7
ABC     123     99     LMN          
it_extnin_x(update flag for new)
Fld1     Fld2     Fld3     Fld4     Fld5     Fld6     Fld7
ABC     123     X     X          X     
So now...my requirement is as follows:
if an update flag is set for any field in it_extnin_x, then new value should get updated in it_extnout table.
Here, fld3, 4, and 6 is set for update, so finally my it_extnout should look like
Fld1     Fld2     Fld3     Fld4     Fld5     Fld6     Fld7
ABC     123     99     LMN     5.00          Q
Also, any field from fld3 to fld7 could be marked for an update, so it is dynamic.
I do not want to write read statements for each column like
read table itab with key fld3 = X (if sy-subrc is 0, then do some processing)
or read table itab with key where fld4 = X and so on....
What is the optimum way to achieve the same?
Any useful is deeply appreciated!
Thanks
Follow the rules of engagement, Don't use multiple user accounts for posting the question
If you repeat this your user will be locked and deleted
Edited by: Vijay Babu Dudla on Apr 20, 2011 10:19 AM

Try this.I think you want output like this......
DATA: BEGIN OF LINE,
        CARRID   TYPE SBOOK-CARRID,
        CONNID   TYPE SBOOK-CONNID,
        FLDATE   TYPE SBOOK-FLDATE,
        CUSTTYPE TYPE SBOOK-CUSTTYPE,
        CLASS    TYPE SBOOK-CLASS,
        BOOKID   TYPE SBOOK-BOOKID,
      END OF LINE.
DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY TABLE LINE.
SELECT CARRID CONNID FLDATE CUSTTYPE CLASS BOOKID
       FROM SBOOK INTO CORRESPONDING FIELDS OF TABLE ITAB.
LOOP AT ITAB INTO LINE.
  AT FIRST.
    WRITE / 'List of Bookings'.
    ULINE.
  ENDAT.
    AT NEW CARRID.
      WRITE: / 'Carrid:', LINE-CARRID.
    ENDAT.
      AT NEW CONNID.
        WRITE: / 'Connid:', LINE-CONNID.
      ENDAT.
        AT NEW FLDATE.
          WRITE: / 'Fldate:', LINE-FLDATE.
        ENDAT.
          AT NEW CUSTTYPE.
            WRITE: / 'Custtype:', LINE-CUSTTYPE.
          ENDAT.
               WRITE: / LINE-BOOKID, LINE-CLASS.
            AT END OF CLASS.
              ULINE.
            ENDAT.
ENDLOOP.
This is also helpful......
LOOP AT <itab>.
  AT FIRST. ... ENDAT.
    AT NEW <f1>. ...... ENDAT.
      AT NEW <f2 >. ...... ENDAT.
          <single line processing>
      AT END OF <f2>. ... ENDAT.
    AT END OF <f1>. ... ENDAT.
  AT LAST. .... ENDAT.
ENDLOOP.
Regards
Abhishek

Similar Messages

  • Short dump-internal table size issue

    Hi,
    I get the following message in the short dump analysis for a report.
    No storage space available for extending table "IT_920".
    You attempted to extend an internal table, but the required space was not available.
    Error Analysis:
    The internal table "IT_920" could not be enlarged further.             
    To extend the internal table, 9696 bytes of storage space was          
    needed, but none was available. At this point, the table "IT_920" has  
    1008240 entries.
    Its an old report and I saw the internal table declaration using the "OCCURS" clause in the internal table declaration.
    begin of itab occurs 100.
    end of itab.
    I tried the option of changing to "OCCURS 0", still issue persists.
    Any help would be highly appretiated
    CM

    Hello CMV,
    This is basic problem with SAP internal tables. For every internal table memory is alocated ( Max..256K)...once you cross the memory size/limit of the internal table it resuls in short dump.
    Only way to overcome this problem is handle limited number of records at a time.. 
    Please refer following sample code which will help you to avoid short dump while processing large number of records....
      SORT TAB_RESULT.
      DESCRIBE TABLE TAB_RESULT LINES W_RECORDS.
      W_LOW      = 1.
      W_UP       = 1000.
    *Spliting the records from tab_result1 by pakage of 1000 at a time
    *to avoid short dump in case of more records
      WHILE W_LOW <= W_RECORDS.
        R_PKUNWE-SIGN = 'I'.
        R_PKUNWE-OPTION = 'EQ'.
        R_WERKS-SIGN = 'I'.
        R_WERKS-OPTION = 'EQ'.
        LOOP AT TAB_RESULT FROM W_LOW TO W_UP.
          MOVE TAB_RESULT-PKUNWE TO R_PKUNWE-LOW.
          MOVE TAB_RESULT-WERKS  TO  R_WERKS-LOW.
          APPEND R_PKUNWE.
          APPEND R_WERKS.
        ENDLOOP.
    *fetch sold to party
         SELECT KUNNR NAME1
           FROM KNA1
           APPENDING CORRESPONDING FIELDS OF TABLE TAB_KNA1
           WHERE KUNNR IN R_PKUNWE.
    *fetch plant
      SELECT WERKS NAME1
             FROM T001W
             APPENDING CORRESPONDING FIELDS OF TABLE TAB_T001W
             WHERE WERKS IN R_WERKS.
       REFRESH: R_PKUNWE,
                R_WERKS.
        W_LOW = W_LOW + 1000.
        W_UP  = W_UP  + 1000.
      ENDWHILE.
    Hope this will help you to solve problem.
    Cheers,
    Nilesh

  • Internal table Memory Issue Exception TSV_TNEW_PAGE_ALLOC_FAILED

    Hi experts,
    I am working on a conversiojn programme. This programme is dealing with 4 input files.
    Each of these files is having more than 50,000 records. I am reading the corresponding application server files to fill
    the internal tables related to these files.
    The files are being read properly and internal tables are being filled.
    However when i try to assign any of these 4 internal tables to other temproray internal tables in programme(requirement)
    i get a dump  TSV_TNEW_PAGE_ALLOC_FAILED.
    The dump is related to memory issue.
    I think The memory available in the programme at this point is not sufficient for table assignment.
    Please suggest any alternatives where i can save any memory .
    Changig of basis setting is not an option.
    Regards,
    Abhishek Kokate

    Hi Kiran,
    I am not agree with you , I am agree with Hermann.
    While writting file you restrict the record max 5,000 to 10,000 records and process don't store the mutch data into internal table.
    After every used refresh the internal table, Declare table where necessary.
    But you can try to avoid the copy cost.
    Rgds
    Ravi Lanjewar

  • Internal table logic issue

    Hi All,
    I have one logical issue related to internal table manipulation.
    I have one internal table :
    I_DAT - This is related to Loading/Unloading of Goods.
    for example with 3 fields
    VSTEL, KUNNA, KMMANG.
    Now suppose my data looks like this after sorting:
    VSTEL   KUNNA    KMMANG
    100       -        -
    200       -        -
    300       -        -
    400       -        -
    -         500      X
    -         600      X
    -         700      X
    -         800      X
    Here 100,200,300,400 are Loading points.
    ANd 500,600,700,800 are unloading points.
    Now what i want is For loading & Unloading points i need to pick up Address and print one after other.
    But how they need to print is:
    FOR INITIAL LOADING OF
    ADDRESS- For 100
    FIRST STOP: FOR LOADING OF
    ADDRESS- For 200
    SECOND STOP: FOR LOADING OF
    ADDRESS- For 300
    Etc .....
    Then
    FOR UNLOADING OF:
    ADDRESS- For 400
    FIRST STOP: FOR UNLOADING OF
    etc.
    FINAL STOP: FOR FINAL UNLOADING OF
    We might get as many records :
    Can any body give me the logic:
    Printing Address is not a problem:
    But Above every address we need to print FIRST STOP, SECOND etc like that.
    For this i need logic.
    Can anybody give the solution!
    Thanks in advance.
    Thanks & Regards,
    Prasad.

    Try this.I think you want output like this......
    DATA: BEGIN OF LINE,
            CARRID   TYPE SBOOK-CARRID,
            CONNID   TYPE SBOOK-CONNID,
            FLDATE   TYPE SBOOK-FLDATE,
            CUSTTYPE TYPE SBOOK-CUSTTYPE,
            CLASS    TYPE SBOOK-CLASS,
            BOOKID   TYPE SBOOK-BOOKID,
          END OF LINE.
    DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY TABLE LINE.
    SELECT CARRID CONNID FLDATE CUSTTYPE CLASS BOOKID
           FROM SBOOK INTO CORRESPONDING FIELDS OF TABLE ITAB.
    LOOP AT ITAB INTO LINE.
      AT FIRST.
        WRITE / 'List of Bookings'.
        ULINE.
      ENDAT.
        AT NEW CARRID.
          WRITE: / 'Carrid:', LINE-CARRID.
        ENDAT.
          AT NEW CONNID.
            WRITE: / 'Connid:', LINE-CONNID.
          ENDAT.
            AT NEW FLDATE.
              WRITE: / 'Fldate:', LINE-FLDATE.
            ENDAT.
              AT NEW CUSTTYPE.
                WRITE: / 'Custtype:', LINE-CUSTTYPE.
              ENDAT.
                   WRITE: / LINE-BOOKID, LINE-CLASS.
                AT END OF CLASS.
                  ULINE.
                ENDAT.
    ENDLOOP.
    This is also helpful......
    LOOP AT <itab>.
      AT FIRST. ... ENDAT.
        AT NEW <f1>. ...... ENDAT.
          AT NEW <f2 >. ...... ENDAT.
              <single line processing>
          AT END OF <f2>. ... ENDAT.
        AT END OF <f1>. ... ENDAT.
      AT LAST. .... ENDAT.
    ENDLOOP.
    Regards
    Abhishek

  • Internal table data issue

    i have a internal table i_final in program 1 and this internal table data need to be input of other program, so how i need to pass the i_final data to other program.

    this is the code in program 1:
      ENDIF.
    **appending work area to internal table.
        APPEND wa_final TO i_final.
      ENDLOOP.
      EXPORT i_final to memory id 'zfinal'.
    this is the code in program 2:
    TYPES: BEGIN OF t_final,
          bukrs TYPE bkpf-bukrs,
          belnr TYPE bkpf-belnr,
          blart TYPE bkpf-blart,
          xblnr TYPE bkpf-xblnr,
          ebeln TYPE ekbe-ebeln,
          ebelp TYPE ekbe-ebelp,
          belnr1 TYPE ekbe-belnr,
          xblnr1 TYPE ekbe-xblnr,
          ebeln1 TYPE ekko-ebeln,
          exnum TYPE ekko-exnum,
          lands TYPE ekko-lands,
          stceg_l TYPE ekko-stceg_l,
          END OF t_final.
    DATA: i_final TYPE STANDARD TABLE OF t_final WITH HEADER LINE.
    DATA: wa_final TYPE t_final.
    IMPORT i_final from memory ID 'zfinal'.
    write: i_final.
    its giving Dump.

  • Dynamic internal table column issue

    Hi
    i have ALV report with dynamic internal table.after i build the internal table and fieldcatalog i have problem  i.e. when grid is displayed then one of the column value is coming in the next column.i populated col_pos in field catalog also and in the debug mode data is populated correctly for respective columns in fieldcatalog and dynamic internal table. But when it is displayed i have this problem.
    any inputs on this?

    Hi Moorthy,
    Did you perform an ALV consistency check?
           Check the below given links as well.
    The Consistency Check - ALV Grid Control (BC-SRV-ALV) - SAP Library
    SAP ALV Consistency Check
    Regards,
    Philip.

  • Populating dynamic internal table

    Hi All,
    I've created a dynamic internal table the issue is that the data is to be entered in it from 2 different tables so ...
    is their any way we can read the internal table field names ...
    or any other way to populate data in it ...

    hi
    check this link
    http://www.****************/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm
    thanks
    sitaram

  • Issue with uploading XML file from application server into internal table

    i Need to fetch the XML file from the application server and place into internal table and i am getting error message while using the functional module   SMUM_XML_PARSE and the error message is "line   1 col   1-unexpected symbol; expected '<', '</', entity reference, character data, CDATA section, processing instruction or comment" and could you please let me know how to resolve this issue?  
        TYPES: BEGIN OF T_XML,
                 raw(2000) TYPE C,
               END OF T_XML.
    DATA:GW_XML_TAB TYPE  T_XML.
    DATA:  GI_XML_TAB TYPE TABLE OF T_XML INITIAL SIZE 0.
    DATA:GI_STR TYPE STRING.
    data:  GV_XML_STRING TYPE XSTRING.
    DATA: GI_XML_DATA TYPE  TABLE OF SMUM_XMLTB INITIAL SIZE 0.
    data:GI_RETURN TYPE STANDARD TABLE OF BAPIRET2.
        OPEN DATASET LV_FILE1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
        IF SY-SUBRC NE 0.
          MESSAGE 'File does not exist' TYPE 'E'.
        ELSE.
          DO.
    * Transfer the contents from the file to the work area of the internal table
            READ DATASET LV_FILE1 INTO GW_XML_TAB.
            IF SY-SUBRC EQ 0.
              CONDENSE GW_XML_TAB.
    *       Append the contents of the work area to the internal table
              APPEND GW_XML_TAB TO GI_XML_TAB.
            ELSE.
              EXIT.
            ENDIF.
          ENDDO.
        ENDIF.
    * Close the file after reading the data
        CLOSE DATASET LV_FILE1.
        IF NOT GI_XML_TAB IS INITIAL.
          CONCATENATE LINES OF GI_XML_TAB INTO GI_STR SEPARATED BY SPACE.
        ENDIF.
    * The function module is used to convert string to xstring
        CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
          EXPORTING
            TEXT   = GI_STR
          IMPORTING
            BUFFER = GV_XML_STRING
          EXCEPTIONS
            FAILED = 1
            OTHERS = 2.
        IF SY-SUBRC <> 0.
          MESSAGE 'Error in the XML file' TYPE 'E'.
        ENDIF.
      ENDIF.
      IF GV_SUBRC = 0.
    * Convert XML to internal table
        CALL FUNCTION 'SMUM_XML_PARSE'
          EXPORTING
            XML_INPUT = GV_XML_STRING
          TABLES
            XML_TABLE = GI_XML_DATA
            RETURN    = GI_RETURN.
      ENDIF.
      READ TABLE GI_RETURN TRANSPORTING NO FIELDS WITH KEY TYPE = 'E'.
      IF SY-SUBRC EQ 0.
        MESSAGE 'Error converting the input XML file' TYPE 'E'.
      ELSE.
        DELETE GI_XML_DATA WHERE TYPE <> 'V'.
        REFRESH GI_RETURN.
      ENDIF.

    Could you please tel me  why the first 8 lines were removed, till <Soap:Body and also added the line <?xml version="1.0" encoding="UTF-8"?> in the beggining .
    Becuase there will be lot of  XML files will be coming from the Vendor daily and that should be uploaded in the application server and should update in the SAP tables based on the data in the XML file.
    what information i need to give to vendor that do not add the first 8 lines in the XML file and add the line in the beggining <?xml version="1.0" encoding="UTF-8"?>   ??????
    Is there any other way we can do with out removing the lines?

  • Issue in populating the dynamic internal table  in SMARTFORMS

    Hi Experts,
    My requirement is I have a table in the below format.
    Measuring Point
    Description of Measuring Point
    UOM
    Date
    Time
    Reading
    96
    POWER GENERATED
    kwh
    20140501
    101837
    1.00E+04
    96
    POWER GENERATED
    kwh
    20140502
    102220
    1.00E+04
    96
    POWER GENERATED
    kwh
    20140503
    104623
    1.25E+01
    96
    POWER GENERATED
    kwh
    20140504
    101111
    2.00E+03
    98
    AUX POWER CONSUME
    kwh
    20140501
    101837
    1.00E+05
    98
    AUX POWER CONSUME
    kwh
    20140502
    102220
    1.00E+05
    99
    NET POWER EXPORTED
    kwh
    20140501
    101837
    1.00E+07
    99
    NET POWER EXPORTED
    kwh
    20140502
    102220
    1.00E+07
    100
    AVG POWER GENERATED
    MW
    20140501
    101837
    1.00E+02
    100
    AVG POWER GENERATED
    MW
    20140502
    102220
    1.00E+02
    101
    AUX POWER CONSUMED(%)
    20140501
    101837
    1.00E+02
    101
    AUX POWER CONSUMED(%)
    20140502
    102220
    1.01E+01
    102
    PLANT AVAILABLE HRS
    hrs
    20140501
    101837
    1.01E+01
    102
    PLANT AVAILABLE HRS
    hrs
    20140502
    102220
    1.01E+01
    103
    PLANT RUN HOURS
    hrs
    20140501
    101837
    1.01E+01
    103
    PLANT RUN HOURS
    hrs
    20140502
    102220
    1.01E+01
    104
    PLANT AVAILABLITY FACTOR
    20140501
    101837
    1.00E+02
    104
    PLANT AVAILABLITY FACTOR
    20140502
    102220
    1.00E+02
    which i need to display like below based on the user Requirement for print out.
    DATE
    POWER GENERATED(96)
    AUX POWER CONSUME(98)
    NET POWER EXPORTED(99)
    AVG POWER GENERATED(100)
    AUX POWER CONSUMED(%)(101)
    PLANT AVAILABLE HRS(102)
    PLANT RUN HOURS(103)
    PLANT AVAILABLITY FACTOR(104)
    kwh
    kwh
    kwh
    MW
    hrs
    hrs
    01.05.2014
    1.00E+04
    1.00E+05
    1.00E+07
    1.00E+02
    1.00E+02
    1.01E+01
    1.01E+01
    1.00E+02
    02.05.2014
    1.00E+04
    1.00E+05
    1.00E+07
    1.00E+02
    1.01E+01
    1.01E+01
    1.01E+01
    1.00E+02
    03.05.2014
    1.25E+01
    04.05.2014
    2.00E+03
    Now the issue is how to assign the values of stops from the internal table to dynamically  for a specific date in SMARTFORMS?
    Please help me in resolving this issue.

    Hi,
    See if this articale is good for you:
    The case of "dynamic columns in smartform"
    Regards.

  • Logic issues for manipulation of internal table data

    Hi,
    I am having a issue with logic of one program.
    In the <b>XVBAP</b> internal table of <b>SO</b> User Exit.
    We will have fields like
    <b>UPDKZ, POSNR, UEPOS, ZZECD[Z-Field] etc.</b>
    Above fields are related to logic.
    1. Now my first point is:
    <b>We need to capture Records where UPDKZ='D' and ZZECD[Z-Field] is populated.</b>
    For this we will write code as below:
    <b>LOOP AT XVBAP WHERE UPDKZ     EQ C_D   AND
                        ZZECD     NE SPACE.
    Here we will store all fields in I_XVBAP I.Table
    ENDLOOP.</b>
    Supoose we have retrieved records as below:
    <b>VBELN, UPDKZ, POSNR, UEPOS, ZZECD
    100    D   000040   000030 Text1
    100    D   000050   000020 Text2
    100    D   000060   000000 Text3</b>
    2. My second point here is:
    <b>For Every Item[POSNR] we need to get the Higher level item from UEPOS field, If the Higher level Item also has UPDKZ = ‘D’, then move the base unit and all it’s components into an internal table. continue this process till UEPOS for POSNR is 000000 but High item should have UPDKZ = 'D', not only this all items in this chain should have UPDKZ = 'D'.</b>
    Ex:
    <b>Suppose for item 000050 UEPOS is 000020 then goto XVBAP with POSNR = UEPOS[000020] and UPDKZ = 'D' if yes and then pick up UEPOS for 000020 item and continue this process till UEPOS becomes 000000 and UPDKZ = 'D'.
    Here from Low level to High level all the chain items should have UPDKZ = 'D'. Then only write all items into Final Internal table.</b>
    <b>Need to do this process for all above rec's [40,50,60 - POSNR].</b>
    Can anybody provide me the logic for the above scenario.
    Thanks in advance.
    Thanks and Regards,
    Deep

    Hi Anurag,
    Your assumption is wrong.
    See first when we get into our logic we will get <b>XVBAP</b> data as below:
    <b>VBELN, POSNR, UEPOS, UPDKZ, ZZECD
    100,  10,  00,  D,  Text1
    100,  20,  00,   ,  Text2
    100,  30,  20,  D,  Text3
    100,  40,  30,  D,  Text4
    100,  50,  00,   ,  Text5
    100,  60,  00,   D, Text6
    100,  70,  60,   D, Text7</b>
    After we run first point we will get data as:
    Here logic is pick up data where <b>UPDKZ = D</b> and <b>ZZECD NE SPACE</b>.
    <b>VBELN, POSNR, UEPOS, UPDKZ, ZZECD
    100, 10, 00, D, Text1
    100, 30, 20, D, Text3
    100, 40, 30, D, Text4
    100, 60, 00, D, Text6
    100, 70, 60, D, Text7</b>
    Then we will goto second point:
    Here we need to look into <b>3</b> things totally in 2nd point:
    1. In loop Select the record which has <b>UEPOS EQ space</b>, <b>UPDKZ = D</b> and <b>POSNR</b> should not be <b>UEPOS</b> for any other record from above data from 1st point.
    <b>100, 10, 00, D, Text1</b>
    will be selected into final internal table as per this point.
    2. If for a POSNR value UEPOS NE SPACE, UPDKZ = D then goto UEPOS's POSNR in high level check there if UPDKZ = D and then wether UEPOS is ZERO (or) contains any value.
    If any value is there repeat the process till UEPOS become ZERO. Then for that final higher level item check UPDKZ value if it has value as 'D', If has then write all those records from low item to high item into final internal table.
    <b>100, 60, 00, D, Text6
    100, 70, 60, D, Text7</b>
    In above for Item 70[POSNR] we have UEPOS as 60 and UPDKZ as D. then we will goto UEPOS's POSNR, Now POSNR is 60 then check it's UEPOS it is ZERO so check UPDKZ because it is D write both items 60, 70 into final internal table.
    2. If for a POSNR value UEPOS NE SPACE, UPDKZ = D then goto UEPOS's POSNR in high level check there if UPDKZ = D and then wether UEPOS is ZERO (or) contains any value.
    If any value is there repeat the process till UEPOS become ZERO. Then for that final higher level item check UPDKZ value if it has value as 'D', If it does not have  UPDKZ as 'D' then don't write any item from low to high into final internal table.
    If we take the scenario of below rows:
    <b>100,  20,  00,   ,  Text2
    100,  30,  20,  D,  Text3
    100,  40,  30,  D,  Text4</b>
    POSNR-40 has UEPOS-30 & UPDKZ = D then UEPOS's POSNR-30 has UEPOS-20 and UPDKZ-D then UEPOS POSNR-20 has UEPOS as 00 then stop here and see UPDKZ which is ZERO so don't consider items 20,30,40 into final i.table.
    In the above chain in any record UPDKZ is not 'D' then skip the process anddon't write the records into final internal table.
    Final output will come as:
    <b>100, 10, 00, D, Text1</b>
    <b>100, 60, 00, D, Text6
    100, 70, 60, D, Text7</b>
    Thanks for all your efforts.
    Thanks,
    Deep

  • Issue with clearing internal table

    Hi Gurus,
    I am working on an issue, where when we run a std. report we see social number of the employee on the output screen, when I debugged the program I found that there are 2 internal tables where we are putting this SSN. I tried to clear the SSN at the both the places like:
    loop at it_table.
    clear it_table-SSN.
    Endloop.
    but still when I ran the report I am seeing social there. so can you please give me any idea of what I am doing wrong?
    Thanks,
    Rajeev Gupta

    Hi rajeev,
    even after ur clearing if the field is still populating it means again its filling the particular field in the later place.
    1) keep ur code and while debuging just click on watchpoint and give ur field name go with f8 it will take u to the place the field is filling..
    2) below that place clear that field and modify the table..

  • Issue in Internal Table for calculating MAX value

    Hi Abapers,
    I have internal table with data as follows:
                         Materail                               Currency      Quantity    Dominant_Currency
    1     000000000007001896     GBP     396
    2     000000000007001896     EUR     25
    3     000000000007001310     USD      7
    4     000000000007001310     GBP     646
    5     000000000007001310     EUR     195
    6     000000000007000949     GBP     947
    7     000000000007000949     EUR     117
    Now I have to find out the max quantity for each materail and currency against max quantity which will be put in the dominat currency fields of Internal Table.
    Eg: For material 000000000007001896, 396 is the max quantity and Currency for this is GBP so dominant currency will be GBP for first 2 records.
    Similarly 646 is max for 000000000007001310 therefore GBP will be dominant curr for the records containg material 000000000007001310
    Please solve the issue.
    Regards,
    Rahul Sinha

    lv_quantity --> quantity parameter
    sort itab by matnr quantity
    loop at itab.
    at new material.
    clear lv_quantity.
    endat,
    if itab-quantity > lv_quantity.
      lv_quantity = itab-quantity.
      itab-dominant_curr = itab-curr.
      modify itab transporting dominant_curr where material = itab-material.
    endif.
    "please write  modify statement with some logic..so that it is called once for one item
    endloop.
    if you find any issue revert back.

  • Issue In internal table data population in the o/p

    Dear Guru , I have encountered an issue for which i am not able to findout the logic  . I have an internal table through which i am populating the below data for detail report format :->
    Plant     Material Number          Storage Loc     Movement Type          Avg Days
    019     0820B0073          MOD3          101               space
    019     0820B0073          MOD3          101               space
    019     0820B0073          MOD3          101               space
    019     0820B0073          MOD3          101               space
    019     0820B0073          MOD3          101               space
    020     0820B0074          MOD4          101               space
    020     0820B0074          MOD4          101               2
    020     0820B0074          MOD4          101               3
    The requirment is like this the summary report should show o/p like below addition of all the rows with respect to plant , material, storage location and movement type :-
    Plant     Material Number          Storage Loc     Movement Type          Avg Days
    019     0820B0073          MOD3          101               space
    020     0820B0074          MOD4          101               5
    but when i am adding it with respect to plant, material, storage location and movement type the o/p i am getting is like below
    Plant     Material Number          Storage Loc     Movement Type          Avg Days
    019     0820B0073          MOD3          101               0
    020     0820B0074          MOD4          101               5
    becasue addition of 5 spaces ( Avg Days )of plant 019 is coming as ZERO --> 0
    so Guru what logic i should use to get the proper o/p,..I have Used Following logic to perform summation with respect to plant, material , storage loc and movement type.
    CLEAR: wa_mkpf_mseg, w_werks, w_matnr, w_lgort, w_bwart.
    LOOP AT t_mkpf_mseg INTO wa_mkpf_mseg.   
    IF wa_mkpf_mseg-werks EQ w_werks AND wa_mkpf_mseg-matnr EQ w_matnr AND wa_mkpf_mseg-lgort EQ w_lgort AND wa_mkpf_mseg-bwart EQ w_bwart.
          CLEAR: wa_p_coi.
          READ TABLE t_p_coi INTO wa_p_coi WITH KEY werks = wa_mkpf_mseg-werks matnr = wa_mkpf_mseg-matnr lgort = wa_mkpf_mseg-lgort bwart = wa_mkpf_mseg-bwart.
         IF sy-subrc = 0.
         wa_p_coi-Avg Days    = wa_p_coi-Avg Days   + wa_mkpf_mseg-Avg Days.
         MODIFY t_p_coi FROM wa_p_coi TRANSPORTING Avg Days   .
         CLEAR: wa_p_coi, wa_p_coi.
         endif.
    ELSE.
          wa_p_coi-werks                     = wa_mkpf_mseg-werks.
          wa_p_coi-matnr                     = wa_mkpf_mseg-matnr.
          wa_p_coi-bwart                   = wa_mkpf_mseg-bwart.
          wa_p_coi-lgort                     = wa_mkpf_mseg-lgort.
          wa_p_coi-Avg Days                  = wa_mkpf_mseg-Avg Days   .
         APPEND wa_p_coi TO t_p_coi.
               CLEAR: wa_p_coi.
    ENDIF.
        w_werks = wa_mkpf_mseg-werks.
        w_matnr = wa_mkpf_mseg-matnr.
        w_lgort = wa_mkpf_mseg-lgort.
        w_bwart = wa_mkpf_mseg-bwart.
       CLEAR: wa_mkpf_mseg.
      ENDLOOP.

    The soln what i found after working out
    CLEAR: wa_mkpf_mseg, w_werks, w_matnr, w_lgort, w_bwart.
    LOOP AT t_mkpf_mseg INTO wa_mkpf_mseg.
    IF wa_mkpf_mseg-werks EQ w_werks AND wa_mkpf_mseg-matnr EQ w_matnr AND wa_mkpf_mseg-lgort EQ w_lgort AND wa_mkpf_mseg-bwart EQ w_bwart.
    CLEAR: wa_p_coi.
    READ TABLE t_p_coi INTO wa_p_coi WITH KEY werks = wa_mkpf_mseg-werks matnr = wa_mkpf_mseg-matnr lgort = wa_mkpf_mseg-lgort bwart = wa_mkpf_mseg-bwart.
    IF sy-subrc = 0.
    if wa_p_coi-Avg Days  = ' ' and wa_mkpf_mseg-Avg Days = ' '.
    wa_p_coi-Avg Days = ' '.
    ELSE
    wa_p_coi-Avg Days = wa_p_coi-Avg Days + wa_mkpf_mseg-Avg Days.
    Endif.
    MODIFY t_p_coi FROM wa_p_coi TRANSPORTING Avg Days .
    CLEAR: wa_p_coi, wa_p_coi.
    endif.
    ELSE.
    wa_p_coi-werks = wa_mkpf_mseg-werks.
    wa_p_coi-matnr = wa_mkpf_mseg-matnr.
    wa_p_coi-bwart = wa_mkpf_mseg-bwart.
    wa_p_coi-lgort = wa_mkpf_mseg-lgort.
    wa_p_coi-Avg Days = wa_mkpf_mseg-Avg Days .
    APPEND wa_p_coi TO t_p_coi.
    CLEAR: wa_p_coi.
    ENDIF.
    w_werks = wa_mkpf_mseg-werks.
    w_matnr = wa_mkpf_mseg-matnr.
    w_lgort = wa_mkpf_mseg-lgort.
    w_bwart = wa_mkpf_mseg-bwart.
    CLEAR: wa_mkpf_mseg.
    ENDLOOP.

  • Issue with Internal Table

    Hi All,
    I have defined an internal table 'with occurs 0'.
    While debuggining, i am observing that only 50,000 lines are getting populated in that internal table.
    How to increase the capacity of the internal table, so that it can hold more number of lines?
    Regards
    Pavan

    I would like to explaing you all about this issue.
    I have defined an internal table as follows...
    data:  IT_CATSDB       TYPE BAPICATS2 OCCURS 0 WITH HEADER LINE.
    I have used a BAPI called "BAPI_CATIMESHEETRECORD_GETLIST" which will retirieve the Timesheet details of all employees within a given date range.
    Now, the number of entries that we got from this BAPI are stored in the internal table it_catsdb.
    I have observed that this internal table is holding max of 50k lines.
    If i check the database table (CATSDB) for the same conditions in SE11, i am able to get around 1L lines.
    Hence my report is showing incorrect output.
    Kindly help me out with some logic, so that this internal table can hold as much as data possible without any restriction.....
    Regards
    Pavan

  • SMART FORMS- data from  internal table issue

    Hi ,
           I have a smart form in which I have to print three types of materials of Material Types say M1, M2 ,M3.
    In the SMART FORM,Main Window, I have created 3 TABLES for 3 types of Materials ie,
               TableM1,
               TableM2,
               TableM3.
    The internal tables to populate these TABLES are
    ( passing from Print program ).
                t_M1,
                t_M2,
                t_M3
    The Number of FIELDS vary in all the tables ,thats why I have created 3 internal tables for Diff Material Types.
    But only first TABLE is getting printed ie data inside TableM2, TableM3 are not getting printed.
    Can any SMARTFORM Gurus please let me know how I can solve this issue.
    Regards
    Avi

    Hi,
       Check whether you are mentioning any condition on the data. There are different possibilites of not getting printed. Like the way your displaying, data is in table.
    Can you please clearly mention how did you populated the internal table and kept the logic to print the values in the table. So that it problem would be  more clearly nown.
    Br,
    Laxmi

Maybe you are looking for