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

Slow SQL from PRPS via OBJNR

Former Member
0 Likes
955

Hi sirs,

I have extract the WBS element for certain ASSET numbers, sample sql below. since objnr is not a primary key my sql is very slow, is there a way to convert an internal wbs number (anla-posnr) to a WBS element? because prps-pspnr is displayed differently from what is stored i cannot use it in my select statement

SELECT SINGLE * FROM anla.

IF sy-subrc = 0.

CONCATENATE 'PR' anla-posnr INTO objnr.

SELECT SINGLE * FROM prps WHERE objnr = objnr.

WBSelem = PRPS-POSID.

endif.

thanks in advance

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
706

Hi,

You can convert ANLA-POSNR to external WBS .

please check the conv routine CONVERSION_EXIT_ABPSP_OUTPUT

http://www.erpgenie.com/abaptips/content/view/363/62/

please check ANLA-POSNR domain its have conv,exit associated with it.

aRs

Points are always welcome

3 REPLIES 3
Read only

Former Member
0 Likes
706

please aviod select *

select field1 field2 ...fieldn single into correspoing fields of table itab from dbtable.

Read only

former_member194669
Active Contributor
0 Likes
707

Hi,

You can convert ANLA-POSNR to external WBS .

please check the conv routine CONVERSION_EXIT_ABPSP_OUTPUT

http://www.erpgenie.com/abaptips/content/view/363/62/

please check ANLA-POSNR domain its have conv,exit associated with it.

aRs

Points are always welcome

Read only

Former Member
0 Likes
706

Please check at the domain of the WBS element. There will be conversion exita.

Double click on the conversion ext and you will see two FMs _INPUT & _OUTPUT.

This are for internal & external format conversion of WBS element.

Now you use according to the your requirement, example to convert from External to Internal for format use the FM ending with ---INPUT. The export parameter of this FM will be internal format.

Now regarding SQL optimization. Avoid select * <----use the specific field needed.

Also avoid using repeated SELECT statement from the same table. In such case, first option should always if possible --select the whole required records in a internal table.

SELECT <F1> <F2> INTO TABLE itab

FROM []

FOR ALL ENTRIES IN <>

WHERE <> = <>.

Regards,

A.Singh