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: 

Anyone know what this code is doing?

Former Member
0 Kudos
189

Howdy,

Don't suppose ya know what this code could be doing:

TABLES: nast,

*nast.

SELECT * FROM *nast

WHERE kappl = nast-kappl

AND objky = nast-objky

AND kschl = nast-kschl

AND spras = nast-spras

AND parnr = nast-parnr

AND parvw = nast-parvw.

IF *nast-vstat = 1.

processed = 'X'.

ENDIF.

ENDSELECT.

CHECK processed NE 'X'.

Its got me stumped! what on earth is *NAST?

Are we simply looping through all the entries in NAST???

Basically I came across this code because I am trying to write a program that gets triggered when the user saves a Debit note.

My program should then take the billing document number that was saved and use it to create a credit memo request, but finding the billing document number was a pain and someone told me that I had to use NAST or something...

ANyhow, I came a cross the following code but it doesn't make sense...

I think it should be

TABLES: nast.

data: wa_nast type NAST.

SELECT single * FROM nast into wa_nast

WHERE kappl = nast-kappl

AND objky = nast-objky

AND kschl = nast-kschl

AND spras = nast-spras

AND parnr = nast-parnr

AND parvw = nast-parvw.

IF nast-vstat = 1.

processed = 'X'.

ENDIF.

What do you all think?????

5 REPLIES 5

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
143

NAST is a table that is used for output(printing of documents). You usually see this in print programs for SAPscripts. I think someone has led you down the wrong path.

Regards,

Rich Heilman

0 Kudos
143

Thanks Rich,

May be you are right or may be I didn't amke myself clear.

I think my program will be connected to the output type via transaction NACE. Then whenever the user saves a debit memo it will trigger the output type and this should then trigger my program to produce the BDC based on the billing document number in the debit memo.

I thought this would be passed into nast-objkey and I thought I would write an entry routine that could be placed in NACE that access my program.

AM I correct in thinking that this would work????

0 Kudos
143

Oh...ok, Yep, I think that that would work. Was your question really more related to the code of the select statement in reqard to *nast. If so, the *Nast is really only a work area. I believe that is was done a lot in R/2.

Regards,

Rich Heilman

christian_wohlfahrt
Active Contributor
0 Kudos
143

Hi Steve,

yes, I agree: your select single ... should bring same result as this select ... endselect code.

But going one step further: isn't NAST read (completly and directly!) before calling this program part? Should be possible to test nast-vstat = 1 without additional select.

Regards,

Christian

P.S.: Got the feeling to translate word by word, sorry for this grammar.

Former Member
0 Kudos
143

The ability to put an asterisk in front of the name is indeed a feature carried over from R/2. It solves the problem of allowing you to create a second TABLEs work area based on a dictionary definition. You could think of it as TABLES: *NAST type NAST.

The memory for TABLES is handled differently than the memory for DATA so that is why you might want more than one work area in the TABLES space based on a common structure.