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

sql statments with constats

Former Member
0 Likes
935

Hi,

I want to fill an internal table (2 fields) and a constat value ('CONFIRMED') to every line.

Below gives me an error.

Any pointers ?

select

X_EKKO~EBELN

'CONFIRMED'

from EKKO as X_EKKO

inner join LFA1 as X_LFA1 on X_LFA1LIFNR = X_EKKOLIFNR

inner join EKPO as X_EKPO on X_EKPOEBELN = X_EKKOEBELN

inner join EKES as X_EKES on X_EKESEBELN = X_EKPOEBELN AND X_EKESEBELP = X_EKPOEBELP

into table i_MasterDataConf

where

(where_clause)

AND X_EKES~EINDT > l_enddate2.

//Martin

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
885

Hello Martin,

You cannot use the literal 'CONFIRMED' in the SELECT statement !! The SELECT statement allows you to only <i>select</i> the data <i>from the database</i>.

In your code, use the addition INTO CORRESPONDING FIELDS OF i_MasterDataConf.

Then fill the internal table with the value 'CONFIRMED' in the second field of all rows using the statement

MODIFY ITAB FROM ITAB TRANSPORTING <NAME OF THE SECOND FIELD> WHERE <SECOND FIELD> EQ SPACE.

Regards,

Anand Mandalika.

8 REPLIES 8
Read only

Former Member
0 Likes
885

Hello,

First of all you can select all the data from the transparent table into IntTab.

Then you can fill the constant value by LOOP ... MODIFY InTab. ... ENDLOOP.

Regards, Murugesh AS

Read only

Former Member
0 Likes
886

Hello Martin,

You cannot use the literal 'CONFIRMED' in the SELECT statement !! The SELECT statement allows you to only <i>select</i> the data <i>from the database</i>.

In your code, use the addition INTO CORRESPONDING FIELDS OF i_MasterDataConf.

Then fill the internal table with the value 'CONFIRMED' in the second field of all rows using the statement

MODIFY ITAB FROM ITAB TRANSPORTING <NAME OF THE SECOND FIELD> WHERE <SECOND FIELD> EQ SPACE.

Regards,

Anand Mandalika.

Read only

0 Likes
885

I read the help section but did not understand the Mass Update stuff:

I tried:

MODIFY i_MasterDataConf FROM i_MasterDataConf TRANSPORTING 'CONFIRMED' WHERE X_STATUS EQ SPACE.

//Martin

Read only

0 Likes
885

I assume a particular <b>field</b> of the internal table i_masterdataconf should have the <b>value</b> 'CONFIRMED'.

So code can be :


i_masterdataconf-<i>fieldname</i> = '<b>CONFIRMED</b>'.
MODIFY i_MasterDataConf FROM i_MasterDataConf TRANSPORTING <i>fieldname</i> WHERE X_STATUS EQ SPACE.

if sy-subrc <> 0.
endif.

Regards,

Subramanian V.

Read only

0 Likes
885

oppss... I'm inside BSP. Sorry.

Maybe we can solve this anyway.

Type Def:

types: begin of t_MasterDataStruct,

X_EKKO_EBELN type EKKO-EBELN,

X_STATUS type string,

end of t_MasterDataStruct.

types: tt_MasterDataStruct type table of t_MasterDataStruct.

"i_MasterDataConf is of the type tt_MasterDataStruct"

i_MasterDataConf-X_STATUS = 'CONFIRMED'.

MODIFY i_MasterDataConf FROM i_MasterDataConf TRANSPORTING X_STATUS.

Error:

"I_MASTERDATACONF" is a table without a header line and therefore has no component called "X_STATUS".

//Martin

Read only

0 Likes
885

Hi,

Some minor modifications, look at bold statements:

<b>DATA: wa_t_MasterDataStruct TYPE LINE OF tt_MasterDataStruct </b>.

>

> "i_MasterDataConf is of the type

> tt_MasterDataStruct"

>

>

> <b>wa_t_MasterDataConf-X_STATUS = 'CONFIRMED'.

> MODIFY i_MasterDataConf FROM wa_t_MasterDataConf

> TRANSPORTING X_STATUS.

> </b>

>

Regards

Message was edited by: Shehryar Khan

Read only

0 Likes
885

Getting there...

I got an error (Internal server error.)

It doesn't like the Modify statement.

data: wa_t_MasterDataStruct TYPE LINE OF tt_MasterDataStruct .

wa_t_MasterDataStruct-X_STATUS = 'CONFIRMED'.

MODIFY i_MasterDataConf FROM wa_t_MasterDataStruct TRANSPORTING X_STATUS.

//MA

Read only

0 Likes
885

Forgot the where clause ???

Regards,

Subramanian V.