cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding L_TO_CONFIRM function module for LT12

Former Member
0 Kudos

Hi All,

I would like to use L_TO_CONFIRM to perform pick+transfer like the tcode LT12, i get the error 'material withdrawal and material shipment must be confirmed separately', my code is define like the following, Hope anyone can help me.

This is my code...

CALL FUNCTION 'L_TO_CONFIRM'
         EXPORTING
           i_lgnum                              = wa_ltap-lgnum
           i_tanum                              = wa_ltap-tanum
          I_SQUIT                              = 'X'
          I_QUKNZ                              = '1'
*         I_SUBST                              = ' '
*         I_QNAME                              = SY-UNAME
*         I_ENAME                              = SY-UNAME
*         I_SOLEX                              = 0
*         I_PERNR                              = 0
*         I_STDAT                              = INIT_DATUM
*         I_STUZT                              = 0
*         I_ENDAT                              = INIT_DATUM
*         I_ENUZT                              = 0
*         I_ISTWM                              = 0
*         I_KOMIM                              = ' '
*         I_EINLM                              = ' '
*         I_TBELI                              = ' '
*         I_UPDATE_TASK                        = ' '
*         I_COMMIT_WORK                        = 'X'
*         I_AUSFB                              = ' '
         tables
           t_ltap_conf                          = it_ltap_conf
*         T_LTAP_CONF_HU                       =
*         T_LTAP_CONF_HU_SERIAL                =
        EXCEPTIONS
          TO_CONFIRMED                         = 1
          TO_DOESNT_EXIST                      = 2
          ITEM_CONFIRMED                       = 3
          ITEM_SUBSYSTEM                       = 4
          ITEM_DOESNT_EXIST                    = 5
          ITEM_WITHOUT_ZERO_STOCK_CHECK        = 6
          ITEM_WITH_ZERO_STOCK_CHECK           = 7
          ONE_ITEM_WITH_ZERO_STOCK_CHECK       = 8
          ITEM_SU_BULK_STORAGE                 = 9
          ITEM_NO_SU_BULK_STORAGE              = 10
          ONE_ITEM_SU_BULK_STORAGE             = 11
          FOREIGN_LOCK                         = 12
          SQUIT_OR_QUANTITIES                  = 13
          VQUIT_OR_QUANTITIES                  = 14
          BQUIT_OR_QUANTITIES                  = 15
          QUANTITY_WRONG                       = 16
          DOUBLE_LINES                         = 17
          KZDIF_WRONG                          = 18
          NO_DIFFERENCE                        = 19
          NO_NEGATIVE_QUANTITIES               = 20
          WRONG_ZERO_STOCK_CHECK               = 21
          SU_NOT_FOUND                         = 22
          NO_STOCK_ON_SU                       = 23
          SU_WRONG                             = 24
          TOO_MANY_SU                          = 25
          NOTHING_TO_DO                        = 26
          NO_UNIT_OF_MEASURE                   = 27
          XFELD_WRONG                          = 28
          UPDATE_WITHOUT_COMMIT                = 29
          NO_AUTHORITY                         = 30
          LQNUM_MISSING                        = 31
          CHARG_MISSING                        = 32
          NO_SOBKZ                             = 33
          NO_CHARG                             = 34
          vlpla_WRONG                          = 35
*         TWO_STEP_CONFIRMATION_REQUIRED       = 36
          TWO_STEP_CONF_NOT_ALLOWED            = 37
          PICK_CONFIRMATION_MISSING            = 38
          QUKNZ_WRONG                          = 39
          HU_DATA_WRONG                        = 40
          NO_HU_DATA_REQUIRED                  = 41
          HU_DATA_MISSING                      = 42
          HU_NOT_FOUND                         = 43
          PICKING_OF_HU_NOT_POSSIBLE           = 44
          NOT_ENOUGH_STOCK_IN_HU               = 45
          SERIAL_NUMBER_DATA_WRONG             = 46
          SERIAL_NUMBERS_NOT_REQUIRED          = 47
          NO_DIFFERENCES_ALLOWED               = 48
          SERIAL_NUMBER_NOT_AVAILABLE          = 49
          SERIAL_NUMBER_DATA_MISSING           = 50
          TO_ITEM_SPLIT_NOT_ALLOWED            = 51
          INPUT_WRONG                          = 52
          OTHERS                               = 53
                 .
       IF sy-subrc <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

jogi_han
Discoverer

use I_QUKNZ = '4'

balaji_ganesan2
Contributor
0 Kudos

Hello Sai,

