SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Вопрос по работе с BSEG



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
Pavel_sap
Участник
Участник


Age: 40
Joined: 11 Feb 2009
Posts: 14

PostPosted: Tue Mar 03, 2009 7:57 pm    Post subject: Вопрос по работе с BSEG Reply with quote

Добрый день.
Не могу понять почему следующий select завершается с sy-subrc = 4

SELECT * FROM bseg INTO TABLE lt_bseg
WHERE bukrs = pr_bukrs
AND gjahr = PR_GJAHR
AND hkont = pr_accnt.

Хотя, если сделать выборку из таблицы bseg руками с такими же параметрами через se16, то данные есть.
Back to top
View user's profile Send private message
John Doe
Модератор
Модератор


Age: 45
Joined: 05 Nov 2007
Posts: 725
Location: КраснАдар

PostPosted: Tue Mar 03, 2009 8:08 pm    Post subject: Reply with quote

Есть подозрение, что pr_accnt объявлен не корректно и возможно отсутствуют лидирующие нули.
Back to top
View user's profile Send private message Blog
menx
Участник
Участник



Joined: 21 Nov 2008
Posts: 25
Location: СПб - Валлдорф

PostPosted: Tue Mar 03, 2009 9:51 pm    Post subject: Reply with quote

а как объявлена lt_bseg?
Back to top
View user's profile Send private message
Удав
Гуру
Гуру


Age: 48
Joined: 25 Jan 2008
Posts: 580
Location: Москва

PostPosted: Wed Mar 04, 2009 12:19 am    Post subject: Reply with quote

John Doe +1.
И вообще лучше для таких выборок использовать таблицы BSIS, BSAS и иже с ними.

_________________
С уважением,
Удав.
Back to top
View user's profile Send private message
Удав
Гуру
Гуру


Age: 48
Joined: 25 Jan 2008
Posts: 580
Location: Москва

PostPosted: Wed Mar 04, 2009 12:30 am    Post subject: Reply with quote

menx wrote:
а как объявлена lt_bseg?

Если бы lt_bseg была объявлена неверно, был бы дамп, а не sy-subrc = 4 Wink

_________________
С уважением,
Удав.
Back to top
View user's profile Send private message
Pavel_sap
Участник
Участник


Age: 40
Joined: 11 Feb 2009
Posts: 14

PostPosted: Wed Mar 04, 2009 11:03 am    Post subject: Reply with quote

pr_accnt объявлен как:
PARAMETERS:
pr_accnt TYPE sakan OBLIGATORY.
Back to top
View user's profile Send private message
Pavel_sap
Участник
Участник


Age: 40
Joined: 11 Feb 2009
Posts: 14

PostPosted: Wed Mar 04, 2009 11:56 am    Post subject: Reply with quote

John Doe wrote:
Есть подозрение, что pr_accnt объявлен не корректно и возможно отсутствуют лидирующие нули.


о каких лидирующих нулях идёт речь? Embarassed
Back to top
View user's profile Send private message
vga
Мастер
Мастер


Age: 80
Joined: 04 Oct 2007
Posts: 1218
Location: Санкт-Петербург

PostPosted: Wed Mar 04, 2009 12:15 pm    Post subject: Reply with quote

Pavel_sap wrote:
John Doe wrote:
Есть подозрение, что pr_accnt объявлен не корректно и возможно отсутствуют лидирующие нули.


о каких лидирующих нулях идёт речь? Embarassed


Так попробуйте
Code:

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
     EXPORTING
          input  = pr_accnt
     IMPORTING
          output = pr_accnt.

SELECT * FROM bseg INTO TABLE lt_bseg
  WHERE bukrs = pr_bukrs
    AND gjahr = pr_gjahr
    AND hkont = pr_accnt.


если не заработает, выкладывайте код, чтобы было видно определение всех переменных.
Back to top
View user's profile Send private message Blog Visit poster's website
Pavel_sap
Участник
Участник


Age: 40
Joined: 11 Feb 2009
Posts: 14

PostPosted: Wed Mar 04, 2009 12:24 pm    Post subject: Reply with quote

vga wrote:
Pavel_sap wrote:
John Doe wrote:
Есть подозрение, что pr_accnt объявлен не корректно и возможно отсутствуют лидирующие нули.


о каких лидирующих нулях идёт речь? Embarassed


Так попробуйте
Code:

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
     EXPORTING
          input  = pr_accnt
     IMPORTING
          output = pr_accnt.

SELECT * FROM bseg INTO TABLE lt_bseg
  WHERE bukrs = pr_bukrs
    AND gjahr = pr_gjahr
    AND hkont = pr_accnt.


если не заработает, выкладывайте код, чтобы было видно определение всех переменных.


Благодарю, такое решение помогло. Smile
Back to top
View user's profile Send private message
vga
Мастер
Мастер


Age: 80
Joined: 04 Oct 2007
Posts: 1218
Location: Санкт-Петербург

PostPosted: Wed Mar 04, 2009 12:31 pm    Post subject: Reply with quote

Pavel_sap wrote:
pr_accnt объявлен как:
PARAMETERS:
pr_accnt TYPE sakan OBLIGATORY.


Сразу не заметил, что pr_accnt - это параметр. Нужно сменить у него тип
PARAMETERS: pr_accnt TYPE bseg-hkont OBLIGATORY.
тогда ALPHA преобразование будет происходить автоматически в PAI и предыдущая вставка
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
не потребуется.
Back to top
View user's profile Send private message Blog Visit poster's website
Pavel_sap
Участник
Участник


Age: 40
Joined: 11 Feb 2009
Posts: 14

PostPosted: Wed Mar 04, 2009 12:37 pm    Post subject: Reply with quote

vga wrote:
Pavel_sap wrote:
pr_accnt объявлен как:
PARAMETERS:
pr_accnt TYPE sakan OBLIGATORY.


Сразу не заметил, что pr_accnt - это параметр. Нужно сменить у него тип
PARAMETERS: pr_accnt TYPE bseg-hkont OBLIGATORY.
тогда ALPHA преобразование будет происходить автоматически в PAI и предыдущая вставка
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
не потребуется.


Спасибо.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.