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

problem in code

Former Member
0 Likes
904

Hi...

I am facing issue when retrieving data to internal table based on the import parameter getting from the FM. but internal table doesn't contains any data althouh where condition parameter contains value.

I am including my Code below.


types :    begin of iy_tab4 ,

        valfr type ibin-valfr,
        ibase type ib_ibase,
       amount type ibin-amount,
       unit type ibin-unit,
       end of iy_tab4.
data : it_tab4 type standard table of iy_tab4,

       wa_tab4 type iy_tab4.

data : i_ibase type ib_ibase.
data: begin of it_tab occurs 10,
       ibase type ib_ibase,
       end of  it_tab.

data : it_tab type STANDARD TABLE OF iy_tab ,
         wa_tab type iy_tab.



CALL FUNCTION 'IBSD_CREATE_IBASE'
  EXPORTING
    I_VBELN                     = '0000013234'
    I_POSNR                     = '000010'
    I_AS_SOLD                   = '0'
    I_AS_BUILD                  = '0'
    I_CAPID                     = '0'
*   I_CHANGE                    = ' '
   I_COMMIT                    = 'X'
*   I_COMMIT_WAIT               = ' '
 IMPORTING
   E_IBASE                     = i_ibase
 EXCEPTIONS
   ORDER_NOT_FOUND             = 1
   POSITION_NOT_FOUND          = 2
   NOTHING_TO_DO               = 3
   TOO_MUCH_TO_DO              = 4
   MISSING_AUTHORIZATION       = 5
   FOREIGN_LOCK                = 6
   OTHERS                      = 7
          .
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.

  move i_ibase to wa_tab-ibase.
  append  wa_tab to it_tab.
  clear wa_tab.


endif.


select valfr ibase amount unit from IBIN
 into table it_tab4
 for all ENTRIES IN it_tab
  where ibase = it_tab-ibase.




loop at it_tab4 into wa_tab4.

  write : wa_tab4-valfr,
         / wa_tab4-ibase,
         / wa_tab4-amount.
endloop.

Thank you.

Regards,

Lokeswari.

Moderator message: please use a more meaningful subject line and -tags next time.

Edited by: Thomas Zloch on Mar 24, 2010 4:20 PM

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
839

Hi,

change your code like

i_commit = ' '

i_commit_wait = 'X'

Your problem will be solved, i checked it.


DATA : it_tab4 TYPE STANDARD TABLE OF ibin.
DATA:wa TYPE ibin.
DATA : i_ibase TYPE ib_ibase.

CALL FUNCTION 'IBSD_CREATE_IBASE'
  EXPORTING
    i_vbeln               = '0001122654'
    i_posnr               = '000017'
    i_as_sold             = '0'
    i_as_build            = '0'
    i_capid               = '0'
    i_commit              = ' '
    i_commit_wait         = 'X'
  IMPORTING
    e_ibase               = i_ibase
  EXCEPTIONS
    order_not_found       = 1
    position_not_found    = 2
    nothing_to_do         = 3
    too_much_to_do        = 4
    missing_authorization = 5
    foreign_lock          = 6
    OTHERS                = 7.
IF sy-subrc  <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.


SELECT * FROM ibin
 INTO TABLE it_tab4
  WHERE ibase = i_ibase.

LOOP AT it_tab4 INTO wa.
  WRITE : wa-valfr,
        / wa-ibase,
        / wa-amount.
ENDLOOP.

8 REPLIES 8
Read only

Former Member
0 Likes
839

Hi Lokeswari

you need to append the value of the table..so or you do like follow

change


select valfr ibase amount unit from IBIN
 into table it_tab4
 for all ENTRIES IN it_tab
  where ibase = it_tab-ibase.

with


select valfr ibase amount unit from IBIN
 into CORRESPONDING FIELDS OF TABLE  it_tab4
 for all ENTRIES IN it_tab
  where ibase = it_tab-ibase.

or you must create a structure, do the select and after append the value at the table


select valfr ibase amount unit from IBIN
 into CORRESPONDING FIELDS OF it_str4
 for all ENTRIES IN it_tab
  where ibase = it_tab-ibase.
