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

F4IF_INT_TABLE_VALUE_REQUEST

Former Member
0 Likes
1,610

Dear Friends,

I am filling my list box in module pool program threw F4IF_INT_TABLE_VALUE_REQUEST this Fm module. My list box is filling but when am going to save that value i want to save description id in the table insted of description how i have to do that thing .

Select CERTIFICATEID CERTIFICATENAME from ZHR_T_CERTIFICAT INTO CORRESPONDING FIELDS OF TABLE itab_Certificate.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'CERTIFICATENAME'

value_org = 'S'

TABLES

value_tab = itab_Certificate

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

thanks

18 REPLIES 18
Read only

Former Member
0 Likes
1,571

Hi,

if you want to display the description id then pass that particular filed to the FM and return that into an internal table :


CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING
retfield = 'CERTIFICATEID'
value_org = 'S'

TABLES
value_tab = itab_Certificate
 return_tab   = gt_certificateid_returned

EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.

IF sy-subrc EQ 0.
    IF NOT gt_certificateid_returned[] IS INITIAL.
      READ TABLE gt_certificateid_returned INTO gs_certificateid_returned INDEX 1.
      p_certificateid = gs_certificateid_returned-fieldval.
    ENDIF.
  ENDIF.

I hope thsi will solve your problem..

Read only

0 Likes
1,571

Sneha,

I want to display the CertificateName(Desc) But in the table i want to save the CertificateID(Descid) my list box is populating with Certificate Name(Desc) but when am going to save it's saving the Certificate Name(Desc) i want to save the ID.

thanks

Read only

0 Likes
1,571

Hi,

I think you need to fill KEY also.

Check the below code.

TYPE-POOLS : vrm. "Value Request Manager

tables: zkk_test.

PARAMETERS: p_test AS LISTBOX VISIBLE LENGTH 12 OBLIGATORY.

INITIALIZATION.

PERFORM f4_value_request.

START-OF-SELECTION.

zkk_test-sno = p_test.

insert zkk_test.

WRITE P_TEST.

*&----


*& Form f4_value_request

*&----


  • text

*----


FORM f4_value_request.

DATA: l_name TYPE vrm_id,

li_list TYPE vrm_values,

l_value LIKE LINE OF li_list.

l_value-key = 'A'.

l_value-text = 'January'.

APPEND l_value TO li_list.

CLEAR l_value.

l_value-key = 'B'.

l_value-text = 'February'.

APPEND l_value TO li_list.

CLEAR l_value.

l_value-key = 'C'.

l_value-text = 'March'.

APPEND l_value TO li_list.

CLEAR l_value.

l_value-key = 'D'.

l_value-text = 'April'.

APPEND l_value TO li_list.

CLEAR l_value.

l_value-key = 'E'.

l_value-text = 'May'.

APPEND l_value TO li_list.

CLEAR l_value.

l_value-key = 'F'.

l_value-text = 'June'.

APPEND l_value TO li_list.

CLEAR l_value.

l_value-key = 'G'.

l_value-text = 'July'.

APPEND l_value TO li_list.

CLEAR l_value.

l_value-key = 'H'.

l_value-text = 'August'.

APPEND l_value TO li_list.

CLEAR l_value.

l_value-key = 'I'.

l_value-text = 'September'.

APPEND l_value TO li_list.

CLEAR l_value.

l_value-key = 'J'.

l_value-text = 'October'.

APPEND l_value TO li_list.

CLEAR l_value.

l_value-key = 'K'.

l_value-text = 'November'.

APPEND l_value TO li_list.

CLEAR l_value.

l_value-key = 'L'.

l_value-text = 'December'.

APPEND l_value TO li_list.

CLEAR l_value.

l_name = 'P_TEST'.

p_test = 'A'. "this is to set the default value of the list box.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = l_name

values = li_list

EXCEPTIONS

id_illegal_name = 1

OTHERS = 2.

IF sy-subrc = 0.

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

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

ENDIF.

ENDFORM. " f4_value_request

Regards,

Kumar Bandanadham

Read only

0 Likes
1,571

Hi

i would like to add a little more to what sneha mentioned

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'CERTIFICATENAME'

value_org = 'S'

TABLES

value_tab = itab_Certificate

return_tab = gt_certificateid_returned

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc EQ 0.

IF NOT gt_certificateid_returned[] IS INITIAL.

READ TABLE gt_certificateid_returned INTO gs_certificateid_returned INDEX 1.

READ TABLE itab_certificate into fs_certificate with key gs_certicateid_returned-certificatename. " So now fs_certificate will have name as well as id . so now save the id where ever you want.

ENDIF.

ENDIF.

Read only

0 Likes
1,571

Hello SANDEEEP ,

the above post is correct . i want the same requirment .

Write : -