I researched further about this issue and the behavior you are facing, where the system behaves differently between the Function Module and the transaction is actually the Standard behavior of SAP System. The main reason which explains the difference is the fact that, as in your case, when using transactions LT11 or LT12, the system has an interaction with the User.

Based on that, the User which is dealing online with the system knows what he/she is doing. Therefore, the display of a Warning message is possible in this case, since it will depend on an User decision. When calling the Function Module L_TO_CONFIRM, the system cannot decide by itself what should be done (if it should skip the Warning or not), therefore an Error Message is raised

(L3 818).

In order to overcome this behavior, according to your business requirements, there's one last option to make a modification to the settings of the Confirmation.

 

The transaction in this case is OMLX.

One possibility here would be to customize the used Movement Type. However, this will have a consequence in all Movements which are processed with this specific Movement Type.

Thanks,

Balaji

Former Member
0 Kudos

Hi Balaji,

Thank you for responding my query...Now the problem is i have developed BDC for updating Quantity of articles in TO using LT12,for this i have used call transaction method.Here,if we see the second screen of LT12,by looking table control having 16records,in some other systems it may be 17 or 23 like that.

based on item value i have updated,but if this program is used with different users.We don't know how many records are showing.how to solve this issue.

here i am attaching my code..please help me.


report ZLT12_REC_NEW
no standard page heading line-size 255.

TYPE-POOLS slis.

data: begin of record,
TANUM_001
(010),
LGNUM_002
(003),
DUNKL_003
(001),
QENTR_004
(001),
NISTA_01_005
(017),
end of record.

DATA: it_fcat TYPE slis_t_fieldcat_alv,
wa_fcat
TYPE slis_fieldcat_alv.

DATA : it_bdcdata TYPE STANDARD TABLE OF bdcdata INITIAL SIZE 0,
wa_bdcdata
TYPE bdcdata.

DATA:BEGIN OF IT_FILE OCCURS 0.
INCLUDE STRUCTURE ALSMEX_TABLINE.
DATA:END OF IT_FILE.
data: wa_file type alsmex_tabline.

types: begin of ty_tab,
LGNUM
type ltap-lgnum,
TANUM 
type ltap-tanum,
MATNR
type ltap-matnr,
VLPLA
type ltap-vlpla,
NISTM
type ltap-nistm,
end of ty_tab.

data: it_data type table of ty_tab,
wa_data
type ty_tab.

types: begin of ty_ltap,
LGNUM
type ltap-lgnum,
TANUM
type ltap-tanum,
TAPOS
type ltap-tapos,
MATNR
type ltap-matnr,
PQUIT
type ltap-pquit,
VLPLA
type ltap-vlpla,
NSOLM
type ltap-nsolm,
end of ty_ltap.

data: it_ltap type table of ty_ltap,
wa_ltap
type ty_ltap.

types: begin of ty_final,
LGNUM
type ltap-lgnum,
TANUM
type ltap-tanum,
status
(17),
end of ty_final.

data: it_final type table of ty_final,
wa_final
type ty_final.

data: fnam_str type String,
lv_tabix
type sy-tabix.
DATA ls_layout     TYPE slis_layout_alv.
DATA: l_index TYPE kcd_ex_col_n.
FIELD-SYMBOLS : <fs>.

Data: it_msg  TYPE STANDARD TABLE OF bdcmsgcoll INITIAL SIZE 0,
wa_msg
TYPE bdcmsgcoll.

Data: tapos type ltap-tapos,
cnt type i,
mul
type i,
prev
type i,
art_count
type i,
chr
(13),
mul_chr
(2).

Data: L_OPT TYPE CTU_PARAMS.

PARAMETERS:P_FILE  TYPE RLGRAP-FILENAME.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME       
= SYST-REPID
*     DYNPRO_NUMBER       = SYST-DYNNR
*     FIELD_NAME          = ' '
*     STATIC              = ' '
*     MASK                = ' '
CHANGING
FILE_NAME          
P_FILE
EXCEPTIONS
MASK_TOO_LONG      
= 1
OTHERS              = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

START-OF-SELECTION.

if P_FILE is initial.
MESSAGE 'Please upload a file' TYPE 'I'.
EXIT.
endif.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME               
= P_FILE
I_BEGIN_COL            
= 1
I_BEGIN_ROW            
= 1
I_END_COL              
= 30
I_END_ROW              
= 99999
TABLES
INTERN                 
= IT_FILE
EXCEPTIONS
INCONSISTENT_PARAMETERS
= 1
UPLOAD_OLE             
= 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.

