Application Development and Automation 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: 
Read only

getting dump while quering BSEG

Former Member
0 Likes
1,280

Hi All,

I am quering bseg table to get tax jurisdiction code and code is:

loop at itab

SELECT SINGLE TXJCD FROM BSEG INTO C_TXJCD

WHERE

BUKRS = it_tab-BUKRS AND

GJAHR = P_RYEAR AND

GSBER = itab-gsber AND

HKONT = it_itab-hkont.

endloop.

but getting dump, could you please suggest a way to avoid dump

Thanks and appreciate you help

jog

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,209

Hi

Which dump?

U should use BSIS and/or BSAS table instead of BSEG, if you need to do a query for the G/L items

Max

11 REPLIES 11
Read only

Former Member
0 Likes
1,209

Hi,

what is the dump you are getting??

also did you declare c_txjcd like bseg-txjcd.

DATA: C_TXJCD LIKE BSEG-TXJCD.

Thanks,

Naren

Read only

Former Member
0 Likes
1,210

Hi

Which dump?

U should use BSIS and/or BSAS table instead of BSEG, if you need to do a query for the G/L items

Max

Read only

0 Likes
1,209

HI,

Iam getting time out error,

I need jurisdiction code field based on the selection fields

Thanks

jog

Read only

0 Likes
1,209

You have to do as Max says - go to BSIS and BSAS. That will give you BUKRS, BELNR, GJAHR and BUZEI. Then, if you need a field in BSEG or BKPF that is not in BSIS or BSAS, you use these fields to do a fully indexed select (on BKPF or BSEG) to get the field.

Rob

Read only

0 Likes
1,209

Rob,

Thanks for that,

one more question

do I need to put mandt field while querying BSEG, to make it unique,

Please suggest and also can I add other (non key fields ) in querying bseg and how does it effect.

Thanks

jog

Read only

0 Likes
1,209

Hi

No you don't! The client (MANDT) is automatically used by the system because it know in which client you're querying the table.

U should only specified the client only if you need to query a table of another client.

If you need to improve the performance of reading using no key fields, you should create a new index (trx SE11) for them.

Max

Read only

0 Likes
1,209

You can add other non-key fields to the select on BSEG, but since you have all the primary keys, it won't help much.

Since BSEG is a cluster table, I don't think it's possible to put an index on it.

Rob

Read only

Former Member
0 Likes
1,209

Hi,

try in this way

DATA: C_TXJCD LIKE BSEG-TXJCD.

loop at itab

SELECT SINGLE TXJCD INTO C_TXJCD FROM BSEG INTO C_TXJCD

WHERE

BUKRS = it_tab-BUKRS AND

GJAHR = P_RYEAR AND

GSBER = itab-gsber AND

HKONT = it_itab-hkont.

endloop.

Read only

SantoshKallem
Active Contributor
0 Likes
1,209

try to avoid loop for select statment and that to for BSEG.

go for any other way.

reward if useful

Read only

Former Member
0 Likes
1,209

Hi,

Add this code also after select query.

IF Sy-SUBRC <> 0.

CLEAR C_TXJCD.

ENDIF.

If data is not available in the system, sometimes select query also creates short dump.

Ashven

Read only

0 Likes
1,209

Your query was going against all of BSEG. This will not change if you add BSAD/BSID into the game. It will just speed things up a bit...

What you really need to do is work with the functional side of the business to be able to limit the data (either in time or better in time and document type etc...)

Note that a full year of data may be waaay tooo much for a table like BSEG...

This will allow you to go against a finite chunck of data instead of dealing with an ever growing sample.

Enjoy