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: 

Dynamic search help with F4IF_INT_TABLE_VALUE_REQUEST triggers an error ASSIGN_LENGTH_0 in SAPLSDH4

Former Member
0 Kudos

Hey experts,

I have the following code:


PARAMETERS: pa_persa type pa0001-werks.

PARAMETERS: pa_pernr TYPE pa0001-pernr.

at SELECTION-SCREEN on VALUE-REQUEST FOR pa_pernr.

DATA: lt_retdynr TYPE TABLE OF ddshretval,

       lt_dynpread LIKE dynpread OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF lt_shout OCCURS 0,

         pernr TYPE pernr,

       END OF lt_shout.

lt_dynpread-fieldname = 'PA_PERSA'.

APPEND lt_dynpread.

CLEAR lt_dynpread.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy-repid

dynumb = sy-dynnr

TABLES

dynpfields = lt_dynpread.

if lt_dynpread-fieldvalue is INITIAL.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'PERNR'

dynpprog = sy-repid

dynpnr = sy-dynnr

DYNPROFIELD = 'PA_PERNR'

value_org = 'S'

TABLES

value_tab = lt_shout

return_tab = lt_retdynr.

else.

SELECT pernr from pa0001 into TABLE lt_shout up to 20 rows where werks = lt_dynpread-fieldvalue.

sort lt_shout by pernr .

delete ADJACENT DUPLICATES FROM lt_shout.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'PERNR'

dynpprog = sy-repid

dynpnr = sy-dynnr

DYNPROFIELD = 'PA_PERNR'

value_org = 'S'

TABLES

value_tab = lt_shout

return_tab = lt_retdynr.

when I press the search help button for the pa_pernr on selection screen it triggers an error ASSIGN_LENGTH_0 in SAPLSDH4
here are the lines where the error is occurred:


CASE ls_listfields_new-mask+1(1).

         WHEN ' '.

           len_alt = ls_listfields_new-outputlen.

           len_neu = ls_listfields_new-intlen.

         WHEN 'E'.

           len_alt = ls_listfields_new-intlen.

           len_neu = ls_listfields_new-outputlen.

         WHEN 'I'.

           len_alt = ls_listfields_new-intlen.

           len_neu = ls_listfields_new-intlen.

         WHEN 'O'.

           len_alt = ls_listfields_new-outputlen.

           len_neu = ls_listfields_new-outputlen.

       ENDCASE.

       ASSIGN <value_x>(len_alt) TO <value_alt>.

       ASSIGN <value_x>(len_neu) TO <value_neu>.

       CLEAR value.

       <value_alt> = <record_old>+listfields-offset(len_alt).

The error is occurred because the len_alt's value is 0, but I don't know why this is happening...
What did I wrong? How can I solve this problem? I want to restrict the search help values for pa_pernr depending on the filled in pa_persa value.

Regards,
Robert

1 ACCEPTED SOLUTION

former_member210541
Active Participant
0 Kudos

Data type mismatch

I can see PERNR in PA001 is of type PERSNO

and your internal table declaration

DATA: BEGIN OF lt_shout OCCURS 0,

         pernr TYPE pernr,

       END OF lt_shout.


the type PERNR refers to a structure PERNR.


Just make it  pernr TYPE pa001-pernr,

4 REPLIES 4

former_member210541
Active Participant
0 Kudos

Data type mismatch

I can see PERNR in PA001 is of type PERSNO

and your internal table declaration

DATA: BEGIN OF lt_shout OCCURS 0,

         pernr TYPE pernr,

       END OF lt_shout.


the type PERNR refers to a structure PERNR.


Just make it  pernr TYPE pa001-pernr,

0 Kudos

Thanks that was the problem

Former Member
0 Kudos

Agree with Tee Gee.

You must have ignored the Warning message in the syntax checker.Otherwise you would have spotted it.

Also not sure why you are using CALL FUNCTION 'DYNP_VALUES_READ'.

The data is already available in parameter pa_persa that can be used directly in the select statement.

R

0 Kudos

Well usually I just active it and in that case it did not show me any warnings, thanks for your advice.
I know I could use only pa_persa, but it is empty until I did not press the ENTER and  when I press the ENTER an error message appears that the pa_pernr is empty (obligatory).