2008 May 21 7:53 AM
Hi all,
I m generating an report in which when i enter vendor name or
small string of vendor name or
plant or
PO.
It will generate the same .
But no data in coming in my internal table.
Help me out where i m wrong.
if s_name1 is not initial or s_lifnr is not initial or p_bukrs is not
initial.
select lifnr bukrs from lfb1
into table i_lfb1
where lifnr in s_lifnr
and ( bukrs = p_bukrs ).
if i_lfb1[] is not initial.
select lifnr name1
from lfa1
into corresponding fields of table i_lfa1
for all entries in i_lfb1
where lifnr = i_lfb1-lifnr.
loop at i_lfa1.
check i_lfa1-name1 cs s_name1.
append i_lfa1.
endloop.
endif.
if i_lfa1[] is not initial.
select lifnr ekorg
from lfm1
into corresponding fields of table i_lfm1
for all entries in i_lfa1
where lifnr = i_lfa1-lifnr
and ( ekorg eq p_ekorg ) .
endif.
if i_lfa1[] is not initial.
select werks ekorg
from t024w
into corresponding fields of table i_t024w
for all entries in i_lfm1
where ekorg = i_lfm1-ekorg
and ( werks eq p_werks ).
endif.
LOOP AT i_lfb1 .
LOOP AT i_lfa1 .
LOOP AT i_lfm1 .
LOOP AT i_t024w .
LOOP AT i_tvktt WHERE ktgrd = i_vbrk-ktgrd.
LOOP AT i_tvkmt WHERE ktgrm = i_vbrp-ktgrm.
main_table-lifnr = i_lfb1-lifnr.
main_table-bukrs = i_lfb1-bukrs.
main_table-name1 = i_lfa1-name1.
main_table-ekorg = i_lfm1-ekorg.
main_table-werks = i_t024w-werks.
APPEND main_table.
CLEAR main_table.
ENDLOOP.
ENDLOOP.
ENDLOOP.
ENDLOOP.
Best REGARDS ,
Aastha Gupta.
Hi all,
I m generating an report in which when i enter vendor name or
small string of vendor name or
plant or
PO.
It will generate the same .
But no data in coming in my internal table.
Help me out where i m wrong.
if s_name1 is not initial or s_lifnr is not initial or p_bukrs is not
initial.
select lifnr bukrs from lfb1
into table i_lfb1
where lifnr in s_lifnr
and ( bukrs = p_bukrs ).
if i_lfb1[] is not initial.
select lifnr name1
from lfa1
into corresponding fields of table i_lfa1
for all entries in i_lfb1
where lifnr = i_lfb1-lifnr.
loop at i_lfa1.
check i_lfa1-name1 cs s_name1.
append i_lfa1.
endloop.
endif.
if i_lfa1[] is not initial.
select lifnr ekorg
from lfm1
into corresponding fields of table i_lfm1
for all entries in i_lfa1
where lifnr = i_lfa1-lifnr
and ( ekorg eq p_ekorg ) .
endif.
if i_lfa1[] is not initial.
select werks ekorg
from t024w
into corresponding fields of table i_t024w
for all entries in i_lfm1
where ekorg = i_lfm1-ekorg
and ( werks eq p_werks ).
endif.
LOOP AT i_lfb1 .
LOOP AT i_lfa1 .
LOOP AT i_lfm1 .
LOOP AT i_t024w .
LOOP AT i_tvktt WHERE ktgrd = i_vbrk-ktgrd.
LOOP AT i_tvkmt WHERE ktgrm = i_vbrp-ktgrm.
main_table-lifnr = i_lfb1-lifnr.
main_table-bukrs = i_lfb1-bukrs.
main_table-name1 = i_lfa1-name1.
main_table-ekorg = i_lfm1-ekorg.
main_table-werks = i_t024w-werks.
APPEND main_table.
CLEAR main_table.
ENDLOOP.
ENDLOOP.
ENDLOOP.
ENDLOOP.
Best REGARDS ,
Aastha Gupta.
2008 May 21 8:05 AM
Hi,
As you need the selection fields not to be initial you can make them mandatory ones in the GUI itself. Provide screen validation.
after selecting data to parent internal table...checl if initial or not.
then fill other internal tables comparing the parent itab using FOR ALL ENTRIES.
afetr dat use SORT and DELETE ADJASCENT......on that table.
loop at the parent itab, transfer data to the final / output itab. use READ and SY-SUBRC.
REFRESH the otheer tabs. I think you'll get the result.
Reward if helpful.
Thanks.
2008 May 21 8:06 AM
you can't leave the field p_bukrs empty as it it a parameter
enter some value in P_bukrs you will get some data in your internal table.
Always remamber prameters do not behave like select-options
if a select option is used in a SELECT statment and that is blank it will select all the records ie it will ignore the where,
But if a parameter field is used in SELECT and it is blank it will serch for a matching record ie, blank.
Reward points if helpful
Regards
Bikas
2008 May 21 8:08 AM
2008 May 21 8:12 AM
Hello,
As u r using so many loops
LOOP AT i_lfb1 .
LOOP AT i_lfa1 .
LOOP AT i_lfm1 .
LOOP AT i_t024w .
LOOP AT i_tvktt WHERE ktgrd = i_vbrk-ktgrd.
LOOP AT i_tvkmt WHERE ktgrm = i_vbrp-ktgrm.
main_table-lifnr = i_lfb1-lifnr.
main_table-bukrs = i_lfb1-bukrs.
main_table-name1 = i_lfa1-name1.
main_table-ekorg = i_lfm1-ekorg.
main_table-werks = i_t024w-werks.
APPEND main_table.
CLEAR main_table.
ENDLOOP.
ENDLOOP.
ENDLOOP.
ENDLOOP.
if there no data in any one loop it will not go inside and it wont append any record.
Please check in debugging...all the internal tables have data or not.
Thanks,
2008 May 21 8:26 AM
Hi,
problem in your code is in LOOP You hav written CLEAR MAIN_TABLE. if the data is cleared what can b viewed? try d below mentioned code....
if s_name1 is not initial or s_lifnr is not initial or p_bukrs is not
initial.
select lifnr bukrs from lfb1
into table i_lfb1
where lifnr in s_lifnr
and ( bukrs = p_bukrs ).
if i_lfb1[] is not initial.
select lifnr name1
from lfa1
into corresponding fields of table i_lfa1
for all entries in i_lfb1
where lifnr = i_lfb1-lifnr,
name1 cs s_name1.
endif.
if i_lfa1[] is not initial.
select lifnr ekorg
from lfm1
into corresponding fields of table i_lfm1
for all entries in i_lfa1
where lifnr = i_lfa1-lifnr
and ( ekorg eq p_ekorg ) .
endif.
if i_lfa1[] is not initial.
select werks ekorg
from t024w
into corresponding fields of table i_t024w
for all entries in i_lfm1
where ekorg = i_lfm1-ekorg
and ( werks eq p_werks ).
endif.
LOOP AT i_lfb1 .
main_table-lifnr = i_lfb1-lifnr.
main_table-bukrs = i_lfb1-bukrs.
read table i_lfa1 with key lifnr = ilfb1-lifnr.
if sy-subrc = 0.
main_table-name1 = i_lfa1-name1.
endif.
read table i_lfa1 with key lifnr = ilfb1-lifnr.
read table i_lfm1 with key lifnr = ilfa1-lifnr.
if sy-subrc = 0.
main_table-ekorg = i_lfa1-ekorg.
endif.
......................
.......................
.........................
APPEND main_table.
CLEAR i_lfb1.
ENDLOOP.
refresh: i_lfb1, i_lfa1, i-lfm1, i_t024w.
Reward if helpful.
Thanks.
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |