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 with a internal table

Former Member
0 Likes
732

Hello guys! I have a problem with a internal table into of a my badi, I try of get each position of a PO is saved in t_posic. The problem it's that for each position, only save a register in my table t_posic. I use the BADI ME_PROCESS_PO_CUST with method ITEM.
e_posic-ebelp = ls_mepoitem-ebelp.

          e_posic-pspnr = ls_account-ps_psp_pnr.

          e_posic-waers = ls_mepoitem-waers.

          READ TABLE

            t_posic

          INTO ls_posic

          WITH KEY

            pspnr = e_posic-pspnr

          BINARY SEARCH.

          IF SY-SUBRC EQ 0.

          ELSE.

            APPEND e_posic TO t_posic.

          ENDIF.

4 REPLIES 4
Read only

Former Member
0 Likes
682

Your question is very unclear, but one problem I see with your code is that you are using BINARY SEARCH but then also just appending an entry to the table. How are you keeping the table sorted?

Read only

0 Likes
682

EBELNR, PSPNR and WAERS.

Read only

0 Likes
682

if you sort by EBELN and PSPNR, in case you have different EBELN, the binary search go mess.

Remove that option (i do not think you have 10000 items in your internal table).

In my system i cannot find the method "ITEM": you mean "process Item"?

Read only

Former Member
0 Likes
682

Hi Juan Fco Morales,

I am afraid i did not understand your question, but befor using binary search in read statement please sort the internal table with same key.

Regards,

Pravin