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

select options

Former Member
0 Likes
1,042

hi,

if i want to have kunnr (s_kunnr) in select-options where only parvw = 'SH' or 'WE', how to restrict that?

if user leave it empty, how do i put the IN s_kunnr in the select statement?

thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
818

Since SH and WE are equivalent when input as a select-option (both result in Ship-To partner). You could verify this using the conversion routine FM CONVERSION_EXIT_PARVW_OUTPUT - both will output as 'WE'.

Because of this, you could simply use:

select * from knvp

into table it_kvnp

where parvw eq 'WE'.

If you wanted to create a custom a select option, in your initialization or start-of-selection, you could populate the select-option internal table which is equivalent to a range object.

DATA: lv_parvw type parvw.

RANGES: r_parvw for lv_parvw.

MOVE: 'I' TO R_PARVW-SIGN,

'EQ' TO R_PARVW-OPTION,

'SH' TO R_PARVW-LOW.

APPEND R_PARVW.

MOVE: 'I' TO R_PARVW-SIGN,

'EQ' TO R_PARVW-OPTION,

'WE' TO R_PARVW-LOW.

APPEND R_PARVW.

select * from knvp

into table it_kvnp

where parvw in r_parvw.

4 REPLIES 4
Read only

Former Member
0 Likes
819

Since SH and WE are equivalent when input as a select-option (both result in Ship-To partner). You could verify this using the conversion routine FM CONVERSION_EXIT_PARVW_OUTPUT - both will output as 'WE'.

Because of this, you could simply use:

select * from knvp

into table it_kvnp

where parvw eq 'WE'.

If you wanted to create a custom a select option, in your initialization or start-of-selection, you could populate the select-option internal table which is equivalent to a range object.

DATA: lv_parvw type parvw.

RANGES: r_parvw for lv_parvw.

MOVE: 'I' TO R_PARVW-SIGN,

'EQ' TO R_PARVW-OPTION,

'SH' TO R_PARVW-LOW.

APPEND R_PARVW.

MOVE: 'I' TO R_PARVW-SIGN,

'EQ' TO R_PARVW-OPTION,

'WE' TO R_PARVW-LOW.

APPEND R_PARVW.

select * from knvp

into table it_kvnp

where parvw in r_parvw.

Read only

Former Member
0 Likes
818

Declare the following in ur program:

data :wa_test like line of s_kunnr.

data : t_tab type standard table of wa_test with headerline.

loop at s_kunnr into wa_test.

*/ now ur kunnr is in wa_kunnr-low.Write logic to

verify whether the parvw for that kunnr is 'SH'/'WE' or not.

IF its there then move the

record to another internal table t_tab

ie append wa_test to t_tab./*

endloop.

*/-- Now t_tab contains the list of desired kunnr s.

*/- If you want to validate it on screen itself create a search help for the field and

attach it to the selection field for Kunnr.

*/Now if S_kunnr is empty

if t_tab is initial.

wa_kunnr-low = '*'.

append wa_kunnr to t_tab.

endif.

Read only

Former Member
0 Likes
818

Hi,

I do not think this is possible. Instead write your code like this.

Here,

- First allow user to enter any customer numner

- Then, at selection-screen event, filter customer based on partner function 'WE'. If you do not find any customer, give error message. So, the program won't execute further.

- In start-of-selection event ( it will be executed if there is any customer for partner function 'WE'. ), select data for whichever table you want for all entries in customer table.

Let me know if you have any question.

*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
TABLES: kna1, knvp.

CONSTANTS: c_parvw LIKE knvp-parvw VALUE 'WE'.

DATA: BEGIN OF lit_customer OCCURS 0,
        kunnr LIKE kna1-kunnr,
        parvw LIKE knvp-parvw,
      END OF lit_customer.

DATA: lit_vakpa LIKE vakpa OCCURS 0 WITH HEADER LINE.

SELECT-OPTIONS: s_kunnr FOR kna1-kunnr OBLIGATORY.

AT SELECTION-SCREEN.

  CLEAR:   lit_customer.
  REFRESH: lit_customer.

*" get all ship-to-party customer
  SELECT
        kunnr
        parvw FROM knvp
              INTO TABLE lit_customer
              WHERE kunnr IN s_kunnr AND
                    parvw = c_parvw.

  IF lit_customer[] IS INITIAL.
*"  give error message with appropriate message no and class.
    MESSAGE e001(z01) WITH 'No customer exist for selected criteria'.
  ENDIF.

START-OF-SELECTION.

*" read sales document data based on selected customer
  SELECT
        * FROM vakpa
          INTO TABLE lit_vakpa
          FOR ALL ENTRIES IN lit_customer
          WHERE kunde = lit_customer-kunnr.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*

Regards,

RS

Read only

Former Member
0 Likes
818

Hi

In this case u can fill the low and high column using selection table.Goto the table rsparams and check the entries.So add all entries for your S_kunnr and append it.So that you can set the entries by default so if user leave the column empty , then also no problem..Reward all the helpfull answers..