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-table control items recording

Former Member
0 Likes
636

Hi all,

while recording the transaction FMBBC-'Budget data', I am not able to capture the line items of the table control below the header data.

Please hint any technique to capture the table control items...????

thanks

Hi all,

while recording the transaction FMBBC-'Budget data', I am not able to capture the line items of the table control below the header data.

Please hint any technique to capture the table control items...????

thanks

3 REPLIES 3
Read only

gopi_narendra
Active Contributor
0 Likes
559

use the FIND button, while recording the transaction only use the FIND button and enter the required item number, which will make u capture the ITEMs

Read only

Former Member
0 Likes
559

Hi,

Use BAPI BAPI_0050_CREATE.

Regards,

Ram

Read only

Former Member
0 Likes
559

Hello,

Please check the below code it may help u.

&----


*& Include Z_93900_MATERIAL1_F01 *

&----


&----


*& Form value_request_file

&----


*& Get File Path

----


FORM value_request_file .

CALL FUNCTION 'F4_FILENAME'

IMPORTING

file_name = p_f_in.

ENDFORM. " value_request_file

&----


*& Form validate_file

&----


  • Validate The Input File

----


FORM validate_file .

  • Check name of input PC file has been supplied.

IF p_f_in EQ space.

MESSAGE e000 .

ENDIF.

  • Check input file type has been supplied correctly.

IF p_ft_in NE c_file_type_asc.

MESSAGE e001 .

ENDIF.

  • Check that the PC filetype is valid

IF p_f_in NS '.csv' OR p_f_in NS '.CSV'.

MESSAGE e002 .

ENDIF.

ENDFORM. " validate_file

&----


*& Form pc_upload

&----


  • text

----


FORM pc_upload .

DATA : w_filename_tx TYPE string.

MOVE p_f_in TO w_filename_tx.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = w_filename_tx

filetype = 'ASC'

IMPORTING

filelength = w_filelength_pd

TABLES

data_tab = t_data_in

EXCEPTIONS

file_open_error = 1

file_read_error = 2

no_batch = 3

invalid_type = 5

unknown_error = 7.

IF sy-subrc NE 0.

EXIT.

ENDIF.

ENDFORM. " pc_upload

&----


*& Form format_data

&----


  • text

----


FORM format_data .

LOOP AT t_data_in .

SPLIT t_data_in AT ','

INTO g_t_tab-omatnr

g_t_tab-nmatnr

g_t_tab-owerks

g_t_tab-olgort

g_t_tab-erfmg.

APPEND g_t_tab.

ADD 1 TO g_f_recs.

ENDLOOP.

ENDFORM. " format_data

*&----


**& Form validate_date *

*&----


**& text *

*&----


**& --> p1 text *

**& <-- p2 text *

*&----


*

**validating date

*

FORM validate_date .

w_date = sy-datum.

CALL FUNCTION 'CONVERSION_EXIT_D3DAT_OUTPUT'

EXPORTING

input = w_date

IMPORTING

output = w_date1.

MOVE w_date1+6(4) TO w_date2.

ENDFORM. " validate_date

*

*&----


**& Form UPDATE_PROCESSING

*&----


*

FORM update_processing.

PERFORM construct_bdc_data .

ENDFORM. " UPDATE_PROCESSING

*

&----


*& Form Construct_BDC_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM construct_bdc_data .

DATA: w_qty_tx(17),

w_meins LIKE mara-meins.

LOOP AT g_t_tab.

REFRESH bdcdata.

PERFORM bdc_dynpro USING 'SAPMM07M' '0400'.

PERFORM bdc_field USING 'BDC_CURSOR' 'MKPF-BUDAT'.

PERFORM bdc_field USING 'BDC_OKCODE' '/00'.

PERFORM bdc_field USING 'MKPF-BKTXT' '93900 Golive'.

PERFORM bdc_field USING 'RM07M-BWARTWA' '309'.

PERFORM bdc_field USING 'RM07M-WERKS' g_t_tab-owerks.

PERFORM bdc_field USING 'RM07M-LGORT' g_t_tab-olgort.

PERFORM bdc_dynpro USING 'SAPMM07M' '0421'.

PERFORM bdc_field USING 'BDC_CURSOR' 'MSEG-ERFMG(01)'.

PERFORM bdc_field USING 'BDC_OKCODE' '/00'.

PERFORM bdc_field USING 'MSEGK-UMWRK' p_nwerks.

PERFORM bdc_field USING 'MSEGK-UMLGO' p_nlgort.

PERFORM bdc_field USING 'MSEGK-UMMAT' g_t_tab-nmatnr.

PERFORM bdc_field USING 'MSEG-MATNR(01)' g_t_tab-omatnr.

w_qty_tx = g_t_tab-erfmg.

PERFORM bdc_field USING 'MSEG-ERFMG(01)' w_qty_tx.

CLEAR w_meins.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

input = g_t_tab-nmatnr

IMPORTING

OUTPUT = g_t_tab-nmatnr.

SELECT SINGLE meins

INTO w_meins

FROM mara

WHERE matnr = g_t_tab-nmatnr.

PERFORM bdc_field USING 'MSEG-ERFME(01)' w_meins.

PERFORM bdc_field USING 'DKACB-FMORE' 'X'.

PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.

PERFORM bdc_field USING 'BDC_OKCODE' '=ENTE'.

PERFORM call_transaction.

ENDLOOP.

ENDFORM. " Construct_BDC_data

&----


*& Form call_transaction

&----


  • text

----


  • --> p1 text

  • <-- p2 text

*----


FORM call_transaction .

DATA: w_mode VALUE 'N'.

  • Exucute transaction via Call Transaction

CALL TRANSACTION 'MB1B'

USING bdcdata

MODE w_mode

UPDATE 'S'

