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

BDC for MFBF Component Backflush

Former Member
0 Likes
2,285

Hi Experts,

i' have developed a BDC program for MFBF Transaction it is posting seperate material document for every material which is in our flatfile instead of that it should post only one material document for all the material's in flatfile. and also please send me complete program for refrence if any?

Moderator message : Do not ask for sample program. Thread locked.

Edited by: Vinod Kumar on Jan 9, 2012 1:18 PM

1 ACCEPTED SOLUTION
Read only

former_member212713
Contributor
0 Likes
1,630

Hi;

Please check below BAPI's for MFBF and after the read documents about these BAPI.

Best regards

BAPI_REPMANCONF1_CREATE_MTS

BAPI_REPMANCONF_CREATE_MTS

6 REPLIES 6
Read only

former_member212713
Contributor
0 Likes
1,631

Hi;

Please check below BAPI's for MFBF and after the read documents about these BAPI.

Best regards

BAPI_REPMANCONF1_CREATE_MTS

BAPI_REPMANCONF_CREATE_MTS

Read only

0 Likes
1,630

Hi MUTLU,

Thanks for replay, pl send me any program for reference i'm new to MFBF trasaction. this is my code

LOOP AT itab .

CLEAR BDCDATA .

REFRESH BDCDATA.

clear messtab .refresh messtab .

sr_no = sr_no + 1 .

perform bdc_dynpro using 'SAPLBARM' '0800'.

perform bdc_field using 'BDC_CURSOR'

'RM61B-RB_KOMPO'.

perform bdc_field using 'BDC_OKCODE'

'=RBTYP'.

perform bdc_field using 'RM61B-RB_BAUGR'

''.

perform bdc_field using 'RM61B-RB_KOMPO'

'X'.

CLEAR FVAL.

CONCATENATE BUDAT6(2) '.' BUDAT4(2) '.' BUDAT+0(4) INTO FVAL.

PERFORM BDC_FIELD USING 'RM61B-BUDAT' FVAL.

CLEAR FVAL.

CONCATENATE BLDAT6(2) '.' BLDAT4(2) '.' BLDAT+0(4) INTO FVAL.

PERFORM BDC_FIELD USING 'RM61B-BLDAT' FVAL.

perform bdc_field using 'RM61B-WERKS'

P_WERKS.

perform bdc_dynpro using 'SAPLBARM' '0800'.

perform bdc_field using 'BDC_OKCODE'

'=ISTDA'.

perform bdc_field using 'RM61B-RB_KOMPO'

'X'.

perform bdc_field using 'RM61B-MATNR'

ITAB-PARMAT.

perform bdc_field using 'RM61B-WERKS'

P_WERKS.

perform bdc_field using 'RM61B-BOM_OFF'

'X'.

perform bdc_dynpro using 'SAPLCOWB' '0130'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'COWB_COMP-MATNR(01)'

ITAB-CHMAT.

perform bdc_field using 'COWB_COMP-ERFMG_R(01)'

ITAB-QTY.

IF NOT ITAB-UNIT IS INITIAL.

perform bdc_field using 'COWB_COMP-ERFME(01)'

ITAB-UNIT.

ENDIF.

perform bdc_field using 'COWB_COMP-WERKS(01)'

p_werks.

perform bdc_field using 'COWB_COMP-LGORT(01)'

ITAB-LGORT.

*IF ITAB-BATCH NE ' ' .

  • perform bdc_field using 'BDC_CURSOR'

  • 'COWB_COMP-ERFMG_R(01)'.

*

  • perform bdc_field using 'COWB_COMP-CHARG(01)'

  • itab-batch.

*ENDIF.

SELECT SINGLE * FROM MARD INTO MARD WHERE MATNR = ITAB-CHMAT AND

WERKS = p_werks AND LGORT = ITAB-LGORT.

perform bdc_dynpro using 'SAPLCOWB' '0130'.

perform bdc_field using 'BDC_OKCODE'

'=WEIT'.

IF MARD-LABST = 0.

perform bdc_dynpro using 'SAPLMDBF' '0100'.

