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: 

smartform

Former Member
0 Kudos

Hi,

I have a requirement to print customer PO number based on the delivery number in the o/p of the smartform.

One devlivery may have many sales order numbers and each sales order number will have different customer PO numbers.

I am able to get delivery numbers into workarea ls_stages-vbeln.

In debugging mode I can see the values of delivery numbers 0800004170 0800004171 in vbeln field.If I want to get the customer PO numbers for each of these delivery numbers I need to loop through vbeln field.How can I do that?

Regards,

Hema

4 REPLIES 4

Former Member
0 Kudos

Hi,

You can create a loop in the smartform for a table. You can display the value of the current loop pasYou can write a code in smartform before the node where you want to display the values.

Add a code for selecting all the customer PO numbers based on delivery numbers. in codes there will be IN and OUT parameters. You can pass the delivery internal table in IN parameter and get the customer PO number in OUT parameter.

Add a loop in the smartform for the table which holds the customer PO numbers. Inside the loop add the TEXT and display the customer PO and end the loop.

So one text will be created in the output of the smartform for each customer PO.

Right click on the window and create CODE and LOOP.

Reward points if helpful.

Thanks and Regards,

Lakshmi.

0 Kudos

Hi,

I have tried to use loop in my program.But I am getting customer PO number for only first delivery.

Actually in debugging mode delivery numbers are coming in 2 separate loops. In the 1st loop 0800000992 , 0800001374 , 0800001708 , 0800001752 , 0800001753 , 0800001766 , 0800001765 , 0800001781 , 0800001783 , 0800001847 , 0800001455 these numbers are getting displayed.

In the second loop 0800001331 , 0800001377 , 0800003162 , 0800003149 these values are getting displayed.

But in the o/p only 0800001331 , 0800001377 , 0800003162 , 0800003149 these values are displayed.So I need to get the customer PO numbers for all these delivery numbers.But the o/p is showing cust po number 'multiple pick' for delivery number 0800000992 twice.This is wrong.

Can you suggest me another solution for this?

Former Member
0 Kudos

You can create a loop in the smartform for a table. You can display the value of the current loop pasYou can write a code in smartform before the node where you want to display the values.

Add a code for selecting all the customer PO numbers based on delivery numbers. in codes there will be IN and OUT parameters. You can pass the delivery internal table in IN parameter and get the customer PO number in OUT parameter.

Add a loop in the smartform for the table which holds the customer PO numbers. Inside the loop add the TEXT and display the customer PO and end the loop.

So one text will be created in the output of the smartform for each customer PO.

Right click on the window and create CODE and LOOP.

Former Member
0 Kudos

Hi,

It seems like you are getting delivery number also in a loop. You must write the Customer PO selection loop inside this delivery selection loop.

what is happening now is, First it gets the delivery numbers in the first loop. and executes the same code again for getting the second set of delivery numbers. May be the second value overwrites your first set values in the internal table.

And then it starts the loop for customer PO. Now only 4 delivery numbers are available which is the output of the second loop.

Loop inside the first loop will solve your problem. If that is not possible, In the delivery selection logic, keep appending the entries in each loop pass. so that all delivery numbers are available in an internal table.

Reward points for all helpful answers.

Thanks and Regards,

Lakshmi.