on 2024 Mar 17 5:34 AM - last edited on 2024 Apr 05 9:25 AM by anne-petteroe
Hi guys!
The error occurs in the first INTO of the first SELECT. I have 'INTO' is invalid (due to grammar)
I need to return several tables that will become arrays in an application that will call this BAPI remotely (RFC). However, when I add this code to the SAP that will run the RFC, it gives a problem with the INTO clause.
INTO is invalid here (due to grammar), but I don't know what I'm doing wrong, because I've already run this function in other SAPs and it worked normally.
The logic of this RFC is to return the data from the MARD, MARC, MAKT and MBEW tables based on the MARA table. Then I perform a select with where in the MARA table that will return a series of items, and based on the code of these items I perform a FOR ALL ENTRIES to search for these same materials in other tables and return them separately. I can't use joins. And then I come across the INTO clause error when I use anything between the word MARA (FROM MARA) and INTO. (In this case it's the order by)
I need the up to to be able to limit the lines of this return.
Can anyone help me?
Code (also attached):
FUNCTION Z_GET_MATERIAL_FULL_CUSTOM.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(MARA_MAX_ROWS) TYPE INT4
*" REFERENCE(MARA_SKIP_ROWS) TYPE INT4
*" TABLES
*" MARA_TABLE STRUCTURE MARA
*" MARD_TABLE STRUCTURE MARD
*" MARC_TABLE STRUCTURE MARC
*" MAKT_TABLE STRUCTURE MAKT
*" MBEW_TABLE STRUCTURE MBEW
*"----------------------------------------------------------------------
SELECT MATNR, MEINS, MTPOS_MARA FROM MARA WHERE MTPOS_MARA = 'ZMAP' OR MTPOS_MARA = 'ZMAN' ORDER BY MATNR INTO CORRESPONDING FIELDS OF TABLE @Mara_TABLE UP TO @Mara_MAX_ROWS ROWS OFFSET @Mara_SKIP_ROWS .
SELECT MATNR, LABST, LGPBE FROM MARD FOR ALL ENTRIES IN @Mara_TABLE WHERE MATNR = @Mara_TABLE-MATNR INTO CORRESPONDING FIELDS OF TABLE @MARD_TABLE.
SELECT MATNR, MINBE, MABST, PLIFZ, DISMM, STEUC FROM MARC FOR ALL ENTRIES IN @Mara_TABLE WHERE MATNR = @Mara_TABLE-MATNR INTO CORRESPONDING FIELDS OF TABLE @Marc_TABLE.
SELECT MATNR, MAKTX FROM MAKT FOR ALL ENTRIES IN @Mara_TABLE WHERE MATNR = @Mara_TABLE-MATNR AND SPRAS = 'P' INTO CORRESPONDING FIELDS OF TABLE @makt_TABLE.
SELECT MATNR, VERPR FROM MBEW FOR ALL ENTRIES IN @Mara_TABLE WHERE MATNR = @Mara_TABLE-MATNR INTO CORRESPONDING FIELDS OF TABLE @MBEW_TABLE.
ENDFUNCTION.
User | Count |
---|---|
77 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.