data : get_selected_return_code TYPE TABLE OF ddshretval WITH HEADER LINE.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'CERTIFICATENAME'

dynpprog = progname

dynpnr = dynnum

value_org = 'S'

TABLES

value_tab = itab_Certificate

return_tab = get_selected_return_code .

IF sy-subrc <> 0.

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

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

ENDIF.

IF NOT get_selected_return_code [] IS INITIAL.

READ TABLE get_selected_return_code INTO get_selected_return_code INDEX 1.

p_certificateid = get_selected_return_code -fieldval.

ENDIF.

your CERTIFICATEID in the Fieldval. u can see in the debug mode.

Regards,

vandana.

Read only

0 Likes
1,571

Hello Vendana,

I write code what you said but get_selected_return_code in that fields not coming any value .I am mention my code also kindly find wher am doing wrong.

DATA: WA_Certificate type type_Certificate.

data : get_selected_return_code TYPE TABLE OF ddshretval WITH HEADER LINE.

Select CERTIFICATEID CERTIFICATENAME from ZHR_T_CERTIFICAT INTO CORRESPONDING FIELDS OF TABLE itab_Certificate.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'CERTIFICATENAME'

value_org = 'S'

TABLES

value_tab = itab_Certificate

return_tab = get_selected_return_code

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF NOT get_selected_return_code[] IS INITIAL.

READ TABLE get_selected_return_code INTO get_selected_return_code INDEX 1.

P9005-YYYEDU_DEATIL = get_selected_return_code-fieldval.

ENDIF.

thanks

Read only

0 Likes
1,571

Dear Viquar,

I write code what you said but get_selected_return_code in that fields not coming any value .I am mention my code also kindly find wher am doing wrong.

DATA: WA_Certificate type type_Certificate.

data : get_selected_return_code TYPE TABLE OF ddshretval WITH HEADER LINE.

Select CERTIFICATEID CERTIFICATENAME from ZHR_T_CERTIFICAT INTO CORRESPONDING FIELDS OF TABLE itab_Certificate.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'CERTIFICATENAME'

value_org = 'S'

TABLES

value_tab = itab_Certificate

return_tab = get_selected_return_code

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF NOT get_selected_return_code[] IS INITIAL.

READ TABLE get_selected_return_code INTO get_selected_return_code INDEX 1.

P9005-YYYEDU_DEATIL = get_selected_return_code-fieldval.

ENDIF.

thanks

Read only

Former Member
0 Likes
1,571

Hi,

Then pass the certificate name to your FM.. And the internal table what is returned send your certificate id...


  READ TABLE gt_certificateid_returned INTO gs_certificateid_returned INDEX 1.
      p_matnr = gs_certificateid_returned-fieldval.

Read only

0 Likes
1,571

Hello Sneha,

I write code what you said but get_selected_return_code in that fields not coming any value .I am mention my code also kindly find wher am doing wrong.

DATA: WA_Certificate type type_Certificate.

data : get_selected_return_code TYPE TABLE OF ddshretval WITH HEADER LINE.

Select CERTIFICATEID CERTIFICATENAME from ZHR_T_CERTIFICAT INTO CORRESPONDING FIELDS OF TABLE itab_Certificate.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'CERTIFICATENAME'

value_org = 'S'

TABLES

value_tab = itab_Certificate

return_tab = get_selected_return_code

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF NOT get_selected_return_code[] IS INITIAL.

READ TABLE get_selected_return_code INTO get_selected_return_code INDEX 1.

P9005-YYYEDU_DEATIL = get_selected_return_code-fieldval.

ENDIF.

thanks

Read only

0 Likes
1,571

Hi,

You have to write like this :


Select CERTIFICATEID CERTIFICATENAME from ZHR_T_CERTIFICAT
 INTO CORRESPONDING FIELDS OF TABLE itab_Certificate.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING
retfield = 'ZHR_T_CERTIFICAT-CERTIFICATENAME' <------Mention the table name also..
dynpprog     = Sy-repid
 dynpnr       = sy-dynnr
value_org = 'S'

TABLES
value_tab = itab_Certificate
return_tab = get_selected_return_code

EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.

IF NOT get_selected_return_code[] IS INITIAL.
READ TABLE get_selected_return_code INTO get_selected_return_code INDEX 1.
P9005-YYYEDU_DEATIL = get_selected_return_code-fieldval.
ENDIF.

I think this will solve your problem..

One more thing which you can try is Instaed of using 'INTO CORRSPONDING FIELDS' try declaring a 'ITAB_CERTIFICATE' with only those two fields which you need..


Select CERTIFICATEID CERTIFICATENAME from ZHR_T_CERTIFICAT
 INTO TABLE itab_Certificate.

Edited by: sneha singhania on Jun 22, 2009 1:26 PM

Read only

0 Likes
1,571