append it_str4 to  it_tab4.
endselect.

best regards

Marco

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
839

Check if there is any value in IBIN for the values in it_tab-ibase.

and the domain of the field IBIN-IBASE has a conversion exit used.

try like this,

move i_ibase to wa_tab-ibase.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = wa_tab-ibase

importing

output = wa_tab-ibase.

append wa_tab to it_tab.

clear wa_tab.

after this check your select query.

Read only

0 Likes
839

Hi Keshav...

Thanks for your reply.

i tried like this as suggested by you. But Still internal table-it)tab4 have no values. when i placed break point before select statement and checking step wise it is working. if put break point after Select query i.e. at loop statement it is showing sy-subrc 4.

Any pointers??

CALL FUNCTION 'IBSD_CREATE_IBASE'

EXPORTING

I_VBELN = '0000013234'

I_POSNR = '000010'

I_AS_SOLD = '0'

I_AS_BUILD = '0'

I_CAPID = '0'

  • I_CHANGE = ' '

I_COMMIT = 'X'

  • I_COMMIT_WAIT = ' '

IMPORTING

E_IBASE = i_ibase

EXCEPTIONS

ORDER_NOT_FOUND = 1

POSITION_NOT_FOUND = 2

NOTHING_TO_DO = 3

TOO_MUCH_TO_DO = 4

MISSING_AUTHORIZATION = 5

FOREIGN_LOCK = 6

OTHERS = 7

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

else.

move i_ibase to wa_tab-ibase.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = wa_tab-ibase

IMPORTING

OUTPUT = wa_tab-ibase

.

append wa_tab to it_tab.

clear wa_tab.

endif.

select valfr ibase amount unit from IBIN

into TABLE it_tab4

for all ENTRIES IN it_tab

where ibase = it_tab-ibase.

loop at it_tab4 into wa_tab4.

write : wa_tab4-valfr,

/ wa_tab4-ibase,

/ wa_tab4-amount.

endloop.

Regards,

Lokeswari.

Read only

0 Likes
839

Hi,

Can you check whether any value is populated in field "i_ibase".

and try to see whether any entry exist for that field into table IBIN.

(your code is working perfectly fine in my system)

Read only

0 Likes
839

Hi Raj...

It is working some times and not working some times.

I am unable to interprete what is happening in the code.

Regards,

Lokeswari.

Read only

former_member203501
Active Contributor
0 Likes
839

Hi ,

select valfr ibase amount unit from IBIN

into table it_tab4

for all ENTRIES IN it_tab

where ibase = it_tab4-ibase.

do like this as this is the for all entries statement the where condition must be with the for all entries table.

Regards,

Venkat Appikonda

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
840

Hi,

change your code like

i_commit = ' '

i_commit_wait = 'X'

Your problem will be solved, i checked it.


DATA : it_tab4 TYPE STANDARD TABLE OF ibin.
DATA:wa TYPE ibin.
DATA : i_ibase TYPE ib_ibase.

CALL FUNCTION 'IBSD_CREATE_IBASE'
  EXPORTING
    i_vbeln               = '0001122654'
    i_posnr               = '000017'
    i_as_sold             = '0'
    i_as_build            = '0'
    i_capid               = '0'
    i_commit              = ' '
    i_commit_wait         = 'X'
  IMPORTING
    e_ibase               = i_ibase
  EXCEPTIONS
    order_not_found       = 1
    position_not_found    = 2
    nothing_to_do         = 3
    too_much_to_do        = 4
    missing_authorization = 5
    foreign_lock          = 6
    OTHERS                = 7.
IF sy-subrc  <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.


SELECT * FROM ibin
 INTO TABLE it_tab4
  WHERE ibase = i_ibase.

LOOP AT it_tab4 INTO wa.
  WRITE : wa-valfr,
        / wa-ibase,
        / wa-amount.
ENDLOOP.

Read only

0 Likes
839

Hi All

Thank you for your replies.

Special thanks to Keshav.

Regards,

Lokeswari.