perform bdc_field using 'BDC_OKCODE'

'=TAKE'.

perform bdc_dynpro using 'SAPLBARM' '0171'.

perform bdc_field using 'BDC_OKCODE'

'=GOON'.

ELSEIF MARD-LABST LT ITAB-QTY.

perform bdc_dynpro using 'SAPLBARM' '0171'.

perform bdc_field using 'BDC_OKCODE'

'=GOON'.

  • ELSEIF MARD-LABST GT ITAB-QTY.

ENDIF.

Read only

0 Likes
1,630

I'm using BAPI in healthy for two months .

I think BAPI method more better then Batch Input method. You may spend time for BAPI. But your work must be more solid and more correct.

Best regards.


Loop at itab.

  CALL FUNCTION 'BAPI_REPMANCONF1_CREATE_MTS'
       EXPORTING
            BFLUSHFLAGS   = GS_BFLUSHFLAGS
            BFLUSHDATAGEN = GS_BFLUSHDATAGEN
            BFLUSHDATAMTS = GS_BFLUSHDATAMTS
       IMPORTING
            CONFIRMATION  = GV_CONFIRMATION
            RETURN        = GS_RETURN.
* TABLES
*   SERIALNR            =    .
  IF NOT GV_CONFIRMATION IS INITIAL.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
         EXPORTING
              WAIT   = 'X'
         IMPORTING
              RETURN = GS_RETURN_COMMIT.
endif.
endloop.

Read only

0 Likes
1,630

Melih, would you be so kind to give an example on how did u fill the structures for it to work ? There might be something that I'm missing because I only get a confirmation number, but no material movement and no error.

This is my code:

ls_bflushflags-bckfltype      = '11'.

  ls_bflushdatagen-materialnr   = 'P02321801'.
  ls_bflushdatagen-prodplant    = '1100'.
  ls_bflushdatagen-prodversion  = '0001'.
  ls_bflushdatagen-postdate     = sy-datum.
  ls_bflushdatagen-docdate      = sy-datum.
  ls_bflushdatagen-backflquant  = '2.000'.

  ls_goodsmovements-material    = 'p02321801'.
  ls_goodsmovements-plant       = '1100'.
*ls_goodsmovements-stge_loc = 'mfg2'.
*ls_goodsmovements-batch = 'cpuassy05'.
  ls_goodsmovements-move_type   = '131'.
  ls_goodsmovements-base_uom    = 'BUC'.
  ls_goodsmovements-quantity    = '2.000'.

  APPEND ls_goodsmovements TO lt_goodsmovements.

  CALL FUNCTION 'BAPI_REPMANCONF1_CREATE_MTS'
    EXPORTING
      bflushflags    = ls_bflushflags
      bflushdatagen  = ls_bflushdatagen
    IMPORTING
      confirmation   = lv_confirmation
      return         = ls_return
    TABLES
      goodsmovements = lt_goodsmovements.

  IF NOT lv_confirmation IS INITIAL.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait   = 'X'
      IMPORTING
        return = ls_return.
  ENDIF.

I even tried to use FM "RM_BACKFLUSH_GO" and "RM_BACKFLUSH_CHECK_AO" but I still get the same result.

Can you help (or any of you guys :P) ?

Thank you,

Marius

Read only

Former Member
0 Likes
1,630

Dear Srinivas,

You can use the BAPI BAPI_REPMANCONF1_CREATE_MTS and then COMMIT that and then you can use MB_CREATE_GOODS_MOVEMENT and MB_POST_GOODS_MOVEMENT and then do the COMMIT.

Using BAPI_REPMANCONF1_CREATE_MTS, you can do the component posting and while doing the goods movement, you can loop all the item Materials and then pass the CTCOD parameter with 'MFBF' value.

Read only

0 Likes
1,630

Hi Teju,

Actually there is a existing BDCprogram which is creating posting document for every material in the flatfile but our client wants to create only one posting document for whole flatfile and he don't want to create new rogram like BAPI he wants to change the existing BDC only is this ossible to achive this requirement through BDC?i'm already posted my code for BDC .