2022 Dec 14 10:46 AM
When I added the ABAP code in the InfoSet query getting an error message: The data object "<G00_WA>" does not have a structure and therefore does not have a component called "MSEG-BWART".
Code Section: 1 DATA
DATA: str TYPE string.
FIELD-SYMBOLS: <g00> TYPE table.
FIELD-SYMBOLS: <g00_wa> TYPE any.
Code Section: 7 END-OF-SELECTION (after List)
str = '%G00[]'.
ASSIGN (str) TO <g00>.
LOOP AT <g00> ASSIGNING <g00_wa>.
IF <g00_wa>-mseg-bwart = '102'.
<g00_wa>-dmbtr = <g00_wa>-dmbtr * -1.
<g00_wa>-menge = <g00_wa>-menge * -1.
ENDIF.
ENDLOOP.
MODIFY <g00> FROM <g00_wa>.
COMMIT WORK.
2022 Dec 15 11:13 AM
Hi Sandra Rossi,
I am trying to add codes in the SQ02 InfoSet. When I am trying to execute the query getting dump.
2022 Dec 14 2:17 PM
The compiler doesn't accept the static form:
<g00_wa>-mseg-bwart
because you declared a generic type:
FIELD-SYMBOLS: <g00_wa> TYPE any.
Instead, you should use the dynamic form so that to bypass the compiler static checks:
ASSIGN COMPONENT 'MSEG-BWART' OF STRUCTURE <g00_wa> TO FIELD-SYMBOL(<mseg_bwart>).
IF sy-subrc = 0 AND <mseg_bwart> = '102'.
...
ENDIF.
2022 Dec 15 8:15 AM
Hi Sandra Rossi,
Thank you for responding but I tried the mentioned code and got an error message. after execute I debugged the code:
1) sy-subrc got 4 not 0
2) once I comment sy-subrc got dump
str = '%G00[]'.
ASSIGN (str) TO <g00>.
ASSIGN COMPONENT 'MSEG-BWART' OF STRUCTURE
<g00_wa> TO FIELD-SYMBOL(<mseg_bwart>).
ASSIGN COMPONENT 'MSEG-DMBTR' OF STRUCTURE
<g00_wa> TO FIELD-SYMBOL(<mseg_dmbtr>).
ASSIGN COMPONENT 'MSEG-MENGE' OF STRUCTURE
<g00_wa> TO FIELD-SYMBOL(<mseg_menge>).
LOOP AT <g00> ASSIGNING <g00_wa>.
IF sy-subrc EQ 0 AND <mseg_bwart> = '102'.
<mseg_dmbtr> = <mseg_dmbtr> * -1.
<mseg_menge> = <mseg_menge> * -1.
ENDIF.
ENDLOOP.
2022 Dec 15 9:53 AM
It works for me:
DATA: BEGIN OF xx,
BEGIN OF mseg,
bwart TYPE string,
END OF mseg,
END OF xx.
xx-mseg-bwart = '102'.
ASSIGN COMPONENT 'MSEG-BWART' OF STRUCTURE xx TO FIELD-SYMBOL(<mseg_bwart>).
IF sy-subrc = 0 AND <mseg_bwart> = '102'.
MESSAGE `It's alive!` TYPE 'I'.
ENDIF.
NB: Please edit your question, select your code and press the button [CODE], which makes the code appear colored/indented, it will be easier for people to look at it. Thank you!
2022 Dec 15 9:53 AM
Please edit your question, select your code and press the button [CODE], which makes the code appear colored/indented, it will be easier for people to look at it. Thank you!
2022 Dec 15 11:13 AM
Hi Sandra Rossi,
I am trying to add codes in the SQ02 InfoSet. When I am trying to execute the query getting dump.