Sneha,

If am using the table name with fields it's giving the short dump.

And if am am using onlt the field name CERTIFICATENAME that case get_selected_return_code dosn't contain any valueee.

thanks

Read only

Former Member
0 Likes
1,571

Hi,

check the below code

CASE SY-UCOMM.

when 'SAVE'.

=============

if sy-subrc eq 0.

read table itab_certificate into wa_certificate with key certifcatename = listbox-value.

if sy-subrc eq 0.

update ztable from wa_certificate set certiifcateid = wa_certificate-certificateid.

endif.

endif.

==============

Thanks & Regards,

Sateesh.

Read only

Former Member
0 Likes
1,571

Hi Sandeep,

Please check if you have declared the table :

Tables: ZHR_T_CERTIFICAT.

Also as i hve suggested earlier can you please create the 'ITAB_CERTIFIACTE' in such a way that it holds only the fields you require to be selected from this table.

Read only

0 Likes
1,571

Hi Sneha,

I am sending my whole code am doing the same as you told kindly help me to finding the Error .Types: BEGIN OF type_Certificate,

CERTIFICATEID type ZHR_T_CERTIFICAT-CERTIFICATEID,

CERTIFICATENAME type ZHR_T_CERTIFICAT-CERTIFICATENAME,

END OF type_Certificate.

DATA itab_Certificate TYPE STANDARD TABLE

OF type_Certificate WITH HEADER LINE.

DATA: WA_Certificate type type_Certificate.

Data : get_selected_return_code TYPE TABLE OF ddshretval WITH HEADER LINE.

Data : wa_get_selected_return_code type ddshretval.

Select CERTIFICATEID CERTIFICATENAME from ZHR_T_CERTIFICAT INTO TABLE itab_Certificate.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'CERTIFICATENAME'

dynpprog = Sy-repid

dynpnr = sy-dynnr

value_org = 'S'

TABLES

value_tab = itab_Certificate

return_tab = get_selected_return_code

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc EQ 0.

IF NOT get_selected_return_code[] IS INITIAL.

READ TABLE get_selected_return_code INTO wa_get_selected_return_code INDEX 1.

P9005-YYYEDU_DEATIL = get_selected_return_code-fieldval.

ENDIF.

ENDIF.

Read only

0 Likes
1,571

Hi,

Please try this :


Types:  BEGIN OF type_Certificate,
        CERTIFICATEID type ZHR_T_CERTIFICAT-CERTIFICATEID,
        CERTIFICATENAME type ZHR_T_CERTIFICAT-CERTIFICATENAME,
        END OF type_Certificate.

DATA : itab_Certificate TYPE STANDARD TABLE OF type_Certificate,   
            WA_Certificate   type type_Certificate,
          get_selected_return_code TYPE standard TABLE OF ddshretval,
          wa_get_selected_return_code type ddshretval.

Select CERTIFICATEID CERTIFICATENAME from ZHR_T_CERTIFICAT INTO TABLE itab_Certificate.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING
retfield = 'CERTIFICATEID' <----- Since, you want to display Certificate ID change this ..
dynpprog = Sy-repid
dynpnr = sy-dynnr
value_org = 'S'

TABLES
value_tab = itab_Certificate
return_tab = get_selected_return_code

EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.

IF sy-subrc EQ 0.
IF NOT get_selected_return_code[] IS INITIAL.

READ TABLE get_selected_return_code INTO wa_get_selected_return_code INDEX 1.
P9005-YYYEDU_DEATIL = wa_get_selected_return_code-fieldval.
ENDIF.
ENDIF.

I think this should solve your problem.

Moreover, your declaration is also wrong. Why are you declaring work area for the internal table again, if you are declaring it with header line. Either Use as i have decalred or simply declare it with header line.

Let me know if it still persists..

Read only

Former Member
0 Likes
1,571

Hi Sandeep,

Since, you want to save 'Certificate ID' please try this :


CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING
retfield = 'CERTIFICATENAME'      <------ Give the field name as 'Ceritificate ID'
value_org = 'S'

TABLES
value_tab = itab_Certificate
returned_tab = gt_returned_code

EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.

Read only

0 Likes
1,571

Snehaa,

But now in my list box ID and Name both coming i want to show in list box only name and in the background corresponding id want to save ,got it Kindly help me te resolve my problem.

thanks

Read only

Former Member
0 Likes
1,571

Hi,

I don't think this is possible.. Because whtever you send in 'value_tab' all those fields and its value will be displayed in the F4 help... And depending on that only you can save the value in the parameter.. You can decide which field value you want to display out of the entire list in the F4 help.. But, to display one field and to display another value is not possible.. I think you can go with the result you are getting now..

anyways here's a demo program:

DEMO_DYNPRO_F4_HELP_MODULE..

Please check if it helps you..