Application Development 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: 

Check field Initial.

lijisusan_mathews
Active Contributor
0 Kudos

hi,

is there some function module or other way by which i can check if a screen field, whose name is avalilable only at runtime as character field, is initial ?

Pls help..

Regards,

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You can use 'DYNP_VALUES_READ' to read selection screen values.

sample code -

it_dynpfields-fieldname = name. "-> select option to read

APPEND it_dynpfields.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy-cprog

dynumb = sy-dynnr

start_search_in_current_screen = 'X'

TABLES

dynpfields = it_dynpfields

EXCEPTIONS

invalid_abapworkarea = 1

invalid_dynprofield = 2

invalid_dynproname = 3

invalid_dynpronummer = 4

invalid_request = 5

no_fielddescription = 6

invalid_parameter = 7

undefind_error = 8

double_conversion = 9

stepl_not_found = 10

OTHERS = 11.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Regards,

Aparna Gaikwad

8 REPLIES 8

Former Member
0 Kudos

You can use 'DYNP_VALUES_READ' to read selection screen values.

sample code -

it_dynpfields-fieldname = name. "-> select option to read

APPEND it_dynpfields.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy-cprog

dynumb = sy-dynnr

start_search_in_current_screen = 'X'

TABLES

dynpfields = it_dynpfields

EXCEPTIONS

invalid_abapworkarea = 1

invalid_dynprofield = 2

invalid_dynproname = 3

invalid_dynpronummer = 4

invalid_request = 5

no_fielddescription = 6

invalid_parameter = 7

undefind_error = 8

double_conversion = 9

stepl_not_found = 10

OTHERS = 11.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Regards,

Aparna Gaikwad

former_member223537
Active Contributor
0 Kudos
Field-Symbols : <fs> type any.

Assign l_fieldaname to <fs>.

former_member217544
Active Contributor
0 Kudos

Hi,

Yes it is possible to check whether teh field is initial or not.

If field1 is the name of your screen element then try teh following logic:

Loop at screen.

if field1 is initial.

< required logic>

endif.

endloop.

Hope this will help.

Regards,

Swarna Munukoti.

0 Kudos

but i8n this case.. field1 will be having the name of the screen field right? i need to check if the value in that field is initial? Do i have to change the type of field1 to some predefined type. Mine is char now, so it will have the name of the screen field.

naveen_inuganti2
Active Contributor
0 Kudos

Hi...

Plz get back again to understand your reuirement.

To know the screen field's tech name...

1. Place the curser on that field

2. click on F1

3. Click on technical settings icon in pop-up window.

If you know the field desripton only like "sales district"..

1. goto se15.

2. expand abap dictionary, fields....

3. Enter this discription in Field description filed in the screen...

4. Excute...

YOu can get all the field and table name...

Thanks,

Naveen.I

0 Kudos

Sorry that is not my requirement. I can get the screen field name at runtime in some field say,... 'myfield'. this is of type c.. So this field will have the value 'IT_TABNAME-BUKRS'. BUt i want to check if this field has some value in it. I hope I am clear now. If not pls get back

0 Kudos

Thnx a lot..I got it using 'DYNP_VALUES_READ'

Regards,

Suzie

Former Member
0 Kudos

hi Suzie,

Can you reply me in detail.

there is one function module to read dynmaic value of field.

function module name : DYNP_VALUES_READ'

by this you cam get value in internal table it_dynpred.

you have to declare this things in top ...

DATA: IT_DYNPREAD TYPE STANDARD TABLE OF DYNPREAD,

WA_DYNPREAD LIKE LINE OF IT_DYNPREAD.

example.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = PROGNAME

DYNUMB = DYNNUM

TABLES

DYNPFIELDS = IT_DYNPREAD

EXCEPTIONS

INVALID_ABAPWORKAREA = 1

INVALID_DYNPROFIELD = 2

INVALID_DYNPRONAME = 3

INVALID_DYNPRONUMMER = 4

INVALID_REQUEST = 5

NO_FIELDDESCRIPTION = 6

INVALID_PARAMETER = 7

UNDEFIND_ERROR = 8

DOUBLE_CONVERSION = 9

STEPL_NOT_FOUND = 10

OTHERS = 11.

IF SY-SUBRC = 0.

READ TABLE IT_DYNPREAD WITH KEY FIELDNAME = 'ZINCHILD-INCOMPCODE'

INTO WA_DYNPREAD.

CHECK SY-SUBRC = 0.

regards,

Vipul Darji