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 VAlues

Former Member
0 Likes
1,108

Hi all

Am using the code below in which i my requirement is as follows if i enter the company code as 3456 i want the corresponding values of PERNR with reapect to 3456 but not all the values in the field of PERNR...please help

SELECTION-SCREEN BEGIN OF BLOCK a01.

SELECTION-SCREEN SKIP.

PARAMETERS:code LIKE bkpf-bukrs OBLIGATORY .

PARAMETERS:year LIKE bkpf-gjahr OBLIGATORY.

PARAMETERS:pernr1 LIKE zissue_master-pernr OBLIGATORY.

PARAMETERS:bookn LIKE zissue_master-bookno OBLIGATORY.

PARAMETERS:new LIKE zissue_master-pernr OBLIGATORY.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN END OF BLOCK a01.

10 REPLIES 10
Read only

Former Member
0 Likes
1,079

hi,

select pernr

from dbtable

into internal table

where code = 3456.

Read only

Former Member
0 Likes
1,079

Hi Vijay,

Check below code,

Replace your screen fields.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_belnr.

DESCRIBE TABLE it_hlp LINES wk_lines.

IF wk_lines = 0.

SELECT belnr gjahr bldat budat INTO CORRESPONDING FIELDS OF it_hlp

FROM bkpf

WHERE bukrs = b_bukrs AND

bstat = ' ' AND

blart IN s_blart.

APPEND it_hlp.

ENDSELECT.

ENDIF.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BELNR'

dynprofield = 'P_BELNR'

dynpprog = sy-cprog

dynpnr = sy-dynnr

value_org = 'S'

TABLES

value_tab = it_hlp.

Reward if useful!

Read only

gopi_narendra
Active Contributor
0 Likes
1,079

Hi Vijay,

just add the where condition as done below.

You will get the pernrs for that company code only

<b>You just need to add the BUKRS validation in your select query, thats all you will get all the PERNRs related to that company code.</b>

* F4 on PERNR1
at selection-screen on value-request for PERNR1.
 
  select PERNR from ZISSUE_MASTER
           into IT_F4PERNR
           where BUKRS = CODE.
  if SY-SUBRC = 0.
    sort IT_F4PERNR by PERNR.
  endif.

Please reward all useful answers

Regards

Gopi

Read only

0 Likes
1,079

Hi Gopi

I did as you mentioned but this time the F4 fuctionality is not working...please help

vijay

Read only

0 Likes
1,079

Does the ZISSUE_MASTER Table has a BUKRS (Company Code)?

the possibilites are the table might not have a relation with BUKRS. If so we can not get the PERNR's related to a company code.

Please paste your code here.

Regards

Gopi

Read only

rainer_hbenthal
Active Contributor
0 Likes
1,079

I Suggest using the logical database PNP.

Read only

varma_narayana
Active Contributor
0 Likes
1,079

Hi...

Check the following steps of code:

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PERNR.

***This function returns the entered value of BUKRS (company CODE)

call function <b>'DYNP_VALUES_READ'</b>

In the <b>select query</b> use this company code and then

call the <b>F4IF_INT_TABLE_VALUE_REQUEST</b> function module.

<b>Reward if helpful.</b>

Read only

0 Likes
1,079

Hi narayan

Please specify the fields that i need o give in the FUNCTION 'DYNP_VALUES_READ'

vijay

Read only

Former Member
0 Likes
1,079

Check this Program, It helps lot I think.

**************************

type-pools: vrm.

tables: zbankcode,

zuserdata,

zuserdetails,

zselord,

zbuyord,

zexch,

sscrfields.

data: v type vrm_values.

data: dropdown like line of v.

  • VARS for dynamic screen population

data: progname type sy-repid,

dynnum type sy-dynnr,

dynpro_values type table of dynpread,

field_value like line of dynpro_values.

data: return type table of ddshretval with header line.

data: dynfields type table of dynpread with header line.

*VARS for selection-screen population

data: t_clde like zexch-stock,

t_currpr like zexch-currpr,

t_char(10).

data: begin of temp_itab occurs 0,

st_code like zexch-stock,

st_name like zexch-st_name,

currpr like zexch-currpr,

end of temp_itab.

selection-screen: begin of block b1 with frame title text-002,

begin of line,

position 1,

comment 1(10) text-r01 for field buy.

parameters: buy radiobutton group g1.

selection-screen: position 16,

comment 16(10) text-r02 for field sell.

parameters: sell radiobutton group g1.

selection-screen: end of line.

parameters: exch(3) type c as listbox visible length 10,

st_name like zexch-st_name,

st_code like zexch-stock,

currpr like zexch-currpr,

limpr like zbuyord-limpr,

qty like zbuyord-qty.

selection-screen end of block b1.

INITIALIZATION.

*VARS for dynamic screen population

progname = sy-repid.

dynnum = sy-dynnr.

*VARS for population of dropdown

dropdown-key = '1'.

dropdown-text = 'BSE'.

append dropdown to V.

dropdown-key = '2'.

dropdown-text = 'NSE'.

append dropdown to V.

call function 'VRM_SET_VALUES'

exporting

ID = 'EXCH'

values = V

exceptions

id_illegal_name = 1

others = 2.

AT selection-screen on value request for st_name.

clear: field_value, dynpro_values.

refresh dynpro_values.

field_value-fieldname = 'EXCH'.

append field_value to dynpro_values.

Call Function 'DYNP_VALUES_READ'

exporting

dyname = sy-cprog

dynumb = sy-dynnr

translate_to_upper = 'X'

tables

dynpfields = dynpro_values.

read table dynpro_values index 1 into field_value.

if field_value-fieldvalue is not initial.

if sy-subrc = 0 and field_value-fieldvalue = 1.

field_value-fieldvalue = 'BSE'.

elseif sy-subrc = 0 and field_value-fieldvalue = 2.

field_value-fieldvalue = 'NSE'.

endif.

select stock

st_name

currpr

from zexch

into table temp_itab

where exch = field_value-fieldvalue.

callfunction 'F4IF_INT_TABLE_VALUE_REQUEST'

exporting

retfield = 'ST_NAME'

dynpprog = SY-CPROG

DYNPNR = SY-DYNNR

DYNPROFIELD = 'ST_NAME'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = TEMP_ITAB

RETURN_TAB = RETURN.

SELECT STOCK

CURRPR

FROM ZEXCH

INTO (T_CODE, T_CURRPR)

WHERE ST_NAME = RETURN-FIELDVAL.

ENDSELECT.

CLEAR DYNPRO_VALUES[].

FIELD_VALUE-FIELDNAME = 'ST_NAME'.

FIELD_VALUE-FIELDVALUE = RETURN-FIELDVAL.

APPEND FIELD_VALUE TO DYNPRO_VALUES.

FIELD_VALUE-FIELDNAME = 'ST_CODE'.

FIELD_VALUE-FIELDVALUE = T_CODE.

APPEND FIELD_VALUE TO DYNPRO_VALUES.

FIELD_VALUE-FIELDNAME = 'CURRPR'.

FIELD_VALUE-FIELDVALUE = T_CURRPR.

APPEND FIELD_VALUE TO DYNPRO_VALUES.

*update the dynpro values.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

DYNAME = SY-CPROG

DYNUMB = SY-DYNNR

TABLES

DYNFIELDS = DINPRO_VALUES.

ENDIF.

Regards,

Manju

Read only

Former Member
0 Likes
1,079

hh