delete it_file where row = 1.
LOOP AT it_file INTO wa_file.
MOVE wa_file-col TO l_index.
ASSIGN COMPONENT l_index OF STRUCTURE wa_data TO <fs>.
MOVE wa_file-value TO <fs>.
UNASSIGN <fs>.
AT END OF row.
APPEND wa_data TO it_data.
CLEAR wa_data.
ENDAT.
ENDLOOP.

loop at it_data into wa_data.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input         = wa_data-matnr
IMPORTING
OUTPUT        = wa_data-matnr
.
MODIFY it_data FROM wa_data.
ENDLOOP.

select LGNUM
TANUM
TAPOS
MATNR
PQUIT
VLPLA
NSOLM
from ltap
into table it_ltap
for all entries in it_data
where lgnum = it_data-lgnum
and tanum = it_data-tanum
and matnr = it_data-matnr
and vlpla = it_data-vlpla
and nltyp = '916'.



loop at it_ltap into wa_ltap.
lv_tabix
= sy-tabix.

if wa_ltap-pquit = 'X'.

wa_final
-lgnum = wa_ltap-lgnum.
wa_final
-tanum = wa_ltap-tanum.
wa_final
-status = 'Already Confirmed'.
append wa_final to it_final.

delete it_ltap where lgnum = wa_ltap-lgnum and tanum = wa_ltap-tanum.
continue.
endif.

read table it_data into wa_data with key lgnum = wa_ltap-lgnum
tanum
= wa_ltap-tanum
matnr
= wa_ltap-matnr
vlpla
= wa_ltap-vlpla.

if wa_ltap-nsolm lt wa_data-nistm.

wa_final
-lgnum = wa_ltap-lgnum.
wa_final
-tanum = wa_ltap-tanum.
wa_final
-status = 'Not Confirmed'.
append wa_final to it_final.

delete it_ltap where lgnum = wa_ltap-lgnum and tanum = wa_ltap-tanum.

elseif wa_ltap-nsolm eq wa_data-nistm.

wa_final
-lgnum = wa_ltap-lgnum.
wa_final
-tanum = wa_ltap-tanum.
wa_final
-status = 'Confirmed'.
append wa_final to it_final.

delete it_ltap index lv_tabix.

endif.

endloop.

L_OPT
-DEFSIZE = 'X'.
L_OPT
-DISMODE = 'A'.
L_OPT
-UPDMODE = 'S'.

prev
= 0.

sort it_ltap by lgnum tanum tapos.
sort it_data by lgnum tanum matnr vlpla.

loop at it_ltap into wa_ltap.

read TABLE it_data into wa_data with key lgnum = wa_ltap-lgnum
tanum
= wa_ltap-tanum
matnr
= wa_ltap-matnr
vlpla
= wa_ltap-vlpla
binary search.

At NEW tanum.
clear prev.

perform bdc_dynpro      using 'SAPML03T' '0111'.
PERFORM bdc_field       USING 'BDC_OKCODE'     '=ENTR'.
perform bdc_field       using 'BDC_CURSOR'
'LTAK-TANUM'.
perform bdc_field       using 'LTAK-TANUM'
wa_ltap
-tanum.
perform bdc_field       using 'LTAK-LGNUM'
wa_ltap
-lgnum.
perform bdc_field       using 'RL03T-DUNKL'
'H'.
perform bdc_field       using 'RL03T-QENTR'
'X'.
perform bdc_field       using 'BDC_OKCODE'
'=QSA'.

ENDAT.

art_count
= art_count + 1.

chr
= wa_data-nistm.
CONDENSE chr NO-GAPS.

tapos
= wa_ltap-TAPOS.
mul
= tapos mod 28.

if mul ne 0.
cnt = ( tapos / 28 ).
cnt = cnt - prev.
prev
= tapos / 28.

do cnt times.    " For Page Down
perform bdc_dynpro      using 'SAPML03T' '0114'.
perform bdc_field       using 'BDC_CURSOR'
'LTAK-LGNUM'.
perform bdc_field       using 'BDC_OKCODE'
'=P+'.
enddo.
else.
mul
= 28.
endif.

mul_chr
= mul.
CONCATENATE 'LTAP-NISTA(' mul_chr ')' INTO fnam_str.

perform bdc_dynpro      using 'SAPML03T' '0114'.
perform bdc_field       using 'BDC_OKCODE'
'/00'.
perform bdc_field       using 'BDC_CURSOR'
'LTAP-NISTA(01)'.
perform bdc_field       using fnam_str
chr.


at END OF tanum.

perform bdc_dynpro      using 'SAPML03T' '0114'.
perform bdc_field       using 'BDC_CURSOR'
'LTAK-LGNUM'.
perform bdc_field       using 'BDC_OKCODE'
'=BU'.

