‎2010 May 11 8:53 AM
Hi
I dont know if I can use the forum for this ...
Can you help me with this code:
Data: t_SUB_HEADER type BAPI1077RH occurs 0 with header line.
SELECT RECN INTO (t_SUB_HEADER-RECORD_NO)
FROM ESTRH
FOR ALL ENTRIES IN t_estmj
WHERE RECN = t_ESTMJ-RECNROOT.
WRITE:/ t_SUB_HEADER-RECORD_NO.
ENDSELECT.
I want the t_SUB_HEADER to get fill but I cant get to insert the values into the table, I dont know if Im doing things right.
Thanks in advance
‎2010 May 11 8:57 AM
Either
SELECT RECN INTO corresponding field of table t_SUB_HEADER....
loop at y_sub_header.
WRITE:/ t_SUB_HEADER-RECORD_NO.
endloop.
Or
SELECT RECN INTO (t_SUB_HEADER-RECORD_NO) "here you are addressing header of the table
FROM ESTRH
FOR ALL ENTRIES IN t_estmj
WHERE RECN = t_ESTMJ-RECNROOT.
WRITE:/ t_SUB_HEADER-RECORD_NO.
append t_sub_header. "here you are addressing table content
ENDSELECT.
Regards
Marcin
‎2010 May 11 8:57 AM
Hi jean
You must append the structure in the select statemen, otherwise the record
is not insert in the tablem but only in the header line..
append t_sub_header.
regards
Marco
‎2010 May 11 8:57 AM
Either
SELECT RECN INTO corresponding field of table t_SUB_HEADER....
loop at y_sub_header.
WRITE:/ t_SUB_HEADER-RECORD_NO.
endloop.
Or
SELECT RECN INTO (t_SUB_HEADER-RECORD_NO) "here you are addressing header of the table
FROM ESTRH
FOR ALL ENTRIES IN t_estmj
WHERE RECN = t_ESTMJ-RECNROOT.
WRITE:/ t_SUB_HEADER-RECORD_NO.
append t_sub_header. "here you are addressing table content
ENDSELECT.
Regards
Marcin
‎2010 May 11 8:58 AM
Hi,
If you want to fill the table .. write as
SELECT RECN INTO table t_SUB_HEADER
FROM ESTRH
FOR ALL ENTRIES IN t_estmj
WHERE RECN = t_ESTMJ-RECNROOT.
Regards,
Srini.
‎2010 May 11 9:00 AM
Change this way
data: begin of it_SUB_HEADER occurs 0.
data : RECN like BAPI1077RH-RECORD_NO.
data : end of it_SUB_HEADER.
SELECT RECN INTO TABLE it_SUB_HEADER
FROM ESTRH
FOR ALL ENTRIES IN t_estmj
WHERE RECN = t_ESTMJ-RECNROOT.
ENDSELECT.
a®
‎2010 May 11 9:03 AM
Ithink that "corresponding field of table" doesnt apply because the column names are different, neither the select RECN into table.
Im I right?
‎2010 May 11 9:04 AM
Hi
yes you're right...
you must use append like my previous post...in the select..
regards
Marco
‎2010 May 11 9:05 AM
‎2010 May 11 9:06 AM
Are you sure the internal table t_estmj is not initial before the select query?
Better to put the check when you use FOR ALL ENTRIES
Data: t_SUB_HEADER type BAPI1077RH occurs 0 with header line.
IF NOT t_estmj[] is intial.
SELECT RECN INTO (t_SUB_HEADER-RECORD_NO)
FROM ESTRH
FOR ALL ENTRIES IN t_estmj
WHERE RECN = t_ESTMJ-RECNROOT.
WRITE:/ t_SUB_HEADER-RECORD_NO.
ENDSELECT.
ENDIF.
‎2010 May 11 9:06 AM
Hi Jean Carlo,
You are saying that you Iwant the t_SUB_HEADER to get fill but you cant get to insert the values into the table.
Here in this code your are not appending the table. see below:
Data: t_SUB_HEADER type BAPI1077RH occurs 0 with header line.
SELECT RECN INTO (t_SUB_HEADER-RECORD_NO)
FROM ESTRH
FOR ALL ENTRIES IN t_estmj
WHERE RECN = t_ESTMJ-RECNROOT.
APPEND t_SUB_HEADER.
WRITE:/ t_SUB_HEADER-RECORD_NO.
ENDSELECT.
Better if you write the code written below for good performance.
SELECT RECN INTO TABLE t_SUB_HEADER
FROM ESTRH
FOR ALL ENTRIES IN t_estmj
WHERE RECN = t_ESTMJ-RECNROOT.
IF SY-SUBRC EQ 0.
LOOP AT t_SUB_HEADER.
WRITE:/ t_SUB_HEADER-RECORD_NO.
ENDLOOP.
Hope this is the solution of your question.
Regards,
Md Ziauddin.