06-13-2007 12:34 PM
Hi All,
We have a BDC in which we need to enter a multiple selection for a document field.
For this we are using the table control concept.
However, how do we fill in more than 8 single selections (the number of input rows available on the screen)?
We have tried to use the ok code "LINS" that inserts a line at a time. This is working perfectly in ALL screen mode.
However, in NO screen mode what we observed is that the values get overwritten and only 1 document is eventually selected.
Thanks & Regards,
Sana.
06-13-2007 12:45 PM
Hi,
Many SAP transactions behave differently in online mode and in Batch mode and this mode is determined by the SY-BINPT variable that can be controlled using the OPTIONS command in addition to the CALL TRANSACTION.
For example, the error message that usually comes in status bar while you are running the transaction online might appear in a popup window when you are running that in batch. This will make your fields disabled for input. This OPTIONS addition will remove this problem
The way to use the OPTIONS addition.
Declare a work area of type CTU_PARAMS.
Fill the fields of CTU_PARAMS. The field NOBINPT should be set to X.
This will set the SY-BINPT to space. So now the transaction which you will be calling will run in online mode.
Example.
clear X_OPTIONS.
X_OPTIONS-DISMODE = 'E'.
X_OPTIONS-UPDMODE = 'S'.
X_OPTIONS-CATTMODE = ' '.
X_OPTIONS-DEFSIZE = ' '.
X_OPTIONS-RACOMMIT = ' '.
X_OPTIONS-NOBINPT = 'X'.
X_OPTIONS-NOBIEND = ' '.
call transaction 'BP' using T_BDCDATA[] options from X_OPTIONS.
Note:
Do not use the MODE & UPDATE additions when you are using OPTIONS. The mode & update values are passed in the CTU_PARAMS structure.
Regards
06-13-2007 12:38 PM
06-13-2007 1:16 PM
FORM BDC_MRKO TABLES IT_RKWA.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = 'RMVKON00'.
WA_BDCDATA-DYNPRO = '1000'.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO IT_BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'BDC_CURSOR'.
WA_BDCDATA-FVAL = 'PA_XABR'.
APPEND WA_BDCDATA TO IT_BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'SO_BUKRS-low'. "Company Code
WA_BDCDATA-FVAL = P_BUKRS.
APPEND WA_BDCDATA TO IT_BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'PA_XKONS'. "Consignment Checkbox
WA_BDCDATA-FVAL = P_XKONS.
APPEND WA_BDCDATA TO IT_BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'PA_XPIPE'. "Pipeline Checkbox
WA_BDCDATA-FVAL = P_XPIPE.
APPEND WA_BDCDATA TO IT_BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'PA_XABR'. "Settle Radiobutton
WA_BDCDATA-FVAL = 'X'.
APPEND WA_BDCDATA TO IT_BDCDATA.
IF IT_RKWA IS NOT INITIAL.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'BDC_OKCODE'.
WA_BDCDATA-FVAL = '%007'.
APPEND WA_BDCDATA TO IT_BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = 'SAPLALDB'.
WA_BDCDATA-DYNPRO = '3000'.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO IT_BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'BDC_OKCODE'.
WA_BDCDATA-FVAL = 'NOSV'.
APPEND WA_BDCDATA TO IT_BDCDATA.
-
here lies the issue ->filling multiple selection options----
*Loop to exclude the material document numbers that are not to be
*settled into the BDC
LOOP AT IT_RKWA INTO WA_RKWA.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = 'SAPLALDB'.
WA_BDCDATA-DYNPRO = '3000'.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO IT_BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'BDC_OKCODE'.
WA_BDCDATA-FVAL = 'LINS'.
APPEND WA_BDCDATA TO IT_BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = T.
WA_BDCDATA-FVAL = WA_RKWA-MBLNR.
APPEND WA_BDCDATA TO IT_BDCDATA.
ENDLOOP.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = 'SAPLALDB'.
WA_BDCDATA-DYNPRO = '3000'.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO IT_BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'BDC_OKCODE'.
WA_BDCDATA-FVAL = 'ACPT'.
APPEND WA_BDCDATA TO IT_BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = 'RMVKON00'.
WA_BDCDATA-DYNPRO = '1000'.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO IT_BDCDATA.
ENDIF.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'BDC_OKCODE'.
WA_BDCDATA-FVAL = 'ONLI'.
APPEND WA_BDCDATA TO IT_BDCDATA.
ENDFORM. " BDC_MRKO
CALL TRANSACTION 'MRKO'
USING IT_BDCDATA
MODE M
UPDATE 'S'
MESSAGES INTO IT_BDCMSGCOLL.
I am currently trying out the OPTIONS as suggested.
06-13-2007 12:41 PM
looks like screen resolution problem in background N Mode
use CTU_PARAMS Structure..
data: f_option type ctu_params,
f_option-updmode = 'S'.
f_option-defsize = 'X'.
f_option-dismode = 'N'.
call transaction 'VA01' using bdcdata options from f_option messages into bdcerror.
06-13-2007 12:45 PM
Hi,
Many SAP transactions behave differently in online mode and in Batch mode and this mode is determined by the SY-BINPT variable that can be controlled using the OPTIONS command in addition to the CALL TRANSACTION.
For example, the error message that usually comes in status bar while you are running the transaction online might appear in a popup window when you are running that in batch. This will make your fields disabled for input. This OPTIONS addition will remove this problem
The way to use the OPTIONS addition.
Declare a work area of type CTU_PARAMS.
Fill the fields of CTU_PARAMS. The field NOBINPT should be set to X.
This will set the SY-BINPT to space. So now the transaction which you will be calling will run in online mode.
Example.
clear X_OPTIONS.
X_OPTIONS-DISMODE = 'E'.
X_OPTIONS-UPDMODE = 'S'.
X_OPTIONS-CATTMODE = ' '.
X_OPTIONS-DEFSIZE = ' '.
X_OPTIONS-RACOMMIT = ' '.
X_OPTIONS-NOBINPT = 'X'.
X_OPTIONS-NOBIEND = ' '.
call transaction 'BP' using T_BDCDATA[] options from X_OPTIONS.
Note:
Do not use the MODE & UPDATE additions when you are using OPTIONS. The mode & update values are passed in the CTU_PARAMS structure.
Regards
06-13-2007 1:36 PM
I tried out options. However the result is as before.
The problem being, how do we fill more entries in the multiple selection screen using a BDC..?
06-13-2007 1:50 PM
Hi,
plz have a look at the below code...
FORM bdc_data .
Work area for data record.
DATA : lwa_header1 TYPE t_header.
Declaration of local variable.
DATA : lv_index TYPE sytabix.
IF NOT i_header[] IS INITIAL.
v_item_cntr = 1.
v_cond_cntr = 2.
v_scale_cntr = 1.
v_cong_flg = 2.
LOOP AT i_header INTO wa_header.
lv_index = sy-tabix + 1.
CASE wa_header-rec_type.
WHEN c_h.
--
PERFORM header_data_upload USING wa_header.
--
WHEN c_i.
If the number of lines in the line item screen exceeds
14 then we need to use the newpage okcode for adding
new line items
IF v_item_cntr GE 15.
PERFORM bdc_dynpro USING 'SAPMM06E' '0220'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=NP'.
v_item_cntr = 2.
ENDIF.
For uploading the item data
PERFORM item_data_upload USING wa_header.
Read the internal table for next record
READ TABLE i_header INTO lwa_header1 INDEX lv_index.
IF lwa_header1-rec_type = c_h OR sy-subrc <> 0.
if no more line items found then the data should be saved
PERFORM bdc_dynpro USING 'SAPMM06E' '0220'.
PERFORM bdc_field USING 'BDC_OKCODE'
'BU'.
If there exists condition record for that line item
then go to condition screen with OKCODE '=KO'
ELSEIF lwa_header1-rec_type = c_c.
PERFORM bdc_field USING 'BDC_OKCODE'
'=KO'.
ENDIF.
--
WHEN c_c.
Upload the condition data
PERFORM conditions_data_upload USING wa_header.
Read the internal table for next record
READ TABLE i_header INTO lwa_header1 INDEX lv_index.
If the next record is an item go back to item screen
IF lwa_header1-rec_type = c_i.
PERFORM bdc_dynpro USING 'SAPMV13A' '0201'.
PERFORM bdc_field USING 'BDC_OKCODE'
'BACK'.
If the next record is header then save the data
ELSEIF lwa_header1-rec_type = c_h OR sy-subrc <> 0.
PERFORM bdc_dynpro USING 'SAPMV13A' '0201'.
PERFORM bdc_field USING 'BDC_OKCODE'
'BACK'.
PERFORM bdc_dynpro USING 'SAPMM06E' '0220'.
PERFORM bdc_field USING 'BDC_OKCODE'
'BU'.
If there exists scale record for that condition
then go to scale screen with OKCODE '=PSTF'
ELSEIF lwa_header1-rec_type = c_s.
PERFORM bdc_field USING 'BDC_OKCODE'
'=PSTF'.
ENDIF.
--
WHEN c_s.
Upload the scales data
PERFORM scales_data_upload USING wa_header.
Read the internal table for next record
READ TABLE i_header INTO lwa_header1 INDEX lv_index.
If the next record is condition record then go to condition
screen
IF lwa_header1-rec_type = c_c .
v_cong_flg = v_cong_flg + 1.
v_scale_cntr = 1.
PERFORM bdc_dynpro USING 'SAPMV13A' '0303'.
PERFORM bdc_field USING 'BDC_OKCODE'
'BACK'.
If the next record is header the go back to item screen
and save the data
ELSEIF lwa_header1-rec_type = c_h OR sy-subrc <> 0.
PERFORM bdc_dynpro USING 'SAPMV13A' '0303'.
PERFORM bdc_field USING 'BDC_OKCODE'
'BACK'.
PERFORM bdc_dynpro USING 'SAPMV13A' '0201'.
PERFORM bdc_field USING 'BDC_OKCODE'
'BACK'.
v_cond_cntr = 2.
v_scale_cntr = 1.
v_cong_flg = 2.
PERFORM bdc_dynpro USING 'SAPMM06E' '0220'.
PERFORM bdc_field USING 'BDC_OKCODE'
'BU'.
If the next record is item the go back to item screen
ELSEIF lwa_header1-rec_type = c_i.
PERFORM bdc_dynpro USING 'SAPMV13A' '0303'.
PERFORM bdc_field USING 'BDC_OKCODE'
'BACK'.
PERFORM bdc_dynpro USING 'SAPMV13A' '0201'.
PERFORM bdc_field USING 'BDC_OKCODE'
'BACK'.
v_cond_cntr = 2.
v_scale_cntr = 1.
v_cong_flg = 2.
ENDIF.
ENDCASE. "CASE wa_header-rec_type.
If the next record is header or no next record found then
call the transaction
READ TABLE i_header INTO lwa_header1 INDEX lv_index.
IF lwa_header1-rec_type = c_h OR sy-subrc NE 0.
v_cong_flg = 2.
v_scale_cntr = 1.
v_item_cntr = 1.
PERFORM call_transaction USING wa_header2 .
CLEAR lv_index.
ENDIF.
ENDLOOP. "LOOP AT i_header INTO wa_header.
ENDIF. "IF NOT i_header[] IS INITIAL.
ENDFORM. "bdc_data
----
Start new screen *
----
FORM bdc_dynpro USING pv_program LIKE bdcdata-program
pv_dynpro LIKE bdcdata-dynpro.
CLEAR wa_bdcdata.
wa_bdcdata-program = pv_program.
wa_bdcdata-dynpro = pv_dynpro.
wa_bdcdata-dynbegin = c_x.
APPEND wa_bdcdata TO i_bdcdata.
CLEAR wa_bdcdata.
ENDFORM. "BDC_DYNPRO
----
Insert field *
----
FORM bdc_field USING pv_fnam LIKE bdcdata-fnam
pv_fval TYPE any.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = pv_fnam.
wa_bdcdata-fval = pv_fval.
APPEND wa_bdcdata TO i_bdcdata.
CLEAR wa_bdcdata.
ENDFORM. "BDC_FIELD
Declaration of local constants
CONSTANTS : lc_tcode TYPE tstc-tcode VALUE 'ME31K',
lc_n TYPE ctu_mode VALUE 'N'.
Declaration of local variables
DATA: lv_msg TYPE string,
lv_opt TYPE ctu_params.
lv_opt-defsize = c_x.
lv_opt-dismode = lc_n.
lv_opt-updmode = c_l.
REFRESH i_messtab.
Call the transaction to create the Purchasing Contracts
CALL TRANSACTION lc_tcode USING i_bdcdata
OPTIONS FROM lv_opt
MESSAGES INTO i_messtab.
IF NOT i_messtab[] IS INITIAL.
READ TABLE i_messtab WITH KEY msgtyp = 'E'.
IF sy-subrc EQ 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = i_messtab-msgid
lang = sy-langu
no = i_messtab-msgnr
v1 = i_messtab-msgv1
v2 = i_messtab-msgv2
v3 = i_messtab-msgv3
v4 = i_messtab-msgv4
IMPORTING
msg = lv_msg.
MOVE: p_wa_header-lifnr TO wa_error-lifnr,
p_wa_header-evart TO wa_error-evart,
p_wa_header-vedat TO wa_error-vedat,
p_wa_header-ekorg TO wa_error-ekorg,
p_wa_header-ekgrp TO wa_error-ekgrp,
p_wa_header-epstp TO wa_error-epstp,
p_wa_header-knttp TO wa_error-knttp,
p_wa_header-bukrs TO wa_error-bukrs,
p_wa_header-kdatb TO wa_error-kdatb,
p_wa_header-kdate TO wa_error-kdate,
p_wa_header-ktwrt TO wa_error-ktwrt,
p_wa_header-waers TO wa_error-waers,
p_wa_header-wkurs TO wa_error-wkurs,
p_wa_header-inco1 TO wa_error-inco1,
p_wa_header-inco2 TO wa_error-inco2,
p_wa_header-ihran TO wa_error-ihran,
p_wa_header-angnr TO wa_error-angnr,
lv_msg TO wa_error-msg.
APPEND wa_error TO i_error.
CLEAR wa_error.
ELSE.
READ TABLE i_messtab WITH KEY msgtyp = 'S'.
IF sy-subrc EQ 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = i_messtab-msgid
lang = sy-langu
no = i_messtab-msgnr
v1 = i_messtab-msgv1
v2 = i_messtab-msgv2
v3 = i_messtab-msgv3
v4 = i_messtab-msgv4
IMPORTING
msg = lv_msg.
MOVE: p_wa_header-lifnr TO wa_success-lifnr,
p_wa_header-evart TO wa_success-evart,
p_wa_header-vedat TO wa_success-vedat,
p_wa_header-ekorg TO wa_success-ekorg,
p_wa_header-ekgrp TO wa_success-ekgrp,
p_wa_header-epstp TO wa_success-epstp,
p_wa_header-knttp TO wa_success-knttp,
p_wa_header-bukrs TO wa_success-bukrs,
p_wa_header-kdatb TO wa_success-kdatb,
p_wa_header-kdate TO wa_success-kdate,
p_wa_header-ktwrt TO wa_success-ktwrt,
p_wa_header-waers TO wa_success-waers,
p_wa_header-wkurs TO wa_success-wkurs,
p_wa_header-inco1 TO wa_success-inco1,
p_wa_header-inco2 TO wa_success-inco2,
p_wa_header-ihran TO wa_success-ihran,
p_wa_header-angnr TO wa_success-angnr,
i_messtab-msgv2 TO wa_success-ebeln.
APPEND wa_success TO i_success.
CLEAR wa_success.
ENDIF.
ENDIF.
ENDIF.
REFRESH i_bdcdata.
ENDFORM. " call_transaction
Regards,
Nagaraj
07-04-2007 12:40 AM
Hi All,
Can any one answer after excuting transaction MRKO using
Call transaction using IBDCDATA... syntax
How can we trap messages. MRKO displays report in ALV format after you settle any consignment?