Skip to Content
author's profile photo Former Member
Former Member

sorted table problem.

My program is dumping while assinging 9767297 records from gt_kna1_ext to lt_kna1_ext by saying TSV_TNEW_PAGE_ALLOC_FAILED.

lt_kna1_ext[] = gt_kna1_ext[].

I have declared as

TYPES : BEGIN OF t_kna1_ext,

kunnr TYPE kunnr,

name2 TYPE name2_gp,

j_3astcu TYPE j_3astcu,

sales_org TYPE vkorg,

sold_to TYPE kunnr,

END OF t_kna1_ext.

DATA : gt_kna1_ext TYPE TABLE OF t_kna1_ext,

-


in subroutine declared as sorted table becasue later it has to be used to select from knvp table.

DATA : lt_kna1_ext TYPE SORTED TABLE OF t_kna1_ext WITH NON-UNIQUE KEY sold_to sales_org kunnr.

here while assiging dumping

lt_kna1_ext[] = gt_kna1_ext[].

DELETE ADJACENT DUPLICATES FROM lt_kna1_ext COMPARING sold_to sales_org kunnr.

*-KNVP table read----


IF NOT gt_kna1_ext[] IS INITIAL.

SELECT kunnr

vkorg

spart

parvw

kunn2

FROM knvp

INTO TABLE gt_knvp

FOR ALL ENTRIES IN lt_kna1_ext

WHERE kunnr = lt_kna1_ext-sold_to

AND vkorg = lt_kna1_ext-sales_org

AND spart = gc_01

AND parvw = gc_we

AND kunn2 = lt_kna1_ext-kunnr.

REFRESH : lt_kna1_ext.

LOOP AT gt_kna1_ext INTO gs_kna1_ext.

LOOP AT gt_knvp INTO wa_knvp

WHERE kunn2 = gs_kna1_ext-kunnr

AND vkorg = gs_kna1_ext-sales_org.

wa_knvp-j_3astcu = gs_kna1_ext-j_3astcu.

wa_knvp-name2 = gs_kna1_ext-name2.

MODIFY gt_knvp FROM wa_knvp

TRANSPORTING j_3astcu name2

WHERE kunnr = wa_knvp-kunnr

AND kunn2 = wa_knvp-kunn2

AND vkorg = wa_knvp-vkorg

AND spart = wa_knvp-spart

AND parvw = wa_knvp-parvw.

ENDLOOP. " LOOP AT gt_knvp INTO wa_knvp

ENDLOOP. " LOOP AT gt_kna1_ext INTO gs_kna1_ext.

ENDIF. " IF NOT gt_kna1[] IS INITIAL.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    Posted on Dec 19, 2008 at 06:05 AM

    Hello,

    A few points:

    1. Why do you need to declare lt_kna1_ext as a SORTED TABLE??

    Did you write :

    SORT gt_kna1_ext BY sold_to sales_org kunnr statement i your code?

    2. The below code will also serve your purpose.

    
    DATA : lt_kna1_ext TYPE t_kna1_ext.
    
    lt_kna1_ext[] = gt_kna1_ext[].
    
    SORT lt_kna1_ext BY sold_to sales_org kunnr.
    
    DELETE ADJACENT DUPLICATES FROM lt_kna1_ext COMPARING sold_to sales_org kunnr.
    

    Hope this helps.

    BR,

    Suhas

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 18, 2008 at 10:33 PM

    HI Sam,

    Please modify below statement which is between LOOP .. ENDLOOP construct.

    MODIFY gt_knvp FROM wa_knvp

    TRANSPORTING j_3astcu name2

    WHERE kunnr = wa_knvp-kunnr

    AND kunn2 = wa_knvp-kunn2

    AND vkorg = wa_knvp-vkorg

    AND spart = wa_knvp-spart

    AND parvw = wa_knvp-parvw.

    Instead of above statement, please use READ <Internal table> with BINARY SEARCH. then modify the internal table contents. Which does not use memory and works quicker to execute.

    Let me know if you have further questions.

    Best Regards,

    Krishna

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2008 at 12:27 AM

    Hi Sam,

    Don't use Nested loops.

    use read statement in place of second Loop.

    before using read statement use can sort the internal table by key fields.

    finally the statement will be as followed

    clear : gt_knvp.

    sort gt_knvp by kunnr sales_org.

    LOOP AT gt_kna1_ext INTO gs_kna1_ext.

    read table gt_knvp with kunn2 = gs_kna1_ext-kunnr

    vkorg = gs_kna1_ext-sales_org binary search.

    if sy-subrc = 0,

    wa_knvp-j_3astcu = gs_kna1_ext-j_3astcu.

    wa_knvp-name2 = gs_kna1_ext-name2.

    MODIFY gt_knvp FROM wa_knvp

    TRANSPORTING j_3astcu name2

    WHERE kunnr = wa_knvp-kunnr

    AND kunn2 = wa_knvp-kunn2

    AND vkorg = wa_knvp-vkorg

    AND spart = wa_knvp-spart

    AND parvw = wa_knvp-parvw.

    endif.

    ENDLOOP. " LOOP AT gt_knvp INTO wa_knvp

    try with the above code.

    Regards

    Sreeni

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2008 at 05:54 AM

    offcourse thanks for your explanation.

    My program is basically giving dump at

    lt_kna1_ext[] = gt_kna1_ext[].

    Kindly read my initial explanation ad suggest me.

    THANKS IN ADVANCE

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2008 at 05:57 AM

    Hi Sam,

    Confirm the structure of both internal table is same.

    Number of fileds should be same.

    Regards,

    Flavya

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 19, 2008 at 06:00 AM

    You've run out of memory. You either need to talk to basis to get more memory, or change your program to use less memory - selecting less data at one time. Did you try searching on "TSV_TNEW_PAGE_ALLOC_FAILED".

    matt

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2008 at 06:09 AM

    It is dumping at

    lt_kna1_ext[] = gt_kna1_ext[].

    I mean not even assigning.

    not going to sort stmt at all

    Add a comment
    10|10000 characters needed characters exceeded

    • You know where it dumps, and from my previous answer, you know why.

      You need to redo this bit

      lt_kna1_ext[] = gt_kna1_ext[].
      DELETE ADJACENT DUPLICATES FROM lt_kna1_ext COMPARING sold_to sales_org kunnr.

      As there isn't enough memory allocated to hold BOTH tables. If lt_kna1_ext turns out to not contain too many records, this might work.

      DATA : lt_kna1_ext TYPE SORTED TABLE OF t_kna1_ext WITH UNIQUE KEY sold_to sales_org kunnr,
            ls_kna1_ext TYPE t_kna1_ext.
      
      LOOP AT gt_kna1_ext INTO ls_kna1_ext.
        READ TABLE lt_kna1_ext WITH TABLE KEY sold_to = ls_kna1_ext-soldto sales_org = ls_kna1_ext-sales_org kunnr = ls_kna1_ext-kunnr TRANSPORTING NO FIELDS.
        CHECK sy-subrc IS NOT INITIAL.
        INSERT ls_kna1_ext INTO TABLE lt_kna1_ext.
      ENDLOOP.

      I've changed the local definition to a UNIQUE key. It might be more efficient to define it as a HASHED table, but I can't remember if that works with "FOR ALL ENTRIES".

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.