Skip to Content

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

Queries from the same table, but, different row

Hi, all.

Kindly need your help to write the queries statement,

I have table as below, I want to copy the TRFNO to RFMBELNR based on rfwtno = wtno

I did try to code like this:

DATA: lt_zmmtwinfd TYPE STANDARD TABLE OF zmmtwinfd.

CLEAR: lt_zmmtwinfd.

     SELECT trfno

       INTO TABLE lt_zmmtwinfd

       FROM zmmtwinfd

       WHERE rfwtno = zmmtwinfd-wtno.

     UPDATE zmmtwinfd

        SET pytp = zmmtwinfd-pytp

            pyamt = zmmtwinfd-pyamt

            netwt = zmmtwinfd-netwt

            trfno = zmmtwinfd-trfno

            rfmbelnr = zmmtwinfd-trfno 

            zremk = zmmtwinfd-zremk

            rfwtno = zmmtwinfd-rfwtno 

            pymid = '0'

      WHERE wtno = zmmtwinfd-wtno.

Your kindness is most appreciated.

Thanks and Regards

Liyana

Former Member

Helpful Answer

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