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 a specific record from a list!

Former Member
0 Likes
1,987

Hello0o Gentelmen,

i've create a table with 3 keys ( clint, customer_no, and begin_date ) and 2 other fields called ( credit_used, credit_allowed )..

in my program i use FM 'F4IF_INT_TABLE_VALUE_REQUEST' and it works fine with me... but when i select any record from the list, the first field in the table is displayed .. not the selected record.

note that ( customer_no ) is my condition to display the whole record into the I/O fields

this is the code...

CASE ok_code.

WHEN 'BACK'.

SET SCREEN 0.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN 'OK'.

SELECT SINGLE * FROM ycustomer_t INTO G_TAB_CON_WA

WHERE customer_no = F2. // F2 is the screen field

IF sy-subrc EQ 0 .

MOVE-CORRESPONDING G_TAB_CON_WA to ycustomer_t.

ELSE.

MESSAGE 'customer number you entered is not found' type 'I'.

CLEAR G_TAB_CON_WA-clint.

CLEAR G_TAB_CON_WA-customer_no.

CLEAR G_TAB_CON_WA-begin_date.

CLEAR G_TAB_CON_WA-credit_used.

CLEAR G_TAB_CON_WA-credit_allowed.

ENDIF.

WHEN 'SAVE'.

MODIFY ycustomer_t FROM G_TAB_CON_WA.

MESSAGE ' Data has been updated' TYPE 'I'.

ENDCASE.

this is the FM code...

select * from ycustomer_t INTo CORRESPONDING FIELDS OF TABLE G_TAB_CON_ITAB.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'CUSTOMER_NO' "Key field from ycustomer_t

dynpprog = sy-repid "Program

dynpnr = sy-dynnr "Dynpro number

dynprofield = 'F2' "Screen field field

value_org = 'S' "Value return: C: cell by cell, S: structured

  • display = 'F' "Override readiness for input

TABLES

value_tab = G_TAB_CON_ITAB

return_tab = return

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

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

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

ENDIF.

please help!!

thanks

Hello0o Gentelmen,

i've create a table with 3 keys ( clint, customer_no, and begin_date ) and 2 other fields called ( credit_used, credit_allowed )..

in my program i use FM 'F4IF_INT_TABLE_VALUE_REQUEST' and it works fine with me... but when i select any record from the list, the first field in the table is displayed .. not the selected record.

note that ( customer_no ) is my condition to display the whole record into the I/O fields

this is the code...

CASE ok_code.

WHEN 'BACK'.

SET SCREEN 0.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN 'OK'.

SELECT SINGLE * FROM ycustomer_t INTO G_TAB_CON_WA

WHERE customer_no = F2. // F2 is the screen field

IF sy-subrc EQ 0 .

MOVE-CORRESPONDING G_TAB_CON_WA to ycustomer_t.

ELSE.

MESSAGE 'customer number you entered is not found' type 'I'.

CLEAR G_TAB_CON_WA-clint.

CLEAR G_TAB_CON_WA-customer_no.

CLEAR G_TAB_CON_WA-begin_date.

CLEAR G_TAB_CON_WA-credit_used.

CLEAR G_TAB_CON_WA-credit_allowed.

ENDIF.

WHEN 'SAVE'.

MODIFY ycustomer_t FROM G_TAB_CON_WA.

MESSAGE ' Data has been updated' TYPE 'I'.

ENDCASE.

this is the FM code...

select * from ycustomer_t INTo CORRESPONDING FIELDS OF TABLE G_TAB_CON_ITAB.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'CUSTOMER_NO' "Key field from ycustomer_t

dynpprog = sy-repid "Program

dynpnr = sy-dynnr "Dynpro number

dynprofield = 'F2' "Screen field field

value_org = 'S' "Value return: C: cell by cell, S: structured

  • display = 'F' "Override readiness for input

TABLES

value_tab = G_TAB_CON_ITAB

return_tab = return

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

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

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

ENDIF.

please help!!

thanks

8 REPLIES 8
Read only

Former Member
0 Likes
1,365

Hi White ,

Please check value to the Parameter "dynpro field" you are passing. it should be your screen field name. if you have a doubt ,Check the same by pressing F1 on the particular field --> techinical information --> Screen Field.

Read only

0 Likes
1,365

thanks for reply...

i've checked it, there are no any documentation to that field since it's a customer program and i didn't do any docx to it.

i guess the problem when reading from the select statmenet... it only see the first record in the table... not the selected 1 from the F4 List!!!!!

any other suggestions please?

