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

Problem in select query

Former Member
0 Likes
1,350

Hi Friends

I am using a table a981 and fetching data in internal table but the table has a fieil Country whose technical name is ALAND in dev and LAND1 in production.Now i cannot use LAND1 as it wont let me to activate the report and if i use ALAND i cannot move the request to production as it fails. So how can i achive dynamic table field in the select query based on server.My query is-


 select kschl
           wkreg
           matnr
           knumh
   from a981 into corresponding fields of table it_a981
   for all entries in it_marc where matnr = it_marc-matnr
                                and kschl in ('MWST','ZSER')
                                and aland = 'IN'
                                and datab le sy-datum
                                and datbi ge sy-datum. 

I need to make aland dynamic.Pls suggest

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
1,217

A981 is your own custom pricing condition table, it seems that the configuration is not consistent accross the system landscape. You should check with your functional consultants to set this straight, rather than working around the problem.

Thomas

8 REPLIES 8
Read only

ThomasZloch
Active Contributor
0 Likes
1,218

A981 is your own custom pricing condition table, it seems that the configuration is not consistent accross the system landscape. You should check with your functional consultants to set this straight, rather than working around the problem.

Thomas

Read only

anesh_kumar
Active Participant
0 Likes
1,217

HI

check SY-SYSID field before executing your select query

if it is prd maintain your selection using land1 else your regular select query

Regards

Read only

Former Member
0 Likes
1,217

Use the OR condition in your select query i.e (ALAND = IN' ' or LAND1 = 'IN'.)

I hope it will work, but as suggested the field names shhould be identical in development and production.Please chk with functionla consultanat before making the changes.

Read only

Former Member
0 Likes
1,217

If you insist on having a workaround, you could always create dynamic WHERE conditions.


DATA: cond TYPE string.

IF sy-sysid EQ <your dev sysid>.
    cond = 'matnr = it_marc-matnr
            and kschl in (''MWST'',''ZSER'')
            and datab le sy-datum
            and datbi ge sy-datum'
            and land1 = ''IN''.
ELSE.
    cond = 'matnr = it_marc-matnr
            and kschl in (''MWST'',''ZSER'')
            and datab le sy-datum
            and datbi ge sy-datum'
            and aland = ''IN''.
ENDIF.

select kschl
           wkreg
           matnr
           knumh
   from a981 into corresponding fields of table it_a981
   for all entries in it_marc where (cond).

--

Kyle

Read only

Former Member
0 Likes
1,217

Strange problem, but I think that you must use same FIELD NAME for your object both in DEV and PROD, otherwise it will not work.

Read only

Former Member
0 Likes
1,217

Check with functional, if table field could be changed or not?

Else

Dynamic select query with dynamic where condition can be used whihc kYle has mentioned clearly.

Create the where clause based on SYSID and try it out.

SELECT (FIELD_TAB)

FROM (TABLENAME)

WHERE (WHERE_TAB)

Read only

0 Likes
1,217

Hello,

please check for the versions of the table and try and correct the field names...seems like you have missed out with some transport...this kind of scenario is very weird..When ur working in a real time scenario then the Development Objects in all the relevant systems across the landscape should be in sync... so it cannot be that the fieldname in Developement and Production system would be different...

@gurus: when somebody has posted a question...please guide him in the right direction..what I mean to say is thr can be multiple solutions for an issue but then we have something called best practices which should be adhered to...

Regards,

Sitakant

Edited by: Sitakant Tripathy on Sep 13, 2010 5:10 PM

Read only

Former Member
0 Likes
1,217

Hi i got the solution...These tables are custom and generated by SD functional....The table A980 and A981 is regenerated in production with same field name. Thank You Thomas