2009 Jun 05 7:23 AM
Hi,
Below is the select query in which i want to store the data in variable but i am getting runtime error as the fields are more as compared to variable,the declaration is necessary for it due to the reteriving for data.
Please provide me guidelines how to do it.
DATA: BEGIN OF ITSC01 OCCURS 0,
PRUEFLOS LIKE QALS-PRUEFLOS,
MBLNR LIKE QAMB-MBLNR,
LGORT LIKE MSEG-LGORT,
END OF ITSC01.
IF STIT-MGEIG GE 0.
LOOP AT STIT." WHERE PRUEFLOS EQ STIT-PRUEFLOS.
SELECT A~PRUEFLOS B~MBLNR C~LGORT FROM QALS AS A
INNER JOIN QAMB AS B ON B~PRUEFLOS = A~PRUEFLOS
INNER JOIN MSEG AS C ON C~MBLNR = B~MBLNR AND C~MJAHR = B~MJAHR
INTO SLOC WHERE A~PRUEFLOS EQ STIT-PRUEFLOS.
* INTO TABLE ITSC01 WHERE A~PRUEFLOS EQ STIT-PRUEFLOS AND A~MATNR EQ STIT-MATNR AND C~LGORT EQ 'SC03'.
SORT ITSC01 BY PRUEFLOS.
READ TABLE ITSC01 WITH KEY PRUEFLOS = ITSC01-PRUEFLOS.
IF ITSC01-LGORT EQ 'SC03'.
STIT-MGEIG = 0.
ENDIF.
MODIFY STIT.
ENDLOOP.
ENDIF.
Hi,
Below is the select query in which i want to store the data in variable but i am getting runtime error as the fields are more as compared to variable,the declaration is necessary for it due to the reteriving for data.
Please provide me guidelines how to do it.
DATA: BEGIN OF ITSC01 OCCURS 0,
PRUEFLOS LIKE QALS-PRUEFLOS,
MBLNR LIKE QAMB-MBLNR,
LGORT LIKE MSEG-LGORT,
END OF ITSC01.
IF STIT-MGEIG GE 0.
LOOP AT STIT." WHERE PRUEFLOS EQ STIT-PRUEFLOS.
SELECT A~PRUEFLOS B~MBLNR C~LGORT FROM QALS AS A
INNER JOIN QAMB AS B ON B~PRUEFLOS = A~PRUEFLOS
INNER JOIN MSEG AS C ON C~MBLNR = B~MBLNR AND C~MJAHR = B~MJAHR
INTO SLOC WHERE A~PRUEFLOS EQ STIT-PRUEFLOS.
* INTO TABLE ITSC01 WHERE A~PRUEFLOS EQ STIT-PRUEFLOS AND A~MATNR EQ STIT-MATNR AND C~LGORT EQ 'SC03'.
SORT ITSC01 BY PRUEFLOS.
READ TABLE ITSC01 WITH KEY PRUEFLOS = ITSC01-PRUEFLOS.
IF ITSC01-LGORT EQ 'SC03'.
STIT-MGEIG = 0.
ENDIF.
MODIFY STIT.
ENDLOOP.
ENDIF.
2009 Jun 05 7:30 AM
2009 Jun 05 7:35 AM
HI,
Is the select query written in correct way ? instead storing of data in itab i am truing to store the value of LGORT in variable called SLOC,please provide me guidelines for it.
I got the runtime error that :-
In a SELECT or FETCH command, the field string or internal table
specified in the INTO clause has 1 fields. It must have
at least as many fields as in the SELECT clause,
3 fields in this case.
how do i solve this problem?
yes,i had declared like this:-
DATA: SLOC LIKE MSEG-LGORT.
Even i tried to decalre in the ITSC01 but still it is giving the runtime error.
Edited by: ricx .s on Jun 5, 2009 8:36 AM
2009 Jun 05 7:39 AM
hi,,
you haven't declared the internal table with exact fields i think..
declare an internal table with the exact fields & check
Edited by: Kishore Babu on Jun 5, 2009 8:39 AM
2009 Jun 05 7:41 AM
As you are fetching 3 fields in the select clause and SLOC can only accept one filed , so either you can declare 2 more variable and then use them in the INTO clause or else use internal table.
2009 Jun 05 7:41 AM
hi,
i had tried by declaring it but it is still giving the run time error.
2009 Jun 05 7:44 AM
hmm..
try this:
DATA: l_PRUEFLOS LIKE QALS-PRUEFLOS,
l_MBLNR LIKE QAMB-MBLNR,
l_LGORT LIKE MSEG-LGORT,
IF STIT-MGEIG GE 0.
LOOP AT STIT." WHERE PRUEFLOS EQ STIT-PRUEFLOS.
SELECT APRUEFLOS BMBLNR C~LGORT FROM QALS AS A
INNER JOIN QAMB AS B ON BPRUEFLOS = APRUEFLOS
INNER JOIN MSEG AS C ON CMBLNR = BMBLNR AND CMJAHR = BMJAHR
INTO ( l_PRUEFLOS , l_MBLNR, l_LGORT )
WHERE A~PRUEFLOS EQ STIT-PRUEFLOS.
INTO TABLE ITSC01 WHERE APRUEFLOS EQ STIT-PRUEFLOS AND AMATNR EQ STIT-MATNR AND C~LGORT EQ 'SC03'.
SORT ITSC01 BY PRUEFLOS.
READ TABLE ITSC01 WITH KEY PRUEFLOS = ITSC01-PRUEFLOS.
IF ITSC01-LGORT EQ 'SC03'.
STIT-MGEIG = 0.
ENDIF.
MODIFY STIT.
ENDLOOP.
ENDIF.
2009 Jun 05 7:52 AM
hi,
i am trying what you has said but i have to use select endselect statement but while debugging there is no data present in the ITSC01 and should i use endselect word in the query ?
Edited by: ricx .s on Jun 5, 2009 9:04 AM
2009 Jun 05 8:29 AM
If you are using the code in my post , the table ITSC01 will be intial and the data will be stored in the varaibles.
So you have to use the varaibles now.
2009 Jun 05 10:11 AM
Hi,
yes i am using your logic but in that it is not fillling ITSC01 as in that select query it is just passing the values .. tell me if i am getting wrong. There is no data for the stored in ITSC01.
Please provide me guidelines to solve this problem.
2009 Jun 05 10:15 AM
It will not fill ITSC01.
Try this:
SELECT APRUEFLOS BMBLNR C~LGORT FROM QALS AS A
INNER JOIN QAMB AS B ON BPRUEFLOS = APRUEFLOS
INNER JOIN MSEG AS C ON CMBLNR = BMBLNR AND CMJAHR = BMJAHR
INTO TABLE ITSC01 WHERE APRUEFLOS EQ STIT-PRUEFLOS AND AMATNR EQ STIT-MATNR AND C~LGORT EQ 'SC03'.
2009 Jun 05 10:18 AM
hi,
but what about the variable for Storage Location? should i store seperately then value of it ?
Please provide me guidelines for solving this probelm.
Edited by: ricx .s on Jun 5, 2009 11:38 AM
2009 Jun 05 7:32 AM
How you have declared variable SLOC.
SELECT APRUEFLOS BMBLNR C~LGORT FROM QALS AS A
INNER JOIN QAMB AS B ON BPRUEFLOS = APRUEFLOS
INNER JOIN MSEG AS C ON CMBLNR = BMBLNR AND CMJAHR = BMJAHR
INTO SLOC WHERE A~PRUEFLOS EQ STIT-PRUEFLOS. ==> Check structure of SLOC
INTO TABLE ITSC01 WHERE APRUEFLOS EQ STIT-PRUEFLOS AND AMATNR EQ STIT-MATNR AND C~LGORT EQ 'SC03'
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |