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

Problem while using F4IF_INT_TABLE_VALUE_REQUEST

Former Member
0 Likes
2,865

Dear All,

I facing a strange problem while using F4IF_INT_TABLE_VALUE_REQUEST.

Let me describe my problem.

I have a database table which has the following,

Column | DataType |Length |

MANDT | SY- MANDT| 3 |

HEADER_ID | INT4 | 10 |

TRANS_ID | INT4 | 10 |

HEAD_NAME | CHAR | 30 |

The values that are there in the database is

MANDT | HEADER_ID |TRANS_ID | HEAD_NAME |

100 | 001 | 1000 | Download |

100 | 002 | 2000 | Upload |

In my Report program, in the event

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_TRAN_ID.

I have used CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'.

I should be able to choose 1000 or 2000 as the Trans_ID. but when i use F4, instead of getting 1000 and 2000, I am getting some strange Numbers (10) digits which is wrong.

I am not sure what I am passing is correct ... Please look at the code below that I have written and correct me where am I making the mistake

REPORT ZTEST.

PARAMETERS: P_TRAN LIKE ZMPHR-TRANS_ID DEFAULT ''.

&----


  • PICK TRANS_ID FROM SELECTION

&----


AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_TRAN.

PERFORM F4_HELP_FOR_P_TRAN.

&----


*& PICK TRANS_ID FROM SELECTION

&----


FORM F4_HELP_FOR_P_TRAN.

DATA: VALUE_TAB LIKE ZMPHR OCCURS 0 WITH HEADER LINE.

DATA: RETURN_TAB LIKE DDSHRETVAL OCCURS 0 WITH HEADER LINE.

DATA FIELD_TAB LIKE STANDARD TABLE OF DFIES WITH HEADER LINE.

SELECT * FROM ZMPHR INTO TABLE VALUE_TAB.

CALL FUNCTION 'DDIF_FIELDINFO_GET'

EXPORTING

TABNAME = 'ZMPHR'

TABLES

DFIES_TAB = FIELD_TAB

EXCEPTIONS

OTHERS = 3.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

DDIC_STRUCTURE = 'ZMPHR'

RETFIELD = 'MAP_PARAM'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = VALUE_TAB

FIELD_TAB = FIELD_TAB

RETURN_TAB = RETURN_TAB

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3.

P_TRAN = RETURN_TAB-FIELDVAL.

ENDFORM. " F4_HELP_FOR_P_TRAN

Thanks in Advance,

19 REPLIES 19
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,548

Look at the definition of the TRANS_ID in your table. It is a integer of length 10.

TRANS_ID | <b>INT4 | 10 |</b>

In the database it is stored as 0000001000. This is how it will be unless to put a conversion on it. You will need to put the conversion exit onto the domain of the data element used for the field.

Regards,

Rich Heilman

Read only

0 Likes
2,548

Use "NUMC1" in the conversion routine field of the domain. Problem should be solved.

Regards,

Rich Heilman

Read only

0 Likes
2,548

Or, you could simply do the conversion directly in your program, right after the select statement.



select * from zmphr into table value_tab.

loop at  value_tab.

  call function 'CONVERSION_EXIT_NUMC1_OUTPUT'
       exporting
            input  = value_tab-trans_id
       importing
            output = value_tab-trans_id.
  modify value_tab.
endloop.

Regards,

Rich Heilman

Read only

0 Likes
2,548

Hi Ranjan,

Here is the modified code for you. It works. Note the translate statement in there. It is required as the return table has the values for the trans_id in output format, i.e., with comma and dots and that will result in dump, if not removed.


PARAMETERS: p_tran LIKE zmphr-trans_id.

*&-------------------------------------------------------*
* PICK TRANS_ID FROM SELECTION
*&-------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_tran.
  PERFORM f4_help_for_p_tran.

*&-------------------------------------------------------*
*& PICK TRANS_ID FROM SELECTION
*&-------------------------------------------------------*
FORM f4_help_for_p_tran.

  DATA: value_tab LIKE zmphr OCCURS 0 WITH HEADER LINE.
  DATA: return_tab LIKE ddshretval OCCURS 0 WITH HEADER LINE.

  DATA field_tab LIKE STANDARD TABLE OF dfies WITH HEADER LINE.

  SELECT * FROM zmphr INTO TABLE value_tab.

  CALL FUNCTION 'DDIF_FIELDINFO_GET'
       EXPORTING
            tabname   = 'ZMPHR'
       TABLES
            dfies_tab = field_tab
       EXCEPTIONS
            OTHERS    = 3.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
            ddic_structure  = 'ZMPHR'
            retfield        = 'TRANS_ID'
            dynprofield     = 'P_TRAN'
            value_org       = 'S'
       TABLES
            value_tab       = value_tab
            field_tab       = field_tab
            return_tab      = return_tab
       EXCEPTIONS
            parameter_error = 1
            no_values_found = 2
            OTHERS          = 3.
  IF sy-subrc = 0.
    READ TABLE return_tab INDEX 1.
    TRANSLATE: return_tab-fieldval USING ', ',
               return_tab-fieldval USING '. '.
    CONDENSE return_tab-fieldval NO-GAPS.
    p_tran = return_tab-fieldval.
  ENDIF.

ENDFORM. " F4_HELP_FOR_P_TRAN

Srinivas

Read only

0 Likes
2,548

Thanks Rich,

I tried this logic and still I get the same old results.

Please help.

Read only

0 Likes
2,548

Thanks for your response Srinivas,

But the problem still persists.

Please help

Read only

0 Likes
2,548

Hi

In table u create one domain for TRANS_ID with

datatype : int4

lenght : 10

output length : 10

Convers. routine : 'ALPHA'

activate and try

regds

gv

Read only

0 Likes
2,548

Hello Venkat,

I created a domain as you had suggested and added in the conversion routine - ALPHA.

But the problem still persits, now if i veiw the records in se11/se16 [display mode] the veiw shows me correct values. but if i click on induvidual records... i get some strange numbers.

Please help.

Message was edited by: Ranjan MR

Read only

0 Likes
2,548

While Debugging the function module F4IF_INT_TABLE_VALUE_REQUEST , I discovered some following results

1. I removed the HEAD_NAME | CHAR | 30 | from the database table and the FM provides me the <b>correct output</b>.

2. BUT When I add it back to the database table , it is back to the same old problem.

3. Therefore , I added alternatively a field which has Integer Type anc Character Type to make my observations better , the result is whenever you add a field of character datatype inbetween a field Interger datatype, you get this problem.

Hope this is clear. I am still looking forward for a solution from experts .

Thanks once again.

Read only

0 Likes
2,548

Hi,

you try this.

loop at field_tab.

if field_tab-fieldname = 'TRANS_ID'.

field_tab-inttype = 'D'.

modify field_tab.

ENDIF.

ENDLOOP.

in the field tab i set inttype as D ( decimal ) it's working fine. Instead of the above loop you can use read statement.

Hope this will work

Cheers,

Sasi

Read only

0 Likes
2,548

Hi Ranajan,

I created the same table in my system, entered the same two records in my system and used the same code I posted above, and it works for me. I am not sure why it is not working for you.

Can you please explain one more time as to what exactly you are seeing?

You have the database table defined as you mentioned in your original post.

Then you have two records in there as you gave in the example.

Then you fill an internal table with those two entries. In debugging, do you see the records properly in the internal table at this point?

Now you call the F4 function module. What you see in the pop-up is some strange numbers? Or is it after you select one and move to the parameter it becomes a strange number?

Some critical information is missing here. Please let us know more about your problem and may be your exact code.

Thanks,

Srinivas

Read only

0 Likes
2,548

Thanks srinvias for your response, deeply appreciated.

Let me describe the problem once again.

1) The database table Defination looks like this  
<u><b>Column   | DataType |Length |</b></u>
MANDT    |CLNT	    |3	    |
HEADER_ID|INT4	    |10	    |
TRANS_ID |INT4	    |10	    |
HEAD_NAME|CHAR      |30	    |

2) The Records for this database tables are :-

<u><b>MANDT | HEADER_ID |TRANS_ID | HEAD_NAME |</b></u>
100   |      001  |    1000 | Download  |
100   |      002  |    2000 | Upload    |

3)In Report program, in the event

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_TRAN_ID.

I have used

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

to help the user to select the

TRANS_ID

along with Description.

4.I should be able to choose 1000 or 2000 as the Trans_ID. but when I use F4, instead of getting 1000 and 2000, I am getting some strange Numbers (10) digits [Hexa decimal I suppose]which is wrong.

5. I am not sure what I am passing is correct ... Please look at the code below that I have written and correct me where am I making the mistake

6)As seen from the <u><b>SE11 screen</b></u>, I can see the data like shown below

<u><b>MANDT| HEADER_ID|  TRANS_ID |  HEAD_NAME</b></u>
100|           1 |     <b>1,000</b> | DOWNLOAD
100|           2 |     <b>2,000</b> | UPLOAD

7)<u><b>The code that I have written as per your suggestion</b></u>

PARAMETERS: P_TRAN LIKE ZMPHR-TRANS_ID.

*&-------------------------------------------------------*
* PICK TRANS_ID FROM SELECTION
*&-------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_TRAN.
  PERFORM F4_HELP_FOR_P_TRAN.

