Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to re-use a dynamically created column in a select statement for calculation?

Hi guys,

I was wondering how can I reuse a dynamically created column ("qty" in this case) in a select statement for calculation?

Example as below:

  lt_mat = SELECT m.matnr, m.charg,

                  ( SELECT total_qty FROM :lt_quantity

                                    WHERE matnr = m.matnr

                                      AND werks = m.werks

                                      AND lgort = m.lgort

                                      AND charg = m.charg ) AS "qty",

                  CASE

                    WHEN qty > 0

                        THEN

                            m.clabs - qty

                        ELSE

                           0

                  END AS quant,

I get the error: SQLSCRIPT Message: invalid column name: QTY as a result.

Thanks,

Sam

Tags:
Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question