cancel
Showing results for 
Search instead for 
Did you mean: 

select statement issue......

Former Member
0 Kudos

Hi All,

I am working with module pool programm.

I written code like this

SELECT * FROM vbfa WHERE vbeln EQ vbfa-vbeln

AND vbtyp_n EQ c_vbtyp_n

AND vbtyp_v EQ c_vbtyp_v.

endselect.

in this code vbeln is follow-on document based on this it retrieves preceding documents (vbelv's) .

as per above code it retrieves last vbelv ..it is working fine .

but, in production system it selects first one only..

means i'll give any level of invoice in selection-screen..it gives initial one(vbelv) only...

plz anybody provide the solution very very slowly while I read [the rules|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement].

rgrds...

Edited by: Julius Bussche on Sep 1, 2008 8:42 AM

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi,

Your select query was as follows;

SELECT * FROM vbfa WHERE vbeln EQ vbfa-vbeln

AND vbtyp_n EQ c_vbtyp_n

AND vbtyp_v EQ c_vbtyp_v.

endselect.

But the syntax is :

SELECT * FROM vbfa

INTO <itab>

WHERE vbeln EQ vbfa-vbeln

AND vbtyp_n EQ c_vbtyp_n

AND vbtyp_v EQ c_vbtyp_v.

endselect.

where itab is an internal table that you have to declare using DATA command.

Hope this helps.

Thanks,

rashmi.

Former Member
0 Kudos

Hi Naresh,

Actually I designed one transaction with selection screen , it contains invoice as I/p field..based on this it selects respective delivery number..means plz see the below sd document flow:

Sales order

Delivery one

Invoice one

Sales order two

Delivery two

Invoice twou2026like this ..here can I give invoice two it will be give delivery twou2026

(or) will I give invoice one ..then it will give invoice one..

for the above requirement I written that code ..that is working fine in dev-system, but in production system for any irrespective invoice number it gives only delivery one..

Former Member
0 Kudos

Hi ranadheer,

You dont have to write select query on your own, use Function module RV_ORDER_FLOW_INFORMATION, read its documentation.

And Sample Report Program code can be found @ below links,

[Read sales document flow using a function module|http://learningabap.wordpress.com/2007/03/28/read-sales-document-flow-using-a-function-module/]

[Sales Order Flow u2013 Tree Report|http://www.erpgenie.com/abap/SalesOrderFlow.htm]

Hope the above code will help you for sure....

Regards

Karthik D

narin_nandivada3
Active Contributor
0 Kudos

Hi Ranadheer,

Welcome to SDN..

You extract all the data into an internal table and then use that internal table for further process..

Then you would get that correctly.

Select * from <table> into <itab> where <cond>

<table> -- Any Dictionary table

<itab> -- Internal table like standard table of dictionary table.

Hope this would help you.

Good luck

Narin

Former Member
0 Kudos

Hi,

Can you be more clear on your question?

Regards,

Naresh Durki