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

condense

Former Member
0 Likes
1,528

Hi firends,

In vbap-matnr = ' 000123456'.

Iam getiing the follwoing value.

Now i need to pass

vbap-matnr vbap-vtweg vbap-vkorg

to the function module save_text in the follwoing format

000123456 200010

Since the material number is 18 digit.

but i have a 9 digit material number in vbap-matnr so i need 9 spaces in btween vbap-matnr and

vbap-vtweg.

How can i do that using condense statment.

Regards

Priyanka.

1 ACCEPTED SOLUTION
Read only

JozsefSzikszai
Active Contributor
0 Likes
1,437

>

> vbap-matnr vbap-vtweg vbap-vkorg

> to the function module save_text in the follwoing format

>

> 000123456 200010

>

> Since the material number is 18 digit.

> but i have a 9 digit material number in vbap-matnr so i need 9 spaces in btween vbap-matnr and

> vbap-vtweg.

>

> How can i do that using condense statment.

there is no way to that with the condense statement

if you need everything fix placed, than you have to use offset

target_field = vbap-matnr.

target_field+18 = vbap-vtweg ==> this will ensure that vbap-vtweg will start from 19th position!

and so on...

11 REPLIES 11
Read only

Former Member
0 Likes
1,437

U can use OUTPUT_FORMAT option in Write statement

OR Else.

Use conversion_exit_alpa_input FM.

Best Regards,

Flavya

Read only

Former Member
0 Likes
1,437

Hi Priyanka,

Did you try creating a constant with 9 spaces and concatenating it with matnr and the other field?

Best Regards,

Ram.

Read only

Former Member
0 Likes
1,437

Hi Priyanka,

Create a work area (say wa) that contains

vbap-matnr

vbap-vtweg

vbap-vkorg

Now move individual values for material, vtweg & sales org to wa-matnr wa-vtweg & wa-vkorg.

Now simply move wa to THEAD-TDNAME.

Hope this helps.

Read only

Former Member
0 Likes
1,437

For Material number use conversion exit CONVERSION_EXIT_MATN1_INPUT.

A

Read only

Former Member
0 Likes
1,437

how about this?

Read only

JozsefSzikszai
Active Contributor
0 Likes
1,438

>

> vbap-matnr vbap-vtweg vbap-vkorg

> to the function module save_text in the follwoing format

>

> 000123456 200010

>

> Since the material number is 18 digit.

> but i have a 9 digit material number in vbap-matnr so i need 9 spaces in btween vbap-matnr and

> vbap-vtweg.

>

> How can i do that using condense statment.

there is no way to that with the condense statement

if you need everything fix placed, than you have to use offset

target_field = vbap-matnr.

target_field+18 = vbap-vtweg ==> this will ensure that vbap-vtweg will start from 19th position!

and so on...

Read only

Former Member
0 Likes
1,437

Hi,

If you need leading 0's or dont need leading 0's then use.

pack & unpack

you will get the solution...

Thanks & Regards,

Krishna..

Read only

Former Member
0 Likes
1,437

Hi Priyanka,

You need to pass the concatenated value of MATNR VTWEG VKORG to the FM SAVE_TEXT.

So better use the following code.

DATA : w_matnr TYPE matnr,

w_vtweg TYPE vtweg,

w_vkorg TYPE vkorg,

w_objkey(24) TYPE c.

***Get the values to the 3 variables from corresponding tables.***

PERFORM conv_exit_alpha_output USING w_matnr.

PERFORM conv_exit_alpha_output USING w_vtweg.

PERFORM conv_exit_alpha_output USING w_vkorg.

&----


*& Form CONV_EXIT_ALPHA_OUTPUT

&----


FORM conv_exit_alpha_output USING p_val.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

input = p_val

IMPORTING

output = p_val.

ENDFORM. " CONV_EXIT_ALPHA_OUTPUT

CONCATENATE w_matnr w_vtweg w_vkorg INTO w_objkey.

***Now you can pass the w_objkey to the FM SAVE_TEXT.****

Hope this will solve your issue.

Regards,

Anand.

Read only

monalisa_biswal
Contributor
0 Likes
1,437

hi priyanka,

Construct a string with desired number of blank spaces and concatenate with other two parameters.

DATA: str1 TYPE string,

str2 TYPE string,

len type i.

str1 = ''.

len = strlen( text ).

len = 18 - len.

shift str1 right by len places.

concatenate vbap-matnr str1 vbap-vtweg into str2.

Hope it helps!

Mona

Read only

Former Member
0 Likes
1,437

Concatenate VBAK-VTWEG VBAK-VKORG into Tempstring.

TDLINE = VBAP-MATNR.

TDLINE+18(6) = Tempstring.

Here, the first 18 char of TDLINE is always reserved to Matnr .. irrespective of it length ...

I think this is more straight ...

Thanks,

Aditya. V

Read only

Former Member
0 Likes
1,437

see the following code

SELECT SINGLE k~telbx INTO mobno

FROM kna1 AS k

WHERE k~kunnr = itab-kunag.

CONDENSE mobno .