MESSAGES INTO t_msg .

  • check for all terminal error messages

READ TABLE t_msg WITH KEY msgtyp = 'S'

msgid = 'M7'

msgnr = '060'.

IF sy-subrc EQ 0.

g_t_mat-mblnr = t_msg-msgv1.

ELSE.

LOOP AT t_msg.

CHECK t_msg-msgtyp NE 'S'.

CHECK t_msg-msgtyp NE 'I'.

CHECK t_msg-msgtyp NE 'W'.

PERFORM get_msg_text USING t_msg-msgid t_msg-msgnr

CHANGING g_t_mat-msg.

g_t_mat-status = t_msg-msgtyp.

EXIT.

ENDLOOP.

ENDIF.

append g_t_mat.

ENDFORM. " CALL TRANSACTION

&----


*& Form bdc_dynpro *

&----


*& text *

&----


FORM bdc_dynpro USING program dynpro.

CLEAR bdcdata.

bdcdata-program = program.

bdcdata-dynpro = dynpro.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

ENDFORM. " bdc_dynpro

&----


*& Form bdc_field *

&----


*& text *

&----


FORM bdc_field USING fnam fval.

CLEAR bdcdata.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

APPEND bdcdata.

ENDFORM. " bdc_field

&----


*& Form GET_MSG_TEXT

&----


  • text

----


  • -->P_T_MSG_MSGID text

  • -->P_T_MSG_MSGNR text

  • <--P_W_DETAILS_MSG text

----


*

FORM get_msg_text USING p_msgid

p_msgnr

CHANGING p_text.

DATA : w_arbgb_tx LIKE t100-arbgb.

DATA : t100 LIKE t100.

  • GET MESSAGE TEXT

w_arbgb_tx = p_msgid.

CALL FUNCTION 'T100_SINGLE_READ'

EXPORTING

t100_sprsl = sy-langu

t100_arbgb = w_arbgb_tx

t100_msgnr = p_msgnr

IMPORTING

wt100 = t100

EXCEPTIONS

not_found = 1

OTHERS = 2.

CHECK sy-subrc = 0.

p_text = t100-text.

ENDFORM. " GET_MSG_TEXT

&----


*& Form bdc_create *

&----


*& text *

&----


*& --> p1 text *

*& <-- p2 text *

&----


FORM bdc_create .

PERFORM bdc_open_group.

PERFORM bdcdata_populate.

PERFORM bdc_close.

ENDFORM. " bdc_create

&----


*& Form bdc_open_group *

&----


*& text *

&----


*& --> p1 text *

*& <-- p2 text *

&----


FORM bdc_open_group .

DATA : w_user_tx LIKE apqi-userid.

w_user_tx = sy-uname.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

client = sy-mandt

group = 'LT06'

keep = 'X'

user = w_user_tx

EXCEPTIONS

client_invalid = 01

destination_invalid = 02

group_invalid = 03

holddate_invalid = 04

internal_error = 05

queue_error = 06

running = 07

user_invalid = 08.

CASE sy-subrc.

WHEN 0.

WHEN OTHERS.

WRITE: / 'BDC OPEN ERROR', sy-subrc.

ENDCASE.

ENDFORM. " bdc_open_group

&----


*& Form bdc_populate *

&----


*& text *

&----


*& --> p1 text *

*& <-- p2 text *

&----


FORM bdcdata_populate .

LOOP AT g_t_mat.

REFRESH bdcdata.

PERFORM bdc_dynpro1 USING 'SAPML02B' '0203'.

PERFORM bdc_field1 USING 'BDC_CURSOR' 'RL02B-DUNKL'.

PERFORM bdc_field1 USING 'BDC_OKCODE' '/00'.

PERFORM bdc_field1 USING 'RL02B-MBLNR' g_t_mat-mblnr.

PERFORM bdc_field1 USING 'RL02B-MJAHR' w_date2.

PERFORM bdc_field1 USING 'RL02B-LGNUM' p_lgnum.

PERFORM bdc_field1 USING 'RL02B-DUNKL' 'D'.

w_tcode = 'LT06'.

PERFORM bdc_insert.

ENDLOOP.

ENDFORM. " bdcdata_populate

&----


*& Form bdc_insert *

&----


*& text *

&----


*& --> p1 text *

*& <-- p2 text *

&----


FORM bdc_insert.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

tcode = w_tcode

TABLES

dynprotab = bdcdata

EXCEPTIONS

internal_error = 1

not_open = 2

queue_error = 3

tcode_invalid = 4

printing_invalid = 5

posting_invalid = 6

OTHERS = 7.

CASE sy-subrc.

WHEN 0.

WHEN OTHERS.

WRITE: / 'BDC INSERT ERROR', sy-subrc.

ENDCASE.

ENDFORM. " bdc_insert

&----


*& Form bdc_close1 *

&----


*& text *

&----


*& --> p1 text *

*& <-- p2 text *

&----


FORM bdc_close.

CALL FUNCTION 'BDC_CLOSE_GROUP'

EXCEPTIONS

not_open = 1

queue_error = 2

OTHERS = 3.

CASE sy-subrc.

WHEN 0.

WHEN OTHERS.

WRITE: / 'BDC CLOSE ERROR', sy-subrc.

ENDCASE.

ENDFORM. " bdc_close

&----


*& Form bdc_dynpro1 *

&----


*& text *

&----


FORM bdc_dynpro1 USING program dynpro.

CLEAR bdcdata.

bdcdata-program = program.

bdcdata-dynpro = dynpro.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

ENDFORM. " bdc_dynpro

&----


*& Form bdc_feild1 *

&----


*& text *

&----


FORM bdc_field1 USING fnam fval.

CLEAR bdcdata.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

APPEND bdcdata.

ENDFORM. " bd

Regards