cancel
Showing results for 
Search instead for 
Did you mean: 

selection statemet problem

Former Member
0 Kudos

Here is one scenario.

this is related to Stock transport order between two plants.

In selection screen, vbrk-kunag and vbrp-werks(supplying plant) fields are there.

If vbrk-kunag field start with 'P'.I will get the second plant field By removing the initial 'P' in

field vbrk-kunag.

now i have to read zplants table with vbrp-werks and vbrk-kunag(Without Initial 'P') field .If it matches i have to substitute vbrp-werks field with zplants-plnt.

Zplants table has fields like werks & reswk(supplying plant),plnt.

In the selection screen, If multiple values are entered in vbrk-kunag field, I have to check the above condition (match) again, If it is not matches just i have to add "P123" value and don't remove the original supplying plant(vbrp-werks) from the selection.

how can i write the above statements...

Thanks in advance.

Fractal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

U can do this in the Validation part.

AT SELECTION-SCREEN OUTPUT on s_kunag.
 perform....

In that perform if u have multiple select option then while validating use

SELECT ... ENDSELECT

.

In that u can try to change as per ur requirement.

Hope this hleps.

Answers (2)

Answers (2)

Former Member
0 Kudos

Here is clear explanation.

Somebody developed a report, now i am doing some modifications.we have one form like "process data",In this i am adding my code.I want to validate that scenario before or after the following select statements.

1.some of skunag field values starts with 'P'.If skunag field start with 'P',By removing the initial 'P' in field skunag. I will get the second plant field.

Zplants table has fields like werks & reswk(supplying plant),plnt.now i have to read zplants table and have to match with swerks and skunag(Without Initial 'P') field .If it matches i have to substitute swerks field with zplants-plnt field.

2.In the selection screen, If multiple values are entered in skunag field,I have to check the above condition (match) again, If it is not matches just i have to

add "P123" value and don't remove the original supplying plant swerks from the selection.

SELECT vbeln kunag zuonr vkorg waerk fkart

FROM vbrk INTO

CORRESPONDING FIELDS OF TABLE itab

WHERE vbeln IN svbeln

AND kunag IN skunag.

LOOP AT itab.

SELECT vbeln posnr vgbel aubel aupos

matnr werks erdat arktx charg

fkimg vrkme prsdt netwr kzwi6

FROM vbrp INTO

CORRESPONDING FIELDS OF it

WHERE vbeln = itab-vbeln

AND vgbel IN svgbel

AND werks IN swerks

AND erdat IN serdat.

CHECK sy-subrc EQ 0.

thats it....

how can i write the select statements now...

Thanks in advance,

Fractal.

Former Member
0 Kudos

let me try , but not sure this is correct ans, i am little unable to understand you requirement.

variable1 = vbrk-kunag+0(1).

if variable1 is initial

...

endif

if not variable1 is initial

...

endif.

variable2 = vbrk-kunag+2(strlen - 1)

or select * from zplant into itab where

vbrp-werks = variable2.

regards.

just a try,