‎2007 Apr 29 1:08 PM
Hi Friends,
I have a problem in BDC while uploading the data the i have problem.The data from internal table is not getting proprely aligned up with screens.
I am not able to see the data that is avaliable in the internal table into the screens,I am not able to find out the problem? can you help out?
I have sent below the code for your refernce.
<b>Coding:</b>
report YBDCRECORDING no standard page heading line-size 255.
include bdcrecx1.
parameters: dataset(132) lower case.
DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
*
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
*
Generated data section with specific formatting - DO NOT CHANGE ***
data: begin of record,
data element: MATNR
MATNR_001(018),
data element: MBRSH
MBRSH_002(001),
data element: MTART
MTART_003(004),
data element: XFELD
KZSEL_01_004(001),
data element: MAKTX
MAKTX_005(040),
data element: MEINS
MEINS_006(003),
end of record.
data: BEGIN OF UPLD_ITAB OCCURS 0,
matnr like RMMG1-MATNR,
mbrsh like RMMG1-MBRSH,
mtart like RMMG1-MTART,
maktx like MAKT-MAKTX,
meins like MARA-MEINS,
END OF UPLD_ITAB.
DATA: i_file like rlgrap-filename value 'C:\upld.txt'.
data: v_file type string.
End generated data section ***
start-of-selection.
v_file = i_file.
clear: upld_itab.
refresh: upld_itab.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = v_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = upld_itab
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 NE 0.
write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
skip.
endif.
*perform open_dataset using dataset.
perform open_group.
clear: upld_itab.
loop at upld_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' UPLD_ITAB-MATNR.
perform bdc_field using 'RMMG1-MBRSH' UPLD_ITAB-MBRSH.
perform bdc_field using 'RMMG1-MTART' UPLD_ITAB-MTART.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE' '=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
record-KZSEL_01_004.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_field using 'MAKT-MAKTX' UPLD_ITAB-MAKTX.
perform bdc_field using 'BDC_CURSOR' 'MARA-MEINS'.
perform bdc_field using 'MARA-MEINS' UPLD_ITAB-MEINS.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE' '=YES'.
perform bdc_transaction using 'MM01'.
endloop.
perform close_group.
Regards,
Dinesh
‎2007 Apr 30 5:55 AM
hi,
first do this one using Recording(SHDB),there you will get the screen numbers and screen fields automatically. Compare with your pg and if necessary modify relevant data.
Process for recording:
got to SHDB->select new recording ->give name for recording->give tcode MM01->
give manditory fields->save->f3->selelect recording->select program->check transfer from recording->enter->specify attributes->save->control leads to SE38.there you can check screen numbers and fields.
compare this with ur program or else you can continue with this pg also.
‎2007 Apr 30 6:27 AM
Hi Dinesh babu,
First comment the these fields.
data: begin of record,
data element: MATNR
MATNR_001(018),
data element: MBRSH
MBRSH_002(001),
data element: MTART
MTART_003(004),
data element: XFELD
KZSEL_01_004(001),
data element: MAKTX
MAKTX_005(040),
data element: MEINS
MEINS_006(003),
end of record.
Because u created ur own internal table u should comment the sap provided internal table and replace that into ur internal table name.
******Rewards some points.
Rgds,
P.Naganjana Reddy
‎2007 Apr 30 8:28 AM
hi
good
do a demo recording wiht the same tcode and save that screen steps in a note pad and check with the already existing screen steps in your BDC program witht he new screen shots,
there must be problem with your screen sequence and that is the reason it is not taking the proper value from the internal table,
thanks
mrutyun^