2016 May 26 10:55 AM
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
2016 May 26 11:04 AM
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
2016 May 26 11:04 AM
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
2016 May 26 11:12 AM
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.
2016 May 26 1:36 PM
Hi Pranay,
It works with the range and with the adding at new for the second conditions,
Thanx' a lot