Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Dump is comming

Former Member
0 Kudos

Hi Expert,

As i am getting dump with the below code .cany any one suggest me what to do.

if sy-subrc = 0.

sort lt_0000.

select * FROM pa0001 INTO TABLE lt_0001 FOR ALL ENTRIES IN lt_0000 WHERE pernr eq lt_0000-pernr AND abkrs ne 'FP' or abkrs ne 'Z1'

AND endda eq '99991231'.

endif.

Regards,

mdaddu

Moderator message: please use more descriptive subject lines for your posts.

Edited by: Thomas Zloch on Aug 7, 2011 9:46 PM

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

I can't understand how people can help you without to know which kind of dump occurs

Dump is very generic word, several kind of dump can occur in a sql selection but which is yours?

In your selection I can see only one error in WHERE condition:

WHERE pernr eq lt_0000-pernr
     AND abkrs ne 'FP' or abkrs ne 'Z1'    "<------It's always true
    AND endda eq '99991231'.

If ABKRS is equal to FP then it's not equal to Z1 and if it's equal to Z1 then it's not equal to FP: that means this condition will be always true.

Tou have to use AND instead of OR

For the dump......assumptions only (I'm not a magician): perhaps your problem is in the target workarea because its structure is not the same of the table source; perhaps too many records are loaded in your internal table.....but perhaps it's better you give us more details

Max

6 REPLIES 6

deepak_dhamat
Active Contributor
0 Kudos

Hi ,

if sy-subrc = 0.
sort lt_0000.

select * FROM pa0001 INTO TABLE lt_0001 FOR ALL ENTRIES IN lt_0000 WHERE pernr eq lt_0000-pernr AND abkrs ne 'FP' or abkrs ne 'Z1'
AND endda eq '99991231'.
endif.

Write Like this

if sy-subrc = 0.

sort lt_0000 .

select * FROM pa0001 INTO CORRESPONDING FIELDS OF TABLE lt_0001 
 FOR ALL ENTRIES IN lt_0000
WHERE pernr eq lt_0000-pernr 
AND  ( abkrs ne 'FP' or abkrs ne 'Z1' )
AND endda eq '99991231'.
endif.

Problem in your code was that when you are moving data to another table the fields type were not matching

as it will copy data in order type of columns in your declaration .

so need to add Corresponding fields of table

regards

Deepak.

Former Member
0 Kudos

Hi,

Modify your code like:

if sy-subrc = 0.

sort lt_0000.

select * 
           FROM pa0001 
           INTO TABLE lt_0001 
           FOR ALL ENTRIES IN lt_0000 
           WHERE pernr eq lt_0000-pernr 
           AND abkrs not in ( 'FP' , 'Z1' )
           AND endda eq '99991231'.

endif.

BR

Dep

Clemenss
Active Contributor
0 Kudos

Hi MdAddu

if sy-subrc = 0.
  sort lt_0000.
  select * 
*  INTO TABLE lt_0001 
  INTO CORRESPONDING FIELDS OF TABLE lt_0001 " ALWAYS!
  FROM pa0001 
  FOR ALL ENTRIES IN lt_0000 
  WHERE 
    pernr eq lt_0000-pernr AND abkrs ne 'FP' or 
    abkrs ne 'Z1' AND endda eq '99991231'.
endif.

[How to post code in SCN, and some things NOT to do...|;

Yolu did not format your coide, you did not say where or why or what kind of dump occurs, you did not give valuable informatuon as i.e. the definition of lt_0001.

You could ask Santa Claus as well.

Regards

Clemens

Former Member
0 Kudos

Hi

I can't understand how people can help you without to know which kind of dump occurs

Dump is very generic word, several kind of dump can occur in a sql selection but which is yours?

In your selection I can see only one error in WHERE condition:

WHERE pernr eq lt_0000-pernr
     AND abkrs ne 'FP' or abkrs ne 'Z1'    "<------It's always true
    AND endda eq '99991231'.

If ABKRS is equal to FP then it's not equal to Z1 and if it's equal to Z1 then it's not equal to FP: that means this condition will be always true.

Tou have to use AND instead of OR

For the dump......assumptions only (I'm not a magician): perhaps your problem is in the target workarea because its structure is not the same of the table source; perhaps too many records are loaded in your internal table.....but perhaps it's better you give us more details

Max

0 Kudos

Hi Expert's

My problem is solved thank's to everyone.

Regards,

mdaddu.

0 Kudos

Hi Max,

AND has higher prority then OR, so I thought

WHERE 
    pernr eq lt_0000-pernr AND abkrs ne 'FP' or 
    abkrs ne 'Z1' AND endda eq '99991231'.

is the same as

WHERE 
    ( pernr eq lt_0000-pernr AND abkrs ne 'FP'  ) or 
    ( abkrs ne 'Z1' AND endda eq '99991231' ).

Though it's hard to understand why he wants to select all records for PERNR in table lt_pernr for all ABKRS except FP and additionally all data from all ABKRS except Z1 with and ENDDA that is not limited ('99991231' ).

[Search Condition (search_condition) Locate this document in the navigation structure|http://help.sap.com/saphelp_nw73/helpdata/en/45/4c3b3046991798e10000000a1553f6/frameset.htm]

Here is the (abstract) explanation: 'pernr eq lt_0000-pernr' is a comparison_predicate that counts as boolean factor. boolean factors combined with AND for a boolean_term, boolean_terms can be combined with OR to count as search_condition. The evaluation goes from predicates to terms to factors to condition.

I thinks it is good practice to use brackets to make it clear at first glance - but this is not always necessary for evaluation of terms.

Regards

Clemens