2016 Sep 27 8:44 AM
Hi,
I am working on a SAP query and using some ABAP code in a field, I have the following code:
The problem I have is I need to sort the data by the LFMON field and get the last record, can you tell me what change I need in the above code?
thanks
2016 Sep 27 3:12 PM
Hi,
In the INFOSET-> Code tab-> DATA,
Declare the Internal table for MBEWH.
DATA: i_MBEWH TYPE STANDARD TABLE OF MBEWH,
wa_meewh type MBEWH.
Save it.
In Record Processing of Code tab.
tables: MBEWH.
clear Z_MBEWH_LFMON.
select * from MBEWH
Into i_MBEWH
Where
MATNR = MBEW-MATNR
and
BWKEY = MBEW-BWKEY
and
LFGJA = Z_MBEWH_LFGJA.
Z_MBEWH_LFMON = MBEWH-LFMON.
Sort i_MBEWH by LFMON.
If you are writing your code in DATA red. prog Tab, then just copy the above code logic directly to it.
Regards,
EH
2016 Sep 27 3:12 PM
Hi,
In the INFOSET-> Code tab-> DATA,
Declare the Internal table for MBEWH.
DATA: i_MBEWH TYPE STANDARD TABLE OF MBEWH,
wa_meewh type MBEWH.
Save it.
In Record Processing of Code tab.
tables: MBEWH.
clear Z_MBEWH_LFMON.
select * from MBEWH
Into i_MBEWH
Where
MATNR = MBEW-MATNR
and
BWKEY = MBEW-BWKEY
and
LFGJA = Z_MBEWH_LFGJA.
Z_MBEWH_LFMON = MBEWH-LFMON.
Sort i_MBEWH by LFMON.
If you are writing your code in DATA red. prog Tab, then just copy the above code logic directly to it.
Regards,
EH
2016 Sep 27 4:10 PM
Hi,
I have copied the above into my query and now I get the message:
You cannot use an internal table as a work area.
2016 Sep 28 6:54 AM
I hope you are updating the Code to the Infoset.
Please share the screenshot, so that I can help you in solving your issue.
2016 Oct 05 3:20 PM