thanks again for help

Read only

0 Likes
1,365

Hi White ,

If So Please open that Custom Screen in SE51 and Identify the Field Name. Pass the Field name to Parameter 'Dynprofield' .

After calling the FM , Write Code to pass the value of the Selected internal table Field to Screen Field between the Sy-Subrc = 0 If Condition .

i.e .,

If SY-SUBRC = 0.

ScreenField name = G_TAB_CON_WA-Customer_no

Endif.

Please try out. It will work.

Read only

0 Likes
1,365

it didn't work :(...

check the first code i put, maybe bcoz i have 3 key fields and in my condition i'm only checking with 1 field which is customer_no??? thats why it's selecting the first record faced!!!!

Read only

0 Likes
1,365

Hi White ,

Whats the requirement exactly ?

FM "F4IF_INT_TABLE_VALUE_REQUEST" is used for Displaying F4 help from your ITAB ( when user goes for F4 help for a particular screen field) . From the Displayed records user will select a particlur record. we will mention in the exporting Parameter to which screen Field( DYNPROFIELD ) data to be Displayed. after calling the FM , we will be checking SY-SUBRC value , if its zero we will be assigning ITAB-Field to Screenfield.

As per your Code you are selecting single record from internal table. it will select only one record. obviously it will display the same record value in the Screen as well.

-


If you want to utilize the FM "F4IF_INT_TABLE_VALUE_REQUEST" ,

populate internal table properly which has to be displayed as a input Help.

In your Screen Flow Logic , Aftter PAI modules , under PROCESS ON VALUE-REQUEST , For your field you need to create a new routine and place your Code ( Only the F4 help Call Function ) and Include the Code (SY-SUBRC = 0 ) which i mentioned above.

for Example.

PROCESS BEFORE OUTPUT.

Module PBO_Module1.

PROCESS AFTER INPUT.

Module PAI_Module1.

PROCESS ON VALUE-REQUEST.

FIELD Screen_Field_name MODULE module_name.

Read only

Former Member
0 Likes
1,365

Hi White ,

Please refer the below link for more information.

http://help.sap.com/saphelp_NW04/helpdata/en/9f/dbaac935c111d1829f0000e829fbfe/content.htm

Read only

Former Member
0 Likes
1,365

Hi,

Please see the sample code below:


*&--------------------------------------------------------------------*
*     A T  S E L E C T I O N - S C R E E N
*&--------------------------------------------------------------------*

*Selection screen help for material classification
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CLASCN-LOW.
*F4 help for material classification data
  PERFORM F4_HELP_CLASIFC USING S_CLASCN-LOW.
*&---------------------------------------------------------------------*
*&      Form  F4_HELP_CLASIFC
*&---------------------------------------------------------------------*

FORM F4_HELP_CLASIFC  USING    P_S_CLASCN_LOW.

*To fetch the classification data on the sel screen
  SELECT CLINT CLASS FROM KLAH UP TO 500 ROWS
  INTO TABLE IT_KLAH.

  IF SY-SUBRC <> 0 .
    MESSAGE TEXT-006 TYPE 'E'.
  ELSE.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
* DDIC_STRUCTURE = ' '
    RETFIELD = 'CLASS'     "Technical Name of the field whose value needs to be selected
* PVALKEY = ' '
    DYNPPROG = SY-REPID
    DYNPNR = SY-DYNNR
    DYNPROFIELD = 'p_s_clascn_low'          "Select option low field value

    VALUE_ORG = 'S'

    DISPLAY = ' '

    TABLES
    VALUE_TAB = IT_KLAH.

  ENDIF.
ENDFORM.                    " F4_HELP_CLASIFC

Hope it helps

Regards

Mansi

Read only

Former Member
0 Likes
1,365

Hi Angel,

If I understand the problem correctly, the record you select from the F4 help does not appear in your field.

If this is the case, try the following logic:


CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'CUSTOMER_NO' "Key field from ycustomer_t
dynpprog = sy-repid "Program
dynpnr = sy-dynnr "Dynpro number
dynprofield = 'F2' "Screen field field
value_org = 'S' "Value return: C: cell by cell, S: structured
* display = 'F' "Override readiness for input
TABLES
value_tab = G_TAB_CON_ITAB
return_tab = return
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.

IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

** start of code**
else.
read table return index 1.
p_customerno = return-fieldval.  "P_customerno is the screen parameter
** end of code**
ENDIF.

Hope this helps! Do let me know if you need anything else!!

Cheers,

Shailesh.

Always provide feedback for helpful answers