*&-------------------------------------------------------*
*& PICK TRANS_ID FROM SELECTION
*&-------------------------------------------------------*
FORM F4_HELP_FOR_P_TRAN.

DATA: VALUE_TAB LIKE ZMPHR OCCURS 0 WITH HEADER LINE.
DATA: RETURN_TAB LIKE DDSHRETVAL OCCURS 0 WITH HEADER LINE.

DATA FIELD_TAB LIKE STANDARD TABLE OF DFIES WITH HEADER LINE.

SELECT * FROM ZMPHR INTO TABLE VALUE_TAB.

CALL FUNCTION 'DDIF_FIELDINFO_GET'
    EXPORTING
      TABNAME   = 'ZMPHR'
    TABLES
      DFIES_TAB = FIELD_TAB
    EXCEPTIONS
      OTHERS    = 3.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      DDIC_STRUCTURE  = 'ZMPHR'
      RETFIELD        = 'TRANS_ID'
      DYNPROFIELD     = 'P_TRAN'
      VALUE_ORG       = 'S'
    TABLES
      VALUE_TAB       = VALUE_TAB
      FIELD_TAB       = FIELD_TAB
      RETURN_TAB      = RETURN_TAB
    EXCEPTIONS
      PARAMETER_ERROR = 1
      NO_VALUES_FOUND = 2
      OTHERS          = 3.
  IF SY-SUBRC = 0.
    READ TABLE RETURN_TAB INDEX 1.
    TRANSLATE: RETURN_TAB-FIELDVAL USING ', ',
               RETURN_TAB-FIELDVAL USING '. '.
    CONDENSE RETURN_TAB-FIELDVAL NO-GAPS.
    P_TRAN = RETURN_TAB-FIELDVAL.
  ENDIF.

ENDFORM. " F4_HELP_FOR_P_TRAN

😎 The Values in the

<u><b>DEBUG MODE</b></u>- for itab -> <b>VALUE_TAB</b>

after the select query is

<b>100  |         1 |      1000 |DOWNLOAD                                    |
100  |         2 |      2000 |UPLOAD                                      |</b>

9) <b>After</b> Executing F4IF_INT_TABLE_VALUE_REQUEST, in <b>the pop-up is some strange numbers as mentioned</b> below instead of <b>1000 or 2000</b>

<u><b>MANDT HEADER_ID  TRANS_ID   HEAD_NAME</b></u>
200	1	<b>1140851688</b>	DOWNLOAD
200	2	<b>1426065360</b>	UPLOAD

In short, the Popup table has some strange values than actual values that should be shown from database.

Hope this is clear.

Thanks in Advance.

Read only

0 Likes
2,548

Hi Ranjan,

I see why you are so perplexed, because I am too. Everything in your code looks perfect (except of course your statement 'AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_TRAN_ID.' which should have been AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_TRAN).

Which version are you on? Looks like something changed in this function module. I am sure it worked in my 46C system. If something doesn't work for some and works for the others, then blame the version!!!

Why did the client number change between the time it got selected and by the time it got displayed in the pop-up? Not only that the transid changed to some strange code. This is puzzling. Did you try debugging the function module to see where it is getting changed?

Has this table been changed, either in its structure(adding or deleting fields) or in the types(CHAR instead of a INT4 for a field)? Did you get any warnings or errors while doing that? Have you run the database utility with the option 'Adjust' and 'Save data'?

Please let me know.

Srinivas

Read only

0 Likes
2,548

Thanks Srinivas,

Well, there were some typo errors , thanks for pointing out and i have corrected them.

You are correct, I tried the same program in 4.6 c and it works properly. BUT I am working on SAP WAS 6.2 version of our client and its important to fix this code in that machine.

Thanks for all your help. Please let me know how can we correct this bug in SAP WAS 6.2

Thanks

Read only

0 Likes
2,548

May be an issue because of unicode.

just for test case is it possible to change the data type from int4 to char or numc for header_id and trans_id and see how it goes.

also check the following oss note.

679120

423869

my guess is that data type is the issue,

its a case for OSS

Regards

Raja

Message was edited by: Durairaj Athavan Raja

Read only

Former Member
0 Likes
2,548

MAP_PARAM ????

I seem that your table hasn't a field called MAP_PARAM, but TRANS_ID

Read only

Former Member
0 Likes
2,548

Hi,

Please check with fieldtab. FIELD_TAB-INTTYPE

first remove the field tab then see what you get, if displays correctly check with field tab values.

Cheers,

Sasi

Read only

0 Likes
2,548

Hello Sasi,

Could you please explain me in detail.

Read only

Former Member
0 Likes
2,548

Thanks everybody for your responses to this question