cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Query / ABAP

wanrooy
Explorer
0 Kudos

Hello,

I want to create a custom field in SAP Query that indicates whether a material has been in the warehouse for more than 6 weeks. The goal is to compare the material's posting date (MSEG.BUDAT_MKPF) with the current date (SY-DATUM) and display an 'X' in the custom field if the material's posting date is 42 days or more in the past (which corresponds to 6 weeks). Otherwise, the field should display an empty value.

Could you please confirm if the code provided below is appropriate for this problem?  I am encountering some challenges with syntax and logical expressions within SAP Query, so I would appreciate any feedback or suggestions you might have. 

IF ( MSEG.BUDAT_MKPF <= SY-DATUM - 42 ).
'X'
ELSE.
''
ENDIF.

Thank you!

Arjan

 

Sandra_Rossi
Active Contributor
0 Kudos
It's not really a question about SAP Query, but a question about ABAP (that you use in the context of SAP Query). ABAP is not SQL. In ABAP, dot is reserved to end a statement (e.g. IF), it cannot be used to refer to a table column. You cannot indicate 'X' alone. Look at ABAP questions and answers, you should understand the syntax.

Accepted Solutions (0)

Answers (0)