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

Submit with itab

Former Member
0 Likes
622

Hi all,

I'm trying to use a submit passing an internal table in the select option of the target program, like the code below shows you:

Loop at wt_select INTO ws_select.

     IF ws_select-taklv IS NOT INITIAL.

          SUBMIT ZY000027_UPDATE_MAT

          WITH s_matnr EQ ws_select_matnr

          WITH p_land1 EQ ws_land1

          WITH p_taklv  EQ ws_select-taklv

          EXPORTING LIST TO MEMORY AND RETURN.

     ENDIF.

ENDLOOP.

The first row works but after the program stops and that's all. I really don't know what to do...

Waiting for help.

Best regards,

Arthur

1 ACCEPTED SOLUTION
Read only

Ashg1402
Contributor
0 Likes
575

Hi,

Inspite of calling in loop, why don't you create a range for s_matnr and p_taklv.

It's simple to use and will work through all the values.

Condition will become -

          SUBMIT ZY000027_UPDATE_MAT

          WITH s_matnr IN r_matnr  (range)

          WITH p_land1 EQ ws_land1

          WITH p_taklv  IN r_taklv   (range)

          EXPORTING LIST TO MEMORY AND RETURN.

Another can be due to If condition , may be the record is coming blank.  Better to create range and pass the conditional values.

Regards

Ashish

3 REPLIES 3
Read only

Ashg1402
Contributor
0 Likes
576

Hi,

Inspite of calling in loop, why don't you create a range for s_matnr and p_taklv.

It's simple to use and will work through all the values.

Condition will become -

          SUBMIT ZY000027_UPDATE_MAT

          WITH s_matnr IN r_matnr  (range)

          WITH p_land1 EQ ws_land1

          WITH p_taklv  IN r_taklv   (range)

          EXPORTING LIST TO MEMORY AND RETURN.

Another can be due to If condition , may be the record is coming blank.  Better to create range and pass the conditional values.

Regards

Ashish

Read only

pranay570708
Active Contributor
0 Likes
575

Hi Arthur,

I guess the issue is due to list memory. In each loop pass, free the list memory. Try below code:

Loop at wt_select INTO ws_select.

     IF ws_select-taklv IS NOT INITIAL.

          SUBMIT ZY000027_UPDATE_MAT

          WITH s_matnr EQ ws_select_matnr

          WITH p_land1 EQ ws_land1

          WITH p_taklv  EQ ws_select-taklv

          EXPORTING LIST TO MEMORY AND RETURN.

    CALL FUNCTION 'LIST_FROM_MEMORY'

      TABLES

        listobject = itab_list

      EXCEPTIONS

        not_found  = 4

        OTHERS     = 8.

    CALL FUNCTION 'WRITE_LIST'

      TABLES

        listobject = itab_list

      EXCEPTIONS

        empty_list = 1

        OTHERS     = 2.

    CALL FUNCTION 'LIST_FREE_MEMORY'

      TABLES

        listobject = itab_list.

     ENDIF.

ENDLOOP.

Read only

0 Likes
575

Hi Pranay,

It works with the range and with the adding at new for the second conditions,

Thanx' a lot