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: 

bdc problem

Former Member
0 Kudos

Hi i have a selection screen for a company code(parameter) and i want to call a zt1(custom transaction) and that transaction contain comapny code and i want to pass the parameter value to that transaction code.

5 REPLIES 5

Former Member
0 Kudos

Hello Kiran,

Use SET PARAMETER ID.

Like this.

if not P_BUKRS is initial.

BUKRS = P_BUKRS.

ENDIF.

SET PARAMETER ID 'BUK' FIELD BUKRS.

If useful reward points.

Vasanth

0 Kudos

i dont have any parameter id for a field in a transaction

Former Member
0 Kudos

Hi Kiran,

Try doing a partial BDC recording for that transaction using Transaction recorder(SHDB).

Check this sample code using Partial BDC for Transaction <b>MD48</b>



 REPORT zztest.
 
DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE,
       layout TYPE rm61m-usprf.
 
DATA:   bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.
 
 
START-OF-SELECTION.
 
  layout = 'SAPMPS'.
  SELECT * FROM mara INTO TABLE it_mara UP TO 2 ROWS.
 
  LOOP AT it_mara.
 
 
    PERFORM bdc_dynpro      USING 'SAPMM61M' '0103'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  'TCAL'.
 
    PERFORM bdc_field       USING 'RM61M-MATNR'
                                  it_mara-matnr.
    PERFORM bdc_field       USING 'RM61M-USPRF'
                                  layout.
    CALL TRANSACTION 'MD48'
 
    USING bdcdata
    MODE   'A'.
 
  ENDLOOP.
 
 
 
*----------------------------------------------------------------------*
*        Start new screen                                              *
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
  CLEAR bdcdata.
  bdcdata-program  = program.
  bdcdata-dynpro   = dynpro.
  bdcdata-dynbegin = 'X'.
  APPEND bdcdata.
ENDFORM.                    "BDC_DYNPRO
 
*----------------------------------------------------------------------*
*        Insert field                                                  *
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
 
  CLEAR bdcdata.
  bdcdata-fnam = fnam.
  bdcdata-fval = fval.
  APPEND bdcdata.
 
ENDFORM.                    "BDC_FIELD

Regards,

AS.

Former Member
0 Kudos

hi kiran,

parameter: p_matnr like mara-matnr.

select * from mara into table itab

where matnr in p_matnr.

LOOP AT ITAB3.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0060'.

PERFORM BDC_FIELD USING 'RMMG1-MATNR'

ITAB3-MATNR.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=AUSW'.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0070'.

PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(01)'

ITAB3-KZSEL_01.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=ENTR'.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4004'.

PERFORM BDC_FIELD USING 'MARA-MEINS'

ITAB3-MEINS.

PERFORM BDC_FIELD USING 'MARA-BRGEW'

ITAB3-BRGEW.

PERFORM BDC_FIELD USING 'MARA-GEWEI'

ITAB3-GEWEI.

PERFORM BDC_FIELD USING 'MARA-NTGEW'

ITAB3-NTGEW.

PERFORM BDC_FIELD USING 'MARA-VOLUM'

ITAB3-VOLUM.

PERFORM BDC_FIELD USING 'MARA-VOLEH'

ITAB3-VOLEH.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=BU'.

CALL TRANSACTION 'MM02' USING IT_BDCDATA MODE 'A'

UPDATE 'S'

MESSAGES INTO IT_MESSAGES.

CLEAR IT_BDCDATA.

REFRESH IT_BDCDATA.

ENDLOOP.

hope this helps,

do reward if it helps,

priya.

Former Member
0 Kudos

Hi Kiran, U can do the recording in SHDB or u can directly populate the bdcdata structure internal table and pass it as a parameter in call transaction.

Please find the sample code.

data: itab_bdcdata TYPE TABLE OF bdcdata,

wa_bdcdata TYPE bdcdata.

CLEAR wa_bdcdata_ds.

wa_bdcdata_ds-program = <custom program name>.

wa_bdcdata_ds-dynpro = '1000'.

wa_bdcdata_ds-dynbegin = 'X'.

APPEND wa_bdcdata_ds TO itab_bdcdata.

CLEAR wA_bdcdata.

wa_bdcdata_ds-fnam = 'BDC_CURSOR'.

wa_bdcdata_ds-fval = 'P_BUKRS'.

APPEND wa_bdcdata_ds TO itab_bdcdata.

clear wa_bdcdata.

wa_bdcdata_ds-fnam = 'P_BUKRS-LOW'.

wa_bdcdata_ds-fval = P_COD." COMPANY CODE FROM U R PRG

APPEND wA_bdcdata TO itab_bdcdata.

CALL TRANSACTION <custom transaction>

USING itab_bdcdata MODE c_mode.

please let me know if i am wrong.

Best Regards,

Swaroop