Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Not getting data in Internal table

Former Member
0 Likes
1,934

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.

5 REPLIES 5
Read only

Former Member
0 Likes
1,010

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.

Read only

Former Member
0 Likes
1,010

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

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,010

do not post duplicates....see ur previous post

Read only

Former Member
0 Likes
1,010

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,

Read only

Former Member
0 Likes
1,010

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.