How to handle Table control (pls read question)
Hi All,
I am writing code for CA21 Tcode , i am getting values into table control using P+ successfully but problem is i have to select 1st entry in table control and it will go to other screen and come back and select 2nd entry ....like that it will do until all entries in table control is over .
Can any one pls send any code for this logic.
Regards,
Sudhakar Reddy.A
Hi ,
This should done dynamically with out user interaction .
Regards,
Sudhakar Reddy A
Similar Messages
-
How to handle Table control in BDC
How to handle Table control in BDC
HI,
Table Control in BDC
HI,
Refer the link:
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
The concept is easy: it has to indicate the index of the table control in the field name, so if you have to populate the first record of table control:
BDC-FIELDNAME = <FIELDNAME>(01).
If you fill the second row:
BDC-FIELDNAME = <FIELDNAME>(02).
and so....
Now the problem is usually on how many records you have to load, because u can fill only the rows of table control available in the screen, If you have more records than it can be displayed yuo have to simulate the command to go next page.
The number of recod can be displayed can depend on pc resolution and many program haven't command to go to next page (in this case it could be impossible create a BDC program9.
A way to create a bdc program resolution indipendent is to work on the first and second row.
- Place the first hit in the first row of bdc;
- Place the second insert in the second row of bdc;
- Place the last hit to the top of table control;
- Place the next hit in the second row;
- Place the last hit to the top of table control;
- Place the next hit in the second row;
- .... and so
For more info: Search in SDN with TABLE CONTROL IN BDC.
Will get a lot of related links.
<b>Reward points if this Helps.
Manish</b> -
How to handle table control in lsmw recording method
hi expert please tell me the procedure for how to handle table control in lsmw recording method
Locked for same reason as how to upload data for me01 using LSMW BDC METHOD
Edited by: Matt on May 9, 2011 8:52 AMSri,
just search in SDN search box by giving table control in lsmw you will get hell lot of threads for same.
Amit. -
Hi abapers how to handle table control in bdc
hi experts please guide me
how to handle table control in bdc? could u please explain me briefly
thanks and regardssayeed,
Go thru this code it may help you. check bold code for the table control..
report zsunil_bdc
no standard page heading line-size 255.
INTERNAL TABLES *
DATA: BEGIN OF IT_KNA1 OCCURS 0,
CUSTOMER LIKE RF02D-KUNNR,
COMPANY_CODE LIKE RF02D-BUKRS,
ACCOUNT_GROUP LIKE RF02D-KTOKD,
TITLE LIKE KNA1-ANRED,
NAME LIKE KNA1-NAME1,
SEARCH_TERM LIKE KNA1-SORTL,
STREET LIKE KNA1-STRAS,
CITY LIKE KNA1-ORT01,
POSTAL_CODE LIKE KNA1-PSTLZ,
COUNTRY LIKE KNA1-LAND1,
LANGUAGE_KEY LIKE KNA1-SPRAS,
CNTRY LIKE KNBK-BANKS,
BANK_KEY LIKE KNBK-BANKL,
BANK_ACCOUNT LIKE KNBK-BANKN,
REC_ACCOUNT LIKE KNB1-AKONT,
END OF IT_KNA1.
DATA: IT_BDCDATA TYPE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA: IT_MESSAGES TYPE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
SELECTION SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETER P_FILE TYPE RLGRAP-FILENAME DEFAULT 'C:\CUSTOMER.TXT'
OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION SCREEN *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
PERFORM HELP_FILE USING P_FILE.
START OF SELECTION *
START-OF-SELECTION.
*UPLOADING THE FILE FROM WORKSTATION
PERFORM UPLOAD_FILE USING P_FILE.
*POPULATING DATA.
PERFORM POPULATE_FILE.
*& Form HELP_FILE
text
-->P_P_FILE text
form HELP_FILE using p_p_file.
DATA: L_FILE TYPE IBIPPARMS-PATH.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = L_FILE.
P_P_FILE = L_FILE.
endform. " HELP_FILE
*& Form UPLOAD_FILE
text
-->P_P_FILE text
form UPLOAD_FILE using p_p_file.
CALL FUNCTION 'UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'P_P_FILE'
FILETYPE = 'DAT'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
TABLES
data_tab = IT_KNA1
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " UPLOAD_FILE
*& Form POPULATE_FILE
text
--> p1 text
<-- p2 text
form POPULATE_FILE .
DATA: L_STRING TYPE STRING,
L_COUNTER(2) TYPE N,
V_INDEX TYPE SY-TABIX.
LOOP AT IT_KNA1.
V_INDEX = SY-TABIX.
AT NEW CUSTOMER.
READ TABLE IT_KNA1 INDEX V_INDEX.
IF SY-SUBRC = 0.
perform bdc_dynpro using 'SAPMF02D' '0105'.
perform bdc_field using 'BDC_CURSOR'
'RF02D-KTOKD'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02D-KUNNR'
IT_KNA1-CUSTOMER.
perform bdc_field using 'RF02D-BUKRS'
IT_KNA1-COMPANY_CODE.
perform bdc_field using 'RF02D-KTOKD'
IT_KNA1-ACCOUNT_GROUP.
*PERFORM BDC_FIELD USING 'RF02D-D0130'
'X'.
perform bdc_dynpro using 'SAPMF02D' '0110'.
perform bdc_field using 'BDC_CURSOR'
'KNA1-SPRAS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KNA1-ANRED'
IT_KNA1-TITLE.
perform bdc_field using 'KNA1-NAME1'
IT_KNA1-NAME.
perform bdc_field using 'KNA1-SORTL'
IT_KNA1-SEARCH_TERM.
perform bdc_field using 'KNA1-STRAS'
IT_KNA1-STREET.
perform bdc_field using 'KNA1-ORT01'
IT_KNA1-CITY.
perform bdc_field using 'KNA1-PSTLZ'
IT_KNA1-POSTAL_CODE.
perform bdc_field using 'KNA1-LAND1'
IT_KNA1-COUNTRY.
perform bdc_field using 'KNA1-SPRAS'
IT_KNA1-LANGUAGE_KEY.
perform bdc_dynpro using 'SAPMF02D' '0120'.
perform bdc_field using 'BDC_CURSOR'
'KNA1-LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02D' '0130'.
PERFORM BDC_FIELD USING 'RF02D-D0130'
'X'.
perform bdc_field using 'BDC_CURSOR'
'KNBK-BANKN(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02D' '0210'.
perform bdc_field using 'BDC_CURSOR'
'KNB1-AKONT'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_field using 'KNB1-AKONT'
IT_KNA1-REC_ACCOUNT.
perform bdc_dynpro using 'SAPLRSFH' '0100'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'RSIODYNP4-LOW(01)'.
ENDIF.
ENDAT.
L_COUNTER = L_COUNTER + 1.
CLEAR L_STRING.
CONCATENATE 'KNBK-BANKS(' L_COUNTER ')' INTO L_STRING.
PERFORM BDC_FIELD USING L_STRING
IT_KNA1-CNTRY.
CLEAR L_STRING.
CONCATENATE 'KNBK-BANKL(' L_COUNTER ')' INTO L_STRING.
PERFORM BDC_FIELD USING L_STRING
IT_KNA1-BANK_KEY.
CLEAR L_STRING.
CONCATENATE 'KNBK-BANKN(' L_COUNTER ')' INTO L_STRING.
PERFORM BDC_FIELD USING L_STRING
IT_KNA1-BANK_ACCOUNT.
AT END OF CUSTOMER.
READ TABLE IT_KNA1 INDEX V_INDEX.
IF SY-SUBRC = 0.
CALL TRANSACTION 'FD01' USING IT_BDCDATA MODE 'A' UPDATE 'S' MESSAGES
INTO IT_MESSAGES.
IF SY-SUBRC <> 0.
PERFORM EMPLOYEEID_ERROR.
*ELSE.
ENDIF.
WRITE: SY-SUBRC.
perform message_format_write.
*ENDIF.
*WRITE: SY-SUBRC.
CLEAR IT_BDCDATA.
REFRESH IT_BDCDATA.
ENDIF.
ENDAT.
ENDLOOP.
endform. " POPULATE_FILE
*& Form bdc_dynpro
text
-->P_0224 text
-->P_0225 text
form bdc_dynpro using value(p_0224)
value(p_0225).
IT_BDCDATA-PROGRAM = P_0224.
IT_BDCDATA-DYNPRO = P_0225.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
CLEAR IT_BDCDATA.
endform. " bdc_dynpro
*& Form bdc_field
text
-->P_0229 text
-->P_0230 text
form bdc_field using value(p_0229)
value(p_0230).
IT_BDCDATA-FNAM = P_0229.
IT_BDCDATA-FVAL = P_0230.
APPEND IT_BDCDATA.
CLEAR IT_BDCDATA.
endform. " bdc_field
*& Form EMPLOYEEID_ERROR
text
--> p1 text
<-- p2 text
form EMPLOYEEID_ERROR .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
DEST = FILLER8
GROUP = 'Z50583_REC1'
HOLDDATE = FILLER8
KEEP = 'X'
USER = SY-UNAME
RECORD = FILLER1
PROG = SY-CPROG
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'FD01'
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
SIMUBATCH = ' '
CTUPARAMS = ' '
TABLES
dynprotab = IT_BDCDATA
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 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.
endform. " EMPLOYEEID_ERROR
*& Form message_format_write
text
--> p1 text
<-- p2 text
form message_format_write .
DATA: L_MSG(200).
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = SY-LANGU
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = L_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
WRITE: / L_MSG.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " message_format_write
~~Guduri -
How to handle table control in BDC while uploading item details for anorder
How to handle table control in BDC while uploading item details for an order?
What is the use of CTU_PARAMS structure in BDC?
In Finance I have done some changes to the layout set by coping to a zscript(duning letter) and how can assign the print program?
What is the process to test the finance script?
How can I see the print preview whether it is coming correctly or not?
Thanks in advance.
Regards.
Abhilash.hi,
for the bdc control refer the following link:
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
ctu_params:
refer to the link
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/dataTransfers-LSMW%2CALE%2C+BDC
reward if useful,
thanks and regards -
How to handle Table control in BDC? Difference between BDC & LSMW?
Hi
How to handle Table control in BDC? Difference between BDC & LSMW?
Regards,
RaghuHi ,
the diff b/w normal BDC and with table control is that with table control u can enter as many lineitems as u want..so during recording if u r entering 3 line items..then the program will show (1), (2) and (3) with that.
chane that fixed no to variable.
check that sample code.
in this for new customer...any no of items can be entered.
LOOP AT t_cusdata.
REFRESH t_bdcdata.
ON CHANGE OF t_cusdata-kunnr.
initial screen.
PERFORM bdc_dynpro USING 'SAPMV10A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MV10A-VTWEG'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MV10A-KUNNR'
t_cusdata-kunnr.
PERFORM bdc_field USING 'MV10A-VKORG'
t_cusdata-vkorg. "'HCL'.
PERFORM bdc_field USING 'MV10A-VTWEG'
t_cusdata-vtweg. "'HL'.
DATA: fnam(20) TYPE c,
fnam1(20) TYPE c,
idx(2) TYPE c.
MOVE 1 TO idx.
LOOP AT t_matdata WHERE kunnr = t_cusdata-kunnr.
PERFORM bdc_dynpro USING 'SAPMV10A' '0200'.
CONCATENATE 'MV10A-KDMAT(' idx ')' INTO fnam.
PERFORM bdc_field USING 'BDC_CURSOR'
fnam.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
CONCATENATE 'MV10A-MATNR(' idx ')' INTO fnam1.
PERFORM bdc_field USING fnam1
t_matdata-matnr. "'FIN50'.
PERFORM bdc_field USING fnam
t_matdata-kdmat. "'ABCD'.
idx = idx + 1.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMV10A' '0200'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MV10A-MATNR(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SICH'.
CALL TRANSACTION 'VD51' USING t_bdcdata MODE 'A' .
UPDATE 'S' MESSAGES INTO t_err_mes.
Regards,
Sonika -
How to handle Table controls with XD01 in BDC
How to handle Table controls with XD01 in BDC - If there are more than 5/6 records in Table control. - Can any one explain it with a piece of code plz..
Thanks & Regards,
Krishna ChaitanyaHi
check this code...viz for xko1....
DATA: BEGIN OF it_xk01 OCCURS 0,
f1(1),
f2(5),
f3(5),
f4(9),
f5(9),
END OF it_xk01.
DATA: v_count(2) VALUE '00',
v_koinh(14),
v_banks(14),
v_bankn(14),
v_bankl(14),
it_bdcdata TYPE STANDARD TABLE OF bdcdata WITH HEADER LINE,
wa_ctuparams type ctu_params.
PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM get_f4.
START-OF-SELECTION.
PERFORM upload_data.
END-OF-SELECTION.
LOOP AT it_xk01.
IF it_xk01-f1 = 'H'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF02K-KTOKK'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RF02K-KTOKK'
it_xk01-f2.
ENDIF.
IF it_xk01-f1 = 'N'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFA1-PSTLZ'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
PERFORM bdc_field USING 'LFA1-ANRED'
'Mr'.
PERFORM bdc_field USING 'LFA1-NAME1'
it_xk01-f2.
PERFORM bdc_field USING 'LFA1-SORTL'
it_xk01-f3.
PERFORM bdc_field USING 'LFA1-PSTLZ'
it_xk01-f4.
PERFORM bdc_field USING 'LFA1-LAND1'
it_xk01-f5.
PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LFA1-KUNNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=VW'.
ENDIF.
IF it_xk01-f1 = 'I'.
v_count = v_count + 1.
IF v_count le 5.
CONCATENATE 'LFBK-KOINH(' v_count ')' INTO v_koinh.
CONCATENATE 'LFBK-BANKS(' v_count ')' INTO v_banks.
CONCATENATE 'LFBK-BANKN(' v_count ')' INTO v_bankn.
CONCATENATE 'LFBK-BANKL(' v_count ')' INTO v_bankl.
CONDENSE v_koinh NO-GAPS.
CONDENSE v_banks NO-GAPS.
CONDENSE v_bankl NO-GAPS.
CONDENSE v_bankn NO-GAPS.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
v_koinh.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING v_banks
it_xk01-f2.
PERFORM bdc_field USING v_bankl
it_xk01-f3.
PERFORM bdc_field USING v_bankn
it_xk01-f4.
PERFORM bdc_field USING v_koinh
it_xk01-f5.
else.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
v_koinh.
PERFORM bdc_field USING 'BDC_OKCODE'
'=P+'.
v_count = 1.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
v_koinh.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
CONCATENATE 'LFBK-KOINH(' v_count ')' INTO v_koinh.
CONCATENATE 'LFBK-BANKS(' v_count ')' INTO v_banks.
CONCATENATE 'LFBK-BANKN(' v_count ')' INTO v_bankn.
CONCATENATE 'LFBK-BANKL(' v_count ')' INTO v_bankl.
CONDENSE v_koinh NO-GAPS.
CONDENSE v_banks NO-GAPS.
CONDENSE v_bankl NO-GAPS.
CONDENSE v_bankn NO-GAPS.
PERFORM bdc_field USING v_banks
it_xk01-f2.
PERFORM bdc_field USING v_bankl
it_xk01-f3.
PERFORM bdc_field USING v_bankn
it_xk01-f4.
PERFORM bdc_field USING v_koinh
it_xk01-f5.
ENDIF.
ENDIF.
CLEAR it_xk01.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_CURSOR'
v_koinh.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
wa_ctuparams-DISMODE = 'A'.
wa_ctuparams-UPDMODE = 'S'.
wa_ctuparams-DEFSIZE = 'X'.
CALL TRANSACTION 'XK01' USING it_bdcdata MODE 'A'
UPDATE 'S'.
options from wa_ctuparams.
MODE 'A'
UPDATE 'S'.
*& Form upload_data
text
FORM upload_data .
DATA: lv_infile TYPE string.
lv_infile = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_infile
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = it_xk01.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " upload_data
*& Form get_f4
text
FORM get_f4 .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
FIELD_NAME = ' '
IMPORTING
file_name = p_file.
ENDFORM. " get_f4
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR it_bdcdata.
it_bdcdata-program = program.
it_bdcdata-dynpro = dynpro.
it_bdcdata-dynbegin = 'X'.
APPEND it_bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval.
IF FVAL <> NODATA.
CLEAR it_bdcdata.
it_bdcdata-fnam = fnam.
it_bdcdata-fval = fval.
APPEND it_bdcdata.
ENDIF.
ENDFORM. "BDC_FIELD
*H 0302
*N sdng dddsj 500020 IN
*I IN ICICI 734897597 xyz
*I IN SBH 768346687 abc
*I IN SBI 345687346 fgh
*I IN SBH 763846878 ujhgf
*I IN HSBC 797893778 fvdg
*I IN HDFC 723678638 fdgf
*I IN 4444 435645646 fgfg
*I IN 3400 763468768 gfgfg -
How to handle table controls using LSMW
Hi All,
how to use LSMW to handle table control like header and item details eg. VA01 , ME21 etc. To handle these kind of trnasactions can we use LSMW instead BDC to upload data. Please let me know.
Thanks in advance.
Regards,
KalpanaHi Kalpana,
You can have your own custom programs for LSMW if the standard DI/BI IDOC , BAPI dont meet your requirements.
Its little bit complex. You need to register you custom program in table through SM30.
SDX0 - Program Definition ( BI or DI )
SDX1 - Program Assignment
SDX2 - Declaring Structures
SDX3 - Declaring field identifiers for structures
You can goto SM30 and can view the standard BI/DI programs definition by using the four digit Obejct Number...
<b>AS</b> -
In BDC'S how to handle Table control
Hi,
I want to know the concept and code for BDC's in Table control steps(MM01,VA01) and coding.Please its very Urgent.Hi Raghavendra,
Go through this program mm01.
rePORT ymmbdcmm01
NO STANDARD PAGE HEADING LINE-SIZE 255.
*& Table Declarations *
TABLES:rmmg1,makt,mara,mvke, marc,mbew,t100.
TYPE-POOLS: truxs.
DATA: it_raw TYPE truxs_t_text_data.
*& Data Declarations *
DATA:
BEGIN OF t_data OCCURS 0,
data TYPE string,
END OF t_data.
DATA:BEGIN OF it_mess OCCURS 0,
msgtyp(5),
lms(200),
msgv1(50),
END OF it_mess.
DATA: BEGIN OF it_itab OCCURS 0,
matnr TYPE rmmg1-matnr,
mbrsh TYPE rmmg1-mbrsh,
mtart TYPE rmmg1-mtart,
werks TYPE rmmg1-werks,
lgort TYPE rmmg1-lgort,
vkorg TYPE rmmg1-vkorg,
vtweg TYPE rmmg1-vtweg,
maktx TYPE makt-maktx,
meins TYPE mara-meins,
matkl TYPE mara-matkl,
spart TYPE mara-spart,
GEWEI TYPE MARA-GEWEI,
dwerk TYPE mvke-dwerk,
versg TYPE mvke-versg,
mtpos TYPE mvke-mtpos,
mtvfp TYPE marc-mtvfp,
tragr TYPE mara-tragr,
ladgr TYPE marc-ladgr,
sernp TYPE marc-sernp,
txline(25), "added
kordb ,
mprof TYPE mara-mprof,
ekgrp TYPE marc-ekgrp,
dismm TYPE marc-dismm,
dispo TYPE marc-dispo,
disls TYPE marc-disls,
mabst(13) TYPE c,
beskz TYPE marc-beskz,
sobsl TYPE marc-sobsl,
lgpro TYPE marc-lgpro,
dzeit TYPE c,
plifz(3) TYPE c,
webaz TYPE c,
fhori TYPE marc-fhori,
eisbe TYPE c,
strgr(2) TYPE c,
vrmod TYPE c,
vint1(3),
vint2(3),
wzeit(3),
sbdkz TYPE marc-sbdkz,
bklas TYPE mbew-bklas,
vprsv TYPE mbew-vprsv,
verpr(11),
peinh TYPE c,
ekalr TYPE mbew-ekalr,
losgr TYPE c,
RGEKZ(1),
fevor(3),
END OF it_itab.
*decl of internal table of table control for BDCDATA & BDCMSGCOLL
DATA : BEGIN OF bdcdata OCCURS 0.
INCLUDE STRUCTURE bdcdata.
DATA: END OF bdcdata.
DATA:it_msgtab TYPE STANDARD TABLE OF bdcmsgcoll WITH HEADER LINE,
it_msgtab1 TYPE STANDARD TABLE OF bdcmsgcoll WITH HEADER LINE.
DATA : fld(50) TYPE c,
cnt(2) TYPE n,
l_mstring(150).
START-OF-SELECTION.
*& File uploading from xlsheet to sap *
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = 'C:\Documents and Settings\sapthamm\Desktop\mm02.xls'
TABLES
i_tab_converted_data = it_itab
EXCEPTIONS
conversion_failed = 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.
*& Splitting the Internal Table *
LOOP AT t_data.
SPLIT t_data-data AT cl_abap_char_utilities=>horizontal_tab INTO
it_itab-matnr
it_itab-mbrsh
it_itab-mtart
it_itab-werks
it_itab-lgort
it_itab-vkorg
it_itab-vtweg
it_itab-maktx
it_itab-meins
it_itab-matkl
it_itab-spart
it_itab-GEWEI
it_itab-dwerk
it_itab-versg
it_itab-mtpos
it_itab-mtvfp
it_itab-tragr
it_itab-ladgr
it_itab-sernp
it_itab-mprof
it_itab-ekgrp
it_itab-dismm
it_itab-dispo
it_itab-disls
it_itab-mabst
it_itab-beskz
it_itab-sobsl
it_itab-lgpro
it_itab-dzeit
it_itab-plifz
it_itab-webaz
it_itab-fhori
it_itab-eisbe
it_itab-strgr
it_itab-vrmod
it_itab-vint1
it_itab-vint2
it_itab-wzeit
it_itab-sbdkz
it_itab-bklas
it_itab-vprsv
it_itab-peinh
it_itab-ekalr
it_itab-losgr
APPEND it_itab.
CLEAR: it_itab,
t_data-data.
ENDLOOP.
*perform open_dataset using dataset.
*perform open_group.
*do.
*read dataset dataset into it_itab.
*if sy-subrc <> 0. exit. endif.
*& it_itabing of Material Type-HALB *
LOOP AT it_itab.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0060'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMMG1-MATNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RMMG1-MATNR'
it_itab-matnr.
PERFORM bdc_field USING 'RMMG1-MBRSH'
it_itab-mbrsh.
PERFORM bdc_field USING 'RMMG1-MTART'
it_itab-mtart.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(17)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=P+'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(01)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(02)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(04)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(05)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(06)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(08)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(09)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(12)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(13)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(14)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(15)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(17)'
'X'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(09)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(01)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(02)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(06)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(07)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(08)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(09)'
'X'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0080'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMMG1-VTWEG'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_field USING 'RMMG1-WERKS'
it_itab-werks.
PERFORM bdc_field USING 'RMMG1-LGORT'
it_itab-lgort.
PERFORM bdc_field USING 'RMMG1-VKORG'
it_itab-vkorg.
PERFORM bdc_field USING 'RMMG1-VTWEG'
it_itab-vtweg.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARA-SPART'.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARA-MATKL'
it_itab-matkl.
PERFORM bdc_field USING 'MARA-SPART'
it_itab-spart.
PERFORM bdc_field USING 'MARA-GEWEI'
'kg'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MAKT-MAKTX'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARA-SPART'
it_itab-spart.
PERFORM bdc_field USING 'MVKE-DWERK'
it_itab-dwerk.
PERFORM bdc_field USING 'MARA-MATKL'
it_itab-matkl.
PERFORM bdc_field USING 'MVKE-SKTOF'
'X'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MG03STEUER-TAXKM(02)'.
PERFORM bdc_field USING 'MG03STEUER-TAXKM(01)'
'0'.
PERFORM bdc_field USING 'MG03STEUER-TAXKM(02)'
'1'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4200'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'MAKT-MAKTX'
it_itab-MAKTX_040.
*perform bdc_field using 'BDC_CURSOR'
'MG03STEUER-TAXKM(05)'.
PERFORM bdc_field USING 'MG03STEUER-TAXKM(03)'
'1'.
PERFORM bdc_field USING 'MG03STEUER-TAXKM(04)'
'1'.
PERFORM bdc_field USING 'MG03STEUER-TAXKM(05)'
'0'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MAKT-MAKTX'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARA-SPART'
it_itab-spart.
PERFORM bdc_field USING 'MVKE-DWERK'
it_itab-dwerk.
PERFORM bdc_field USING 'MARA-MATKL'
it_itab-matkl.
PERFORM bdc_field USING 'MVKE-SKTOF'
'X'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'BDC_CURSOR'
'MVKE-MTPOS'.
PERFORM bdc_field USING 'MVKE-VERSG'
it_itab-versg.
PERFORM bdc_field USING 'MVKE-MTPOS'
it_itab-mtpos.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARA-GEWEI'
'KG'.
PERFORM bdc_field USING 'MARC-MTVFP'
it_itab-mtvfp.
PERFORM bdc_field USING 'MARA-TRAGR'
it_itab-tragr.
PERFORM bdc_field USING 'MARC-LADGR'
it_itab-ladgr.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARC-SERNP'.
PERFORM bdc_field USING 'MARC-SERNP'
it_itab-sernp.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4040'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=LTEX'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_dynpro USING 'SAPLSTXX' '1100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RSTXT-TXLINE(02)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=TXVB'.
PERFORM bdc_field USING 'RSTXT-TXLINE(02)'
'pcb assembly'.
PERFORM bdc_dynpro USING 'SAPLSTXX' '1100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RSTXT-TXLINE(02)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=TXBA'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4040'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SP09'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARC-EKGRP'
it_itab-ekgrp.
PERFORM bdc_field USING 'MARA-MATKL'
it_itab-matkl.
PERFORM bdc_field USING 'MARC-KORDB'
'X'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARA-MPROF'.
PERFORM bdc_field USING 'MARA-MPROF'
it_itab-mprof.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARC-EKGRP'
it_itab-ekgrp.
PERFORM bdc_field USING 'MARC-DISMM'
it_itab-dismm.
PERFORM bdc_field USING 'MARC-DISPO'
it_itab-dispo.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARC-MABST'.
PERFORM bdc_field USING 'MARC-DISLS'
it_itab-disls.
PERFORM bdc_field USING 'MARC-MABST'
it_itab-mabst.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARC-BESKZ'
it_itab-beskz.
PERFORM bdc_field USING 'MARC-SOBSL'
it_itab-sobsl.
PERFORM bdc_field USING 'MARC-LGPRO'
it_itab-lgpro.
if it_itab-sernp = 'TJSL'.
PERFORM bdc_field USING 'MARC-RGEKZ'
ELSE.
PERFORM bdc_field USING 'MARC-RGEKZ'
'1'.
ENDIF.
PERFORM bdc_field USING 'MARC-DZEIT'
it_itab-dzeit.
PERFORM bdc_field USING 'MARC-PLIFZ'
it_itab-plifz.
PERFORM bdc_field USING 'MARC-WEBAZ'
it_itab-webaz.
PERFORM bdc_field USING 'MARC-FHORI'
it_itab-fhori.
PERFORM bdc_field USING 'MARC-EISBE'
it_itab-eisbe.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARC-PERKZ'
'M'.
PERFORM bdc_field USING 'MARC-STRGR'
it_itab-strgr.
PERFORM bdc_field USING 'MARC-VRMOD'
it_itab-vrmod.
PERFORM bdc_field USING 'MARC-VINT1'
it_itab-vint1.
PERFORM bdc_field USING 'MARC-VINT2'
it_itab-vint2.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARC-WZEIT'.
PERFORM bdc_field USING 'MARC-MTVFP'
it_itab-mtvfp.
PERFORM bdc_field USING 'MARC-WZEIT'
it_itab-wzeit.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARC-SBDKZ'.
PERFORM bdc_field USING 'MARC-SBDKZ'
it_itab-sbdkz.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MAKT-MAKTX'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARC-FEVOR'
'001'.
PERFORM bdc_field USING 'MARC-LGPRO'
it_itab-lgpro.
PERFORM bdc_field USING 'MARC-SERNP'
it_itab-sernp.
PERFORM bdc_field USING 'MARC-DZEIT'
it_itab-dzeit.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MAKT-MAKTX'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
*perform bdc_field using 'MARA-IPRKZ'
it_itab-IPRKZ.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MAKT-MAKTX'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-GEWEI'
'KG'.
PERFORM bdc_field USING 'MARC-SERNP'
it_itab-sernp.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MARA-SPART'
it_itab-spart.
PERFORM bdc_field USING 'BDC_CURSOR'
'MBEW-VPRSV'.
PERFORM bdc_field USING 'MBEW-BKLAS'
it_itab-bklas.
*perform bdc_field using 'MBEW-EKLAS'
it_itab-EKLAS.
PERFORM bdc_field USING 'MBEW-VPRSV'
'v'.
PERFORM bdc_field USING 'MBEW-PEINH'
'1'.
perform bdc_field using 'MBEW-VERPR'
it_itab-VERPR.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MAKT-MAKTX'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MAKT-MAKTX'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'MARA-MEINS'
it_itab-meins.
PERFORM bdc_field USING 'MBEW-EKALR'
'X'.
PERFORM bdc_field USING 'MARC-AWSLS'
'000001'.
PERFORM bdc_field USING 'MARC-LOSGR'
'1'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
it_itab-maktx.
PERFORM bdc_field USING 'BDC_CURSOR'
'MBEW-ZPLPR'.
*perform bdc_field using 'MBEW-ZPLPR'
'6000'.
PERFORM bdc_field USING 'MBEW-BKLAS'
it_itab-bklas.
PERFORM bdc_field USING 'MBEW-VPRSV'
'V'.
PERFORM bdc_field USING 'MBEW-PEINH'
'1'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=YES'.
CALL TRANSACTION 'MM01' USING bdcdata MODE 'A'
UPDATE 'S'
MESSAGES INTO it_msgtab.
CLEAR bdcdata[].
CLEAR it_itab.
PERFORM error.
ENDLOOP.
*& Declaration of Error Handling *
i
it_msgtab1-msgv1 = it_msgtab-msgv1.
it_msgtab1-msgv2 = it_msgtab-msgv2.
it_msgtab1-msgv3 = it_msgtab-msgv3.
APPEND it_msgtab1.
ENDLOOP.
download error message to a file by using function module
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = 'C:\Documents and Settings\sapthamm\Desktop\error.xls'
filetype = 'ASC'
APPEND = ' '
write_field_separator = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
WRITE_EOL = ABAP_TRUE
IMPORTING
FILELENGTH =
TABLES
data_tab = it_mess
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
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
text
-->PROGRAM text
-->DYNPRO text
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.
IF FVAL <> .
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDIF.
ENDFORM. "BDC_FIELD
form error.
LOOP AT it_msgtab.
IF it_msgtab-msgtyp = 'E'.
SELECT SINGLE * FROM t100 WHERE sprsl = it_msgtab-msgspra
AND arbgb = it_msgtab-msgid
AND msgnr = it_msgtab-msgnr.
IF sy-subrc = 0.
l_mstring = t100-text.
IF l_mstring CS '&1'.
REPLACE '&1' WITH it_msgtab-msgv1 INTO l_mstring.
REPLACE '&2' WITH it_msgtab-msgv2 INTO l_mstring.
REPLACE '&3' WITH it_msgtab-msgv3 INTO l_mstring.
REPLACE '&4' WITH it_msgtab-msgv4 INTO l_mstring.
ELSE.
REPLACE '&' WITH it_msgtab-msgv1 INTO l_mstring.
REPLACE '&' WITH it_msgtab-msgv2 INTO l_mstring.
REPLACE '&' WITH it_msgtab-msgv3 INTO l_mstring.
REPLACE '&' WITH it_msgtab-msgv4 INTO l_mstring.
ENDIF.
CONDENSE l_mstring.
it_mess-msgtyp = it_msgtab-msgtyp.
it_mess-lms = l_mstring.
it_mess-msgv1 = it_msgtab-msgv1.
APPEND it_mess.
WRITE: / it_msgtab-msgtyp, l_mstring(150).
ELSE.
WRITE: / it_msgtab.
it_mess-msgtyp = it_msgtab-msgtyp.
it_mess-lms = l_mstring.
it_mess-msgv1 = it_msgtab-msgv1.
APPEND it_mess.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
LOOP AT it_msgtab.
Rewords some points.
rgds,
P.Naganjana reddy -
How to handle table control in PO change
Hi All,
R/3 is sending PO details and Vendor is using third party front end to access the PO.He has changed the PO and these changes need to be reflected in the PO. Data is coming from external sytem to R/3 through IDOC. I need to handle the changes in the PO at the ITEM level. It has the table control. I don't know about table control. Kindly help me inorder to update the PO for a particular tab in PO item(ME22N).
I have checked the process code : ORDH and FM: MPN30_IDOC_INPUT_ORDCAD
Regards
Kannaiah
Rewards for helpful answersHi Ravikanth,
Thanks for the reply.
I checked the PO item for the fields which need to be updated. I am unable to find some fields in the FM which i had mentioned. Shall I need to use any Userexit or include for this. If yes, can you tell me the user exit for this. I have checked the following exits: AMPL0001
LMEDR001
LMELA002
LMELA010
LMEQR001
LMEXF001
LWSUS001
M06B0001
M06B0002
M06B0003
M06B0004
M06B0005
M06E0004
M06E0005
ME590001
MEETA001
MEFLD004
MELAB001
MEQUERY1
MEVME001
MM06E001
MM06E003
MM06E004
MM06E005
MM06E007
MM06E008
MM06E009
MM06E010
MMAL0001
MMAL0002
MMAL0003
MMDA0001
MMFAB001
MRFLB001 -
How to handle table controls in BDC
Hi All,
Can u please help me out in my BDC program which involves header data and the item data which is to be filled in a Table Control of a particular transaction .If anyone can send me already existing code it would be of great help..
Thanks in Advance
KishoreHi Kishore
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
regards
SAmeer -
How can we handle table control in BDC?
Hi,
How can we handle table control in BDC?
regards
eswarhi,
check this example:
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
ex:
*& Report ZSR_BDC_TBCTRL
REPORT ZSR_BDC_TBCTRL
NO STANDARD PAGE HEADING LINE-SIZE 255.
TABLES : RF02K,LFA1,LFBK.
DATA : BEGIN OF IT_VEN OCCURS 0,
LIFNR LIKE RF02K-LIFNR,
KTOKK LIKE RF02K-KTOKK,
NAME1 LIKE LFA1-NAME1,
SORTL LIKE LFA1-SORTL,
LAND1 LIKE LFA1-LAND1,
SPRAS LIKE LFA1-SPRAS,
BANKS(6) TYPE C,
BANKL(17) TYPE C,
BANKN(19) TYPE C,
END OF IT_VEN.
DATA : BEGIN OF BANKS OCCURS 0,
BANKS LIKE LFBK-BANKS,
END OF BANKS,
BEGIN OF BANKL OCCURS 0,
BANKL LIKE LFBK-BANKL,
END OF BANKL,
BEGIN OF BANKN OCCURS 0,
BANKN LIKE LFBK-BANKN,
END OF BANKN.
DATA : FLD(20) TYPE C,
CNT(2) TYPE N.
DATA : BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
INCLUDE BDCRECX1.
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'Z:\sr.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = IT_VEN
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM OPEN_GROUP.
LOOP AT IT_VEN.
REFRESH BDCDATA.
REFRESH : BANKS,BANKL,BANKN..
SPLIT IT_VEN-BANKS AT ',' INTO TABLE BANKS.
SPLIT IT_VEN-BANKL AT ',' INTO TABLE BANKL.
SPLIT IT_VEN-BANKN AT ',' INTO TABLE BANKN.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0100'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RF02K-KTOKK'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'RF02K-LIFNR'
IT_VEN-LIFNR.
PERFORM BDC_FIELD USING 'RF02K-KTOKK'
IT_VEN-KTOKK.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0110'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-SPRAS'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'LFA1-NAME1'
IT_VEN-NAME1.
PERFORM BDC_FIELD USING 'LFA1-SORTL'
IT_VEN-SORTL.
PERFORM BDC_FIELD USING 'LFA1-LAND1'
IT_VEN-LAND1.
PERFORM BDC_FIELD USING 'LFA1-SPRAS'
IT_VEN-SPRAS.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0120'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-KUNNR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFBK-BANKN(02)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
*perform bdc_field using 'LFBK-BANKS(01)'
'DE'.
*perform bdc_field using 'LFBK-BANKS(02)'
'DE'.
*perform bdc_field using 'LFBK-BANKL(01)'
'10020030'.
*perform bdc_field using 'LFBK-BANKL(02)'
'67270003'.
*perform bdc_field using 'LFBK-BANKN(01)'
'12345'.
*perform bdc_field using 'LFBK-BANKN(02)'
'66666'.
MOVE 1 TO CNT.
LOOP AT BANKS.
CONCATENATE 'LFBK-BANKS(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKS-BANKS.
CNT = CNT + 1.
ENDLOOP.
MOVE 1 TO CNT.
LOOP AT BANKL.
CONCATENATE 'LFBK-BANKL(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKL-BANKL.
CNT = CNT + 1.
ENDLOOP.
MOVE 1 TO CNT.
LOOP AT BANKN.
CONCATENATE 'LFBK-BANKN(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKN-BANKN.
CNT = CNT + 1.
ENDLOOP.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_DYNPRO USING 'SAPLSPO1' '0300'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=YES'.
PERFORM BDC_TRANSACTION USING 'XK01'.
ENDLOOP.
PERFORM CLOSE_GROUP. -
Hi All, Pls send me the recording for va01 by handling table control
Hi All, Pls send me the recording for va01 by handling table control with 3 or more materials. Pls send me a flat file and code ASAP.
Thanks®ards.
BharatHere is a example of similar kind ..plz go through this doc..it will be help hul 4 u
How to deal with table control / step loop in BDC?
Steploop and table contol is inevitable in certain transactions. When we run BDC for such transactions, we will face the situation: how many visible lines of steploop/tablecontrol are on the screen? Although we can always find certain method to deal with it, such as function code 'NP', 'POPO', considering some extreme situation: there is only one line visible one the screen,
our BDC program should display an error message. (See transaction 'ME21', we you resize your screen to let only one row visible, you can not enter mutiple lines on this screen even you use 'NP')
Now, I find a method with which we can determine the number of visible lines on Transaction Screen from our Calling BDC program. Maybe it is useless to you, but I think it will give your some idea.
Demo ABAP code has two purposes:
1. how to determine number of visible lines and how to calculte page number; (the 'calpage' routine has been modify to meet general purpose usage)
2. using field symbol in BDC program, please pay special attention to the difference in Static
ASSIGN and Dynamic ASSIGN.
Now I begin to describe the step to implement my method:
(I use transaction 'ME21', screen 121 for sample, the method using is Call Transation Using..)
Step1: go to screen painter to display the screen 121, then we can count the fixed line on this screen, there is 7 lines above the steploop and 2 lines below the steploop, so there are total 9 fixed lines on this screen. This means except these 9 lines, all the other line is for step loop.
Then have a look at steploop itselp, one entry of it will occupy two lines.
(Be careful, for table control, the head and the bottom scroll bar will possess another two fixed lines, and there is a maximum number for table line)
Now we have : FixedLine = 9
LoopLine = 2(for table control, LoopLine is always equal to 1)
Step2: go to transaction itself(ME21) to see how it roll page, in ME21, the first line of new page is always occupied by the last line of last page, so it begin with index '02', but in some other case, fisrt line is empty and ready for input.
Now we have: FirstLine = 0
or FirstLine = 1 ( in our case, FirstLine is 1 because the first line of new page is fulfilled)
Step3: write a subroutine calcalculating number of pages
(here, the name of actual parameter is the same as formal parameter)
global data: FixedLine type i, " number of fixed line on a certain screen
LoopLine type i, " the number of lines occupied by one steploop item
FirstLine type i, " possbile value 0 or 1, 0 stand for the first line of new
" scrolling screen is empty, otherwise is 1
Dataline type i, " number of items you will use in BDC, using DESCRIBE to get
pageno type i, " you need to scroll screen how many times.
line type i, " number of lines appears on the screen.
index(2) type N, " the screen index for certain item
begin type i, " from parameter of loop
end type i. " to parameter of loop
*in code sample, the DataTable-linindex stands for the table index number of this line
form calpage using FixedLine type i (see step 1)
LoopLine type i (see step 1)
FirstLine type i (see step 2)
DataLine type i ( this is the item number you will enter in transaction)
changing pageno type i (return the number of page, depends on run-time visible line in table control/ Step Loop)
changing line type i.(visible lines one the screen)
data: midd type i,
vline type i, "visible lines
if DataLine eq 0.
Message eXXX.
endif.
vline = ( sy-srows - FixedLine ) div LoopLine.
*for table control, you should compare vline with maximum line of
*table control, then take the small one that is min(vline, maximum)
*here only illustrate step loop
if FirstLine eq 0.
pageno = DataLine div vline.
if pageno eq 0.
pageno = pageno + 1.
endif.
elseif FirstLine eq 1.
pageno = ( DataLine - 1 ) div ( vline - 1 ) + 1.
midd = ( DataLine - 1 ) mod ( vline - 1).
if midd = 0 and DataLine gt 1.
pageno = pageno - 1.
endif.
endif.
line = vline.
endform.
Step4 write a subroutine to calculate the line index for each item.
form calindex using Line type i (visible lines on the screen)
FirstLine type i(see step 2)
LineIndex type i(item index)
changing Index type n. (index on the screen)
if FirstLine = 0.
index = LineIndex mod Line.
if index = '00'.
index = Line.
endif.
elseif FirstLine = 1.
index = LineIndex mod ( Line - 1 ).
if ( index between 1 and 0 ) and LineIndex gt 1.
index = index + Line - 1.
endif.
if Line = 2.
index = index + Line - 1.
endif.
endif.
endform.
Step5 write a subroutine to calculate the loop range.
form calrange using Line type i ( visible lines on the screen)
DataLine type i
FirstLine type i
loopindex like sy-index
changing begin type i
end type i.
If FirstLine = 0.
if loopindex = 1.
begin = 1.
if DataLine <= Line.
end = DataLine.
else.
end = Line.
endif.
elseif loopindex gt 1.
begin = Line * ( loopindex - 1 ) + 1.
end = Line * loopindex.
if end gt DataLine.
end = DataLine.
endif.
endif.
elseif FirstLine = 1.
if loopindex = 1.
begin = 1.
if DataLine <= Line.
end = DataLine.
else.
end = Line.
endif.
elseif loop index gt 1.
begin = ( Line - 1 ) * ( loopindex - 1 ) + 2.
end = ( Line - 1 ) * ( loopindex - 1 ) + Line.
if end gt DataLine.
end = DataLine.
endif.
endif.
endif.
endform.
Step6 using field sysbol in your BDC, for example: in ME21, but you should calculate each item will correponding to which index
form creat_bdc.
field-symbols: <material>, <quan>, <indicator>.
data: name1(14) value 'EKPO-EMATN(XX)',
name2(14) value 'EKPO-MENGE(XX)',
name3(15) value 'RM06E-SELKZ(XX)'.
assign: name1 to <material>,
name2 to <quan>,
name3 to <indicator>.
do pageno times.
if sy-index gt 1
*insert scroll page ok_code"
endif.
perform calrange using Line DataLine FirstLine sy-index
changing begin end.
loop at DataTable from begin to end.
perform calindex using Line FirstLine DataTable-LineIndex changing Index.
name1+11(2) = Index.
name2+11(2) = Index.
name3+12(2) = Index.
perform bdcfield using <material> DataTable-matnr.
perform bdcfield using <quan> DataTable-menge.
perform bdcfield using <indicator> DataTable-indicator.
endloop.
enddo.
Sample code
Following is a sample code of handling table control in BDC.
REPORT Y730_BDC5 .
*HANDLING TABLE CONTROL IN BDC
DATA : BEGIN OF IT_DUMMY OCCURS 0,
DUMMY(100) TYPE C,
END OF IT_DUMMY.
DATA : BEGIN OF IT_XK01 OCCURS 0,
LIFNR(10) TYPE C,
BUKRS(4) TYPE C,
EKORG(4) TYPE C,
KTOKK(4) TYPE C,
NAME1(30) TYPE C,
SORTL(10) TYPE C,
LAND1(3) TYPE C,
SPRAS(2) TYPE C,
AKONT(6) TYPE C,
FDGRV(2) TYPE C,
WAERS(3) TYPE C,
END OF IT_XK01,
BEGIN OF IT_BANK OCCURS 0,
BANKS(3) TYPE C,
BANKL(10) TYPE C,
BANKN(10) TYPE C,
KOINH(30) TYPE C,
LIFNR(10) TYPE C,
END OF IT_BANK.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = 'C:\VENDOR.TXT'
FILETYPE = 'ASC'
TABLES
DATA_TAB = IT_DUMMY.
LOOP AT IT_DUMMY.
IF IT_DUMMY-DUMMY+0(2) = '11'.
IT_XK01-LIFNR = IT_DUMMY-DUMMY+2(10).
IT_XK01-BUKRS = IT_DUMMY-DUMMY+12(4).
IT_XK01-EKORG = IT_DUMMY-DUMMY+16(4).
IT_XK01-KTOKK = IT_DUMMY-DUMMY+20(4).
IT_XK01-NAME1 = IT_DUMMY-DUMMY+24(30).
IT_XK01-SORTL = IT_DUMMY-DUMMY+54(10).
IT_XK01-LAND1 = IT_DUMMY-DUMMY+64(3).
IT_XK01-SPRAS = IT_DUMMY-DUMMY+67(2).
IT_XK01-AKONT = IT_DUMMY-DUMMY+69(6).
IT_XK01-FDGRV = IT_DUMMY-DUMMY+75(2).
IT_XK01-WAERS = IT_DUMMY-DUMMY+77(3).
APPEND IT_XK01.
ELSE.
IT_BANK-BANKS = IT_DUMMY-DUMMY+2(3).
IT_BANK-BANKL = IT_DUMMY-DUMMY+5(10).
IT_BANK-BANKN = IT_DUMMY-DUMMY+15(10).
IT_BANK-KOINH = IT_DUMMY-DUMMY+25(30).
IT_BANK-LIFNR = IT_DUMMY-DUMMY+55(10).
APPEND IT_BANK.
ENDIF.
ENDLOOP.
LOOP AT IT_XK01.
REFRESH IT_BDCDATA.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-REF_LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
IT_XK01-LIFNR.
perform bdc_field using 'RF02K-BUKRS'
IT_XK01-BUKRS.
perform bdc_field using 'RF02K-EKORG'
IT_XK01-EKORG.
perform bdc_field using 'RF02K-KTOKK'
IT_XK01-KTOKK.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-TELX1'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-NAME1'
IT_XK01-NAME1.
perform bdc_field using 'LFA1-SORTL'
IT_XK01-SORTL.
perform bdc_field using 'LFA1-LAND1'
IT_XK01-LAND1.
perform bdc_field using 'LFA1-SPRAS'
IT_XK01-SPRAS.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-KOINH(02)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
DATA : FNAM(20) TYPE C,
IDX TYPE C.
MOVE 1 TO IDX.
LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.
CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKS.
CONCATENATE 'LFBK-BANKL(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKL.
CONCATENATE 'LFBK-BANKN(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKN.
CONCATENATE 'LFBK-KOINH(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-KOINH.
IDX = IDX + 1.
ENDLOOP.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-FDGRV'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-AKONT'
IT_XK01-AKONT.
perform bdc_field using 'LFB1-FDGRV'
IT_XK01-FDGRV.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0220'.
perform bdc_field using 'BDC_CURSOR'
'LFB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFM1-WAERS'
IT_XK01-WAERS.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'WYT3-PARVW(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
CALL TRANSACTION 'XK01' USING IT_BDCDATA
MODE 'A'
UPDATE 'S'
MESSAGES INTO IT_BDCMSGCOLL.
ENDLOOP.
FORM BDC_DYNPRO USING PROG SCR.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROG.
IT_BDCDATA-DYNPRO = SCR.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDFORM.
Reward if helpful -
How can we handle table control parameter in lsmw
hi guru,
please tell me how can we handle table control parameter in lsmw.
thanks & regards
subhasis.Hi,
we create table control program (module pool) this program use in LSMW,
we mention the transaction code ,write ur table control program name.
This is use full for u
Reguards,
lakshmi -
hi experts,
I have used table controls using wizard.is that correct .and when i am using that i cannot set filters.all the records in tha table are displayed.how to use filters here ?
what about the ordinary table controls how to create it .pls send some links and tips for it...
thanks
manicheck..
DEMO_DYNPRO_TABLE_CONTROL_1
DEMO_DYNPRO_TABLE_CONTROL_2
even check below code...
BDC Example: Using Table Control in BDC
Among beginners, using table control in BDC is always a puzzle.
Following is a sample code of handling table control in BDC.
REPORT Y730_BDC5 .
*HANDLING TABLE CONTROL IN BDC
DATA : BEGIN OF IT_DUMMY OCCURS 0,
DUMMY(100) TYPE C,
END OF IT_DUMMY.
DATA : BEGIN OF IT_XK01 OCCURS 0,
LIFNR(10) TYPE C,
BUKRS(4) TYPE C,
EKORG(4) TYPE C,
KTOKK(4) TYPE C,
NAME1(30) TYPE C,
SORTL(10) TYPE C,
LAND1(3) TYPE C,
SPRAS(2) TYPE C,
AKONT(6) TYPE C,
FDGRV(2) TYPE C,
WAERS(3) TYPE C,
END OF IT_XK01,
BEGIN OF IT_BANK OCCURS 0,
BANKS(3) TYPE C,
BANKL(10) TYPE C,
BANKN(10) TYPE C,
KOINH(30) TYPE C,
LIFNR(10) TYPE C,
END OF IT_BANK.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = 'C:\VENDOR.TXT'
FILETYPE = 'ASC'
TABLES
DATA_TAB = IT_DUMMY.
LOOP AT IT_DUMMY.
IF IT_DUMMY-DUMMY+0(2) = '11'.
IT_XK01-LIFNR = IT_DUMMY-DUMMY+2(10).
IT_XK01-BUKRS = IT_DUMMY-DUMMY+12(4).
IT_XK01-EKORG = IT_DUMMY-DUMMY+16(4).
IT_XK01-KTOKK = IT_DUMMY-DUMMY+20(4).
IT_XK01-NAME1 = IT_DUMMY-DUMMY+24(30).
IT_XK01-SORTL = IT_DUMMY-DUMMY+54(10).
IT_XK01-LAND1 = IT_DUMMY-DUMMY+64(3).
IT_XK01-SPRAS = IT_DUMMY-DUMMY+67(2).
IT_XK01-AKONT = IT_DUMMY-DUMMY+69(6).
IT_XK01-FDGRV = IT_DUMMY-DUMMY+75(2).
IT_XK01-WAERS = IT_DUMMY-DUMMY+77(3).
APPEND IT_XK01.
ELSE.
IT_BANK-BANKS = IT_DUMMY-DUMMY+2(3).
IT_BANK-BANKL = IT_DUMMY-DUMMY+5(10).
IT_BANK-BANKN = IT_DUMMY-DUMMY+15(10).
IT_BANK-KOINH = IT_DUMMY-DUMMY+25(30).
IT_BANK-LIFNR = IT_DUMMY-DUMMY+55(10).
APPEND IT_BANK.
ENDIF.
ENDLOOP.
LOOP AT IT_XK01.
REFRESH IT_BDCDATA.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-REF_LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
IT_XK01-LIFNR.
perform bdc_field using 'RF02K-BUKRS'
IT_XK01-BUKRS.
perform bdc_field using 'RF02K-EKORG'
IT_XK01-EKORG.
perform bdc_field using 'RF02K-KTOKK'
IT_XK01-KTOKK.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-TELX1'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-NAME1'
IT_XK01-NAME1.
perform bdc_field using 'LFA1-SORTL'
IT_XK01-SORTL.
perform bdc_field using 'LFA1-LAND1'
IT_XK01-LAND1.
perform bdc_field using 'LFA1-SPRAS'
IT_XK01-SPRAS.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-KOINH(02)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
DATA : FNAM(20) TYPE C,
IDX TYPE C.
MOVE 1 TO IDX.
LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.
CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKS.
CONCATENATE 'LFBK-BANKL(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKL.
CONCATENATE 'LFBK-BANKN(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKN.
CONCATENATE 'LFBK-KOINH(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-KOINH.
IDX = IDX + 1.
ENDLOOP.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-FDGRV'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-AKONT'
IT_XK01-AKONT.
perform bdc_field using 'LFB1-FDGRV'
IT_XK01-FDGRV.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0220'.
perform bdc_field using 'BDC_CURSOR'
'LFB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFM1-WAERS'
IT_XK01-WAERS.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'WYT3-PARVW(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
CALL TRANSACTION 'XK01' USING IT_BDCDATA
MODE 'A'
UPDATE 'S'
MESSAGES INTO IT_BDCMSGCOLL.
ENDLOOP.
FORM BDC_DYNPRO USING PROG SCR.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROG.
IT_BDCDATA-DYNPRO = SCR.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDFORM.
Maybe you are looking for
-
Sharepoint 2013 Open document in client application
Hi, I have a sharepoint 2013 server which has word documents stored in a document library. I am able to open the documents when i click the url from sharepoint site. I have been trying to open those word documents from an angular js application using
-
Pairing problems between my new nokia n82 and blue...
I tried pairing up my n82 and bh-208 last night, but couldn't get it to work. The n82 recognised other bluetooth devices. My bluetooth was definitely working, as I had used it earlier with another mobile fone. I've followed all the instructions and p
-
Row of pixels out on my Samsung 46" LCD
Vertical row is out , is this fix-able or covered by the extended warranty? I just purchased about a year ago so sucks to have to get another one before the warranty expired.
-
Connection pooling issue with compiling with jdk 1.5.0
A javax.naming.NameNotFoundException: Name jdbc is not bound in this Context exception occurs when I run my web app in Tomcat 5 using jdk 1.5. However, I don't get this problem with I use jdk 1.6.0. The mysql connector version is 3.1.1.4 and my serve
-
Difficult to filtrate the user Dimension table
I have dimension table, named user, and fact table. I want to filtrate that right user can review right value from the fact table based on user's windows authenication. You use the WA to filtrate the dimension table. I have used the syntax code "{STR