cancel
Showing results for 
Search instead for 
Did you mean: 

Problem trying to extract records from VBFA on Smartform.

Former Member
0 Kudos

Hello

I'm attempting to extract records from the table VBFA and my inexperience with Smartforms is start to show.

I only want to have 1 record per handling unit. I'm extracting using VBELV, VBELN and VBTYP_N via SELECT * FROM VBFA.

However this gives me multiple records per handling unit. There is no further field available on the record to make it unique. This is were my inexperience comes in. How do I perform the read of VBFA without using SELECT.?

Regards

Mike.

Accepted Solutions (1)

Accepted Solutions (1)

brad_bohn
Active Contributor
0 Kudos

Hardcode the '000000' for the item fields of the primary key in the SELECT statement as well, assuming you have links at the header level. Otherwise, if this is at the item level (handling units), use SELECT SINGLE or EXIT to get a single entry in your form code with the item number of the source document.

Former Member
0 Kudos

Hello Brad,

Thanks for taking the time to reply.

I am accessing the handling units at item level and selecting the records into my own internal table which I will subsequently use to print the handling units and their contents.

If I select single for say the first record in the database using the keys that I have. How do I then select the next subsequent record(s).

Is there no way of manually reading a database table perhaps within a loop. I could compare next record read with previous record then discard is necessary?

Regards

Mike.

brad_bohn
Active Contributor
0 Kudos

You can handle it the same way you would in any program code, either in your initialization tab code or in a code node. Whether that's in a SELECT...ENDSELECT loop with an append for the records you want or a full SELECT into a table then removal or skipping of the records you don't want. I'm guessing your end result needs to be an internal table for a loop node, so you just need to get to that point. Sorry, since I don't know what the trigger is for the SELECT, I can't be exact.

Former Member
0 Kudos

Hello Brad,

You're right, I'm trying to get am internal table to use a loop node.

I'd like to go for the full SELECT into a table then read it and either a skip or ignore a record that is a duplication. I'm not sure of the way to achieve this though. This is the first time I've had to manipulate the data like this. Until now I've had the keys to select the data for me.

I've currently got:

SELECT * FROM VBFA INTO TABLE LT_VBFA

WHERE VBELV = IS_DLV_DELNOTE-HD_GEN-DELIV_NUMB

AND VBTYP_N = 'X'.

Then I have LT_VBFA INTO WA_VBFA in a LOOP node .

There needs to be some thing between the 2 nodes to prune the unwanted duplicates.

Regards

Mike.

brad_bohn
Active Contributor
0 Kudos

Where is your SELECT? Initialization tab or code node? Either way, you can code a subsequent process to prune the dupes, either using SORT/DELETE ADJACENT DUPES or a more complicated process. It would be much easier than doing it while processing the LOOP node and using conditions.

Former Member
0 Kudos

Hello Brad,

Sorry for the delay getting back to you, I was off work yesterday.

I had the SELECT in a program node.

I followed the SORT/DELETE suggestion and it works. Thanks for getting me out of this problem.

Regards

Mike.

Answers (0)