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

Character variable not getting populated

soumya_jose3
Active Contributor
0 Likes
1,059

Hi,

I am facing a strange situation in the below piece of code.

CLEAR:g_ltx, g_letter_dated, g_s_data-letter_dated.

SELECT SINGLE ltx FROM t247 INTO g_ltx

WHERE spras = 'EN' AND

mnr = g_month.

CONCATENATE g_date g_ltx g_year INTO g_letter_dated

SEPARATED BY space.

g_s_data-letter_dated = g_letter_dated.

Both g_s_data-letter_dated and g_letter_dated are charcater of 255 length.

The value '01 September 2009' of g_letter_dated is not getting assigned to g_s_data-letter_dated.

Can anybody tell me the reason and how to rectify it.

Thanks & Regards,

Soumya.

10 REPLIES 10
Read only

Former Member
0 Likes
1,017

Hi,

Did you try with MOVE statement?


MOVE g_letter_dated to g_s_data-letter_dated.

Also g_s_data-letter_data is a field of a internal table. You amy have to use MODIFY or APPEND statement to make it reflect in the internal table.

Regards,

Vikranth

Read only

0 Likes
1,017

Hi Vikrant,

I tried MOVE statement also. That is also not working.

g_s_data is a work area.

Inorder to modify the internal table from the work area, the field g_s_data-letter_dated needs to be populated.

Thanks & Regards,

Soumya.

Read only

0 Likes
1,017

Hi Soumya,

Set a break point at the statement g_s_data-letter_dated = g_letter_dated, check in debugging mode and check if the values are populating at that instant. May be you are clearing the work area at a latter part

Regards,

Vikranth

Read only

0 Likes
1,017

Hi Vikrant,

I tried it in debugging mode and found that g_s_data-letter_dated is not populating,

The strange part is that if I put another statement like 'g_s_data-letter_dated = sy-datum.'

after the ' g_s_data-letter_dated = g_letter_dated.' , g_s_data-letter_dated is populated .

CONCATENATE g_date g_ltx g_year INTO g_letter_dated

SEPARATED BY space.

g_s_data-letter_dated = g_letter_dated. ---> Populated with 01 September 2009

g_s_data-letter_dated = sy-datum. ---> then Populated with sy-datum

Thanks & Regards,

Soumya.

Read only

0 Likes
1,017

try using

SHIFT LEFT G_letter_dated deleting leading spaces .

after ur concatenate statement.

Read only

0 Likes
1,017

>

> CONCATENATE g_date g_ltx g_year INTO g_letter_dated

> SEPARATED BY space.

> g_s_data-letter_dated = g_letter_dated. ---> Populated with 01 September 2009

> g_s_data-letter_dated = sy-datum. ---> then Populated with sy-datum

>.

Here you have stated that g_s_data-letter_dated = g_letter_dated is populated with 01 September 2009. Which means g_s_data-letter_dated holds the value.

Correct me if am wrong.

Regards,

Vikranth

Read only

Former Member
0 Likes
1,017

Can we get the definitions of the variables like g_date, g_year etc also?

I defined the variable g_date as a two character variable and g_year as year and it worked fine for me.

Read only

0 Likes
1,017

My code is as below.

parameter: p_month LIKE t247-mnr.

DATA: g_ltx like t247-ltx,

g_letter_dated(255),

g_s_data-letter_dated(255),

g_date(2) value '01',

g_year(4) value '2009'.

CLEAR:g_ltx, g_letter_dated, g_s_data-letter_dated.

SELECT SINGLE ltx FROM t247 INTO g_ltx

WHERE spras = 'EN' AND

mnr = p_month.

CONCATENATE g_date g_ltx g_year INTO g_letter_dated

SEPARATED BY space.

g_s_data-letter_dated = g_letter_dated.

write:/ g_s_data-letter_dated.

Read only

0 Likes
1,017

My code is like this::

START-OF-SELECTION.

  • Populate pnpwerks based on MOLGA specified

PERFORM populate_pnpwerks.

g_mail = s_mail-low.

*Letter generated date.

g_year = sy-datum+0(4).

g_month = sy-datum+4(2).

g_date = sy-datum+6(2).

CLEAR:g_ltx, g_letter_dated, g_s_data-letter_dated.

SELECT SINGLE ltx FROM t247 INTO g_ltx

WHERE spras = 'EN' AND

mnr = g_month.

CONCATENATE g_date g_ltx g_year INTO g_letter_dated

SEPARATED BY space.

g_s_data-letter_dated = g_letter_dated.

GET pernr.

g_year, g_month and g_date are declared in a top include globally as:

DATA: g_year(4) TYPE c,

g_month(2) TYPE c,

g_date(2) TYPE c,

g_ltx TYPE t247-ltx,

g_letter_dated(255) TYPE c.

Regards,

Soumya.

Read only

Former Member
0 Likes
1,017

Hi,

i'm getting the value of g_s_data-letter_dated in the code as put by you.

By the way, how is the g_s_data-letter_dated defined in your code ?

regds, Anoop