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

Smartforms

former_member612655
Participant
0 Likes
1,627

Hi Experts,

My requirement is based on the sales document number i need to display all material details. for that i designed a query as shown in below. But problem is i am getting only single material details repeatedly as shown in above fig. Can you please help to resolve this problem by getting all material details based corresponding so number

SELECT single

*VBELN

MATNR

ARKTX

MEINS

netpr

kwmeng

netwr

mwsbp

FROM VBAP

INTO  wa_vbap

*for all entries in wa_vbak

WHERE  VBELN = I_vbeln.

Regards,
Bhavani.
9 REPLIES 9
Read only

former_member1716
Active Contributor
0 Likes
1,527

bhavani123,

You have written a Select Single Query from VBAP table to get entries, in this case you will only get one entry irrespective of the number of entries in there.

I would recommend you to change your query as below:

SELECT SINGLE
VBELN
MATNR
ARKTX
MEINS
netpr
kwmeng
netwr
mwsbp
FROM VBAP
INTO  table @data(lt_vbap)
WHERE  VBELN = I_vbeln.
if sy-subrc eq 0.
SORT LT_VBAP by VBELN MATNR.
endif.

The above query will have all the materials related to the Sales order in the internal table LT_VBAP, now you just loop the table inside the smartform and map the fields accordingly so that during each iteration all the line items are picked progressivley.

Regards!

Read only

0 Likes
1,527

Thank you Sathish Kumar

Read only

0 Likes
1,527

But i am getting error like

Field "table" is unknown. It is neither in one of specified tables nor defined by a "Data" Statement. "Data" Statement.

Read only

0 Likes
1,527

bhavani123,

May be because you are using older version, this syntax is only with newer versions.

Recommend you to follow the traditional way declaring the table up front and the use it in your query.

Read only

0 Likes
1,527

Can you please help me by sending the select query because i developed a query as shown in below but still i am getting only single material number details.

SELECT
VBELN
MATNR
ARKTX
MEINS
netpr
kwmeng
netwr
mwsbp
FROM VBAP
INTO table it_vbap
**for all entries in wa_vbak
WHERE VBELN = I_vbeln.

Read only

0 Likes
1,527
satishkumarbalasubramanian Your code doesn't compile, commas are missing and I_VBELN is not prefixed with @.
Read only

0 Likes
1,527

Thanks for the catch sandra.rossi

Hello bhavani123,,

Please find the code below,

SELECT SINGLE
VBELN,
MATNR,
ARKTX,
MEINS,
netpr,
kwmeng,
netwr,
mwsbp
FROM VBAP
INTO  table @data(lt_vbap)
WHERE  VBELN = @I_vbeln.
if sy-subrc eq 0.
SORT LT_VBAP by VBELN MATNR.
endif.

Regards!
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,527

How can you tell that the error is from this particular query and not from anywhere else? (maybe the fault is from the loop or the smart form or between them).

Read only

Chintu6august
Contributor
0 Likes
1,527

Hi,

Clear work area before your select query.