do art_count times.
perform bdc_dynpro      using 'SAPML03T' '0115'.
perform bdc_field       using 'BDC_CURSOR'
'LTAP-ENAME'.
perform bdc_field       using 'BDC_OKCODE'
'=DIBE'.
enddo.
clear art_count.
CALL TRANSACTION 'LT12' USING it_bdcdata
OPTIONS
FROM L_OPT
MESSAGES
INTO it_msg.
clear: tapos, it_bdcdata.

ENDAT.

clear: tapos, mul, cnt, sy-subrc.
endloop.

delete adjacent duplicates from it_final comparing all fields.

loop at it_final into wa_final where status = 'Confirmed'.
lv_tabix
= sy-tabix.

read table it_ltap into wa_ltap with key lgnum = wa_final-lgnum tanum = wa_final-tanum.
if sy-subrc eq 0.

delete it_final index lv_tabix.

else.
perform bdc_dynpro      using 'SAPML03T' '0111'.
PERFORM bdc_field       USING 'BDC_OKCODE'     '=ENTR'.
perform bdc_field       using 'BDC_CURSOR'
'LTAK-TANUM'.
perform bdc_field       using 'LTAK-TANUM'
wa_final
-tanum.
perform bdc_field       using 'LTAK-LGNUM'
wa_final
-lgnum.
perform bdc_field       using 'RL03T-DUNKL'
'H'.
perform bdc_field       using 'RL03T-QENTR'
'X'.
perform bdc_field       using 'BDC_OKCODE'
'=QSA'.


perform bdc_dynpro      using 'SAPML03T' '0114'.
perform bdc_field       using 'BDC_CURSOR'
'LTAK-LGNUM'.
perform bdc_field       using 'BDC_OKCODE'
'=BU'.

CALL TRANSACTION 'LT12' USING it_bdcdata
OPTIONS
FROM L_OPT
MESSAGES
INTO it_msg.
clear it_bdcdata.
endif.

endloop.

delete it_final where status = 'Confirmed'.
delete adjacent DUPLICATES FROM it_data comparing lgnum tanum.
clear wa_data.
refresh it_ltap.
clear wa_ltap.

select LGNUM
TANUM
TAPOS
MATNR
PQUIT
VLPLA
NSOLM
from ltap
into table it_ltap
for all entries in it_data
where lgnum = it_data-lgnum
and tanum = it_data-tanum
and nltyp = '916'.

loop at it_data into wa_data.

read table it_final into wa_final with key lgnum = wa_data-lgnum tanum = wa_data-tanum.
if sy-subrc ne 0.

wa_final
-lgnum = wa_data-lgnum.
wa_final
-tanum = wa_data-tanum.

read table it_ltap into wa_ltap with key lgnum = wa_data-lgnum tanum = wa_data-tanum.
if wa_ltap-pquit = 'X'.
wa_final
-status = 'Confirmed'.
else.
wa_final
-status = 'Not Confirmed'.
endif.

append wa_final to it_final.
clear wa_final.

endif.

endloop.
sort it_final by lgnum tanum.
ls_layout
-colwidth_optimize = 'X'.

wa_fcat
-seltext_l = 'Warehouse Number'.
wa_fcat
-tabname = 'IT_FINAL'.
wa_fcat
-fieldname = 'LGNUM'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.

wa_fcat
-seltext_l = 'TO Number'.
wa_fcat
-tabname = 'IT_FINAL'.
wa_fcat
-fieldname = 'TANUM'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.

wa_fcat
-seltext_l = 'Status'.
wa_fcat
-tabname = 'IT_FINAL'.
wa_fcat
-fieldname = 'STATUS'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
I_CALLBACK_PROGRAM               
= sy-repid
*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_USER_COMMAND           = ' '
*   I_CALLBACK_TOP_OF_PAGE            = ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  =
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
IS_LAYOUT                        
= ls_layout
IT_FIELDCAT                      
= it_fcat
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           =
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
TABLES
t_outtab                         
= it_final
* EXCEPTIONS
*   PROGRAM_ERROR                     = 1
*   OTHERS                            = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

*&---------------------------------------------------------------------*
*&      Form  bdc_dynpro
*&---------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
CLEAR wa_bdcdata.
wa_bdcdata
-program  = program.
wa_bdcdata
-dynpro   = dynpro.
wa_bdcdata
-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.
ENDFORM.                    "BDC_DYNPRO


*&---------------------------------------------------------------------*
*&      Form  BDC_FIELD
*&---------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
CLEAR wa_bdcdata.
wa_bdcdata
-fnam = fnam.
wa_bdcdata
-fval = fval.
APPEND wa_bdcdata TO it_bdcdata.
ENDFORM.

Thanks