Application Development 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: 

assign value

Former Member
0 Kudos

Hellow I wont 2 assign value into itab from wa_itab but the values is enter in the wrong field see

SELECT SINGLE objid

FROM hrp1000

INTO wa_d_itab-objid

WHERE otype = 'S'

AND objid = wa_itab-plans

AND begda <= currnt_date

AND endda >= currnt_date.

IF sy-subrc <> 0.

<b>wa_error_itab-description = 'plans problem'.

APPEND wa_error_itab-description TO error_itab.

APPEND wa_itab-plans TO error_itab.</b>

ENDIF.

This is the line that I have a problem

wa_error_itab-description = 'plans problem'.

APPEND wa_error_itab-description TO error_itab.

The value description isn’t inhabitant in my internal table in the place that it should be.

thankes

4 REPLIES 4

Former Member
0 Kudos

hi,

the way you populate the internal table is not correct it seems.

if WA_ERROR_ITAB is the work area of ERROR_ITAB, you can use the following logic.

IF SY-SUBRC <> 0.

WA_ERROR_ITAB-description = 'Plans Problem'.

WA_ERROR_ITAB-plans = WA_ITAB-PLANS .

APPEND WA_ERROR_ITAB TO ERROR_TAB.

ENDIF.

Hope this works.

Sajan.

Clemenss
Active Contributor
0 Kudos

sh tal,

is it possible that your internal table error_itab has not the same strucure as the work area wa_error_itab?

Tell us what you expect in detail and what is the actual result in detail. You did not post the declaration (dada statement) for wa_error_itab and error_itab. So it is hard to guess what gies wrong.

Regards,

Clemens

Former Member
0 Kudos

HI

Please try this way:

IF sy-subrc <> 0.
<b>*wa_error_itab-description = 'plans problem'.
*APPEND wa_error_itab-description TO error_itab.
*APPEND wa_itab-plans TO error_itab. 
   concantenate 'Plans Problem:' wa_itab-plans into wa_error_itab-description separated by space.
   append wa_error_itab to error_itab.</b>
ENDIF.

If you still have the problem, kindly post the definitions of error_itab, wa_error_itab, wa_itab for better advices.

Kind Regards

Eswar

Former Member
0 Kudos

hi

good

take this example and use accordingly

TYPES: BEGIN OF COMPANIES_TYPE,

NAME(10), SALES TYPE I,

END OF COMPANIES_TYPE.

DATA COMPANIES TYPE STANDARD TABLE OF COMPANIES_TYPE

INITIAL SIZE 3,

WA_COMPANIES TYPE COMPANIES_TYPE.

WA_COMPANIES-NAME = 'big'.

WA_COMPANIES-SALES = 90.

APPEND WA_COMPANIES TO COMPANIES.

WA_COMPANIES-NAME = 'small'.

WA_COMPANIES-SALES = 10.

APPEND WA_COMPANIES TO COMPANIES.

WA_COMPANIES-NAME = 'too small'.

WA_COMPANIES-SALES = 5.

APPEND WA_COMPANIES TO COMPANIES.

WA_COMPANIES-NAME = 'middle'.

WA_COMPANIES-SALES = 50.

APPEND WA_COMPANIES TO COMPANIES SORTED BY SALES.

thanks

mrutyun^