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: 

2 select in same program

Former Member
0 Kudos

hi

1) condition to retrieve lifnr land1 name1 ort01 from TABLE LFA

COndtion1 : lifnr = i_tmp-lifnr (lifnr = Account Number of Vendor or Creditor)

SELECT lifnr land1 name1 ort01

FROM lfa1

INTO TABLE i_lfa1

FOR ALL ENTRIES IN i_tmp

WHERE lifnr = i_tmp-lifnr.

IF sy-subrc EQ 0.

SORT i_lfa1 BY lifnr.

ENDIF.

2 )condition to retrieve LIFNR name1

COndition2 :

-


First retrieve shipment to which delivery is assign (SELECT tknum from VTTP where i_tmp-lfsnr=VTTP-VBELN)

-


second retrieve agent to which shipment No is assign (SELECT TDLNR from VTTK where tknum = VTTP-tknum)

-


third retrieve name to which agent No is assign (Select name1 from LFA1 where tdlnr = VTTK-tdlnr)

I have two condition as indicated above and i already done the select as per condition (1) with delivery number

not i have the condition (2) with agent number requirement to meet normally we don't do select in table LFA1 twice in same program because of performance?

it seem i don't have a choice here can anyone adivse of other possibility

1 ACCEPTED SOLUTION

former_member404244
Active Contributor
0 Kudos

Hi,

already u r retrieveing NAME1 from first select query for that particular lifen,i think thats enough..no need for second select query..

Regards,

Nagaraj

9 REPLIES 9

Former Member
0 Kudos

hi,

retrive the TDLNR field from the first select statement in condition 1.

loop through this internal table and read the VTTK table compare the TDLNR fields and modify the internal table. in this case you no need to write two select statement.

Regards,

Venkata Narayana

0 Kudos

but there is no TDLNR in table LFA

former_member404244
Active Contributor
0 Kudos

Hi,

already u r retrieveing NAME1 from first select query for that particular lifen,i think thats enough..no need for second select query..

Regards,

Nagaraj

0 Kudos

But it's not the same condition

1)as per vendor/creditor account

2)as per agent number

0 Kudos

Hi,

yes u r ryt...... TDLNR is not thre in LFA1,so u cannot write ur second select query on LFA1,,what i think is TDLNR is nothing but LIFNR ONLY.

Regards,

Nagaraj

Former Member
0 Kudos

if there is no TDLNR field in LFA1 table how you are using the below condition..

-


third retrieve name to which agent No is assign (Select name1 from LFA1 where tdlnr = VTTK-tdlnr)

Regards,

Venkata Narayana

Former Member
0 Kudos

TDLNR is nothing but vendor number(LIFNR).

Regards,

Venkata Narayana

Former Member
0 Kudos

yes you are correct

-


third retrieve name to which agent No is assign (Select name1 from LFA1 where LIFNR = VTTK-tdlnr)

but i am not sure it's the same . the first condition is about LFA1-LIFNR = account nu of vendor or creditor

second condition is on LFA1-LIFNR = Agent number in TDLNR

0 Kudos

it's same.....

you cna go ahead and use the LIFNR field... for TDLNR...

Regards,

Venkata Narayana