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

Former Member
0 Likes
746

Hi all,

I have a quick question w.r.t a program for BDC Table control. I have written a dialog program containing one screen based on all the fields from the table SBOOK. Whatever the data entered into those fields will be inserted into the database table.

Now i would like to write a BDC program for the above transaction.

While creating an internal table structure, I have browsed the Data elements of table SBOOK. I found a field FLDATE with length 8. Shall i declare it an 8 or 10 ????

Now my question is, whether i should declare the length of the fields in internal table same as that of Database table or else i can declare my custom lengths.

Thanks.

Shiv

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
729

For BDC use external format and width, e;g. for date use 10.

(Also look for thread like to manage line number)

Regards

6 REPLIES 6
Read only

RaymondGiuseppi
Active Contributor
0 Likes
730

For BDC use external format and width, e;g. for date use 10.

(Also look for thread like to manage line number)

Regards

Read only

0 Likes
729

HI I AM PUTTING MY CODE OVER HERE.

 
report ZVKBDCTRANSACTION
       no standard page heading line-size 255.

DATA : BEGIN OF IT_DUMMY OCCURS 0,
	DUMMY(100) TYPE C,
	END OF IT_DUMMY.

DATA : BEGIN OF ITAB OCCURS 0,
CARRID(3) TYPE C,
CONNID(4) TYPE C,
FLDATE(11) TYPE C,
PRICE(15) TYPE C,
PLANETYPE(10) TYPE C,
END OF ITAB.

DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

 CALL FUNCTION 'WS_UPLOAD'
   EXPORTING
     FILENAME                      = 'C:\USERS\VAMC\DOCUMENTS\FLINFO1.TXT'
    TABLES
     data_tab                      = IT_DUMMY
            .
 IF sy-subrc <> 0.
WRITE 'ERROR'.
 ENDIF.

LOOP AT IT_DUMMY.
ITAB-CARRID = IT_DUMMY-DUMMY+0(3).
ITAB-CONNID = IT_DUMMY-DUMMY+3(4).
ITAB-FLDATE = IT_DUMMY-DUMMY+7(11).
ITAB-PRICE = IT_DUMMY-DUMMY+18(15).
ITAB-PLANETYPE = IT_DUMMY-DUMMY+33(10).
APPEND ITAB.
ENDLOOP.

*LOOP AT ITAB.
*WRITE: ITAB-CARRID, ITAB-CONNID, ITAB-FLDATE, ITAB-PRICE, ITAB-PLANETYPE.
*ENDLOOP.




include bdcrecx1.

start-of-selection.

LOOP AT ITAB.

perform open_group.

perform bdc_dynpro      using 'SAPMZ_TPSCREEN02' '1000'.
perform bdc_field       using 'BDC_OKCODE'
                              '=SAVE'.
perform bdc_field       using 'BDC_CURSOR'
                              'SFLIGHT-PLANETYPE'.
perform bdc_field       using 'SFLIGHT-CARRID'
                              'AA'.
perform bdc_field       using 'SFLIGHT-CONNID'
                              '17'.
perform bdc_field       using 'SFLIGHT-FLDATE'
                              '12/02/2009'.
perform bdc_field       using 'SFLIGHT-PRICE'
                              '3355'.
perform bdc_field       using 'SFLIGHT-PLANETYPE'
                              '737-200SF'.
perform bdc_dynpro      using 'SAPMZ_TPSCREEN02' '1000'.
perform bdc_field       using 'BDC_OKCODE'
                              '=BACK'.
perform bdc_field       using 'BDC_CURSOR'
                              'SFLIGHT-CARRID'.
perform bdc_field       using 'SFLIGHT-CARRID'
                              'AA'.
perform bdc_field       using 'SFLIGHT-CONNID'
                              '17'.
perform bdc_field       using 'SFLIGHT-FLDATE'
                              '12/02/2009'.
perform bdc_field       using 'SFLIGHT-PRICE'
                              '3.355,00'.
perform bdc_field       using 'SFLIGHT-PLANETYPE'
                              '737-200SF'.
perform bdc_transaction using 'Z_TPSCREEN02'.

perform close_group.

ENDLOOP.

My Flat file Contains 3 records.

AA 0017 10/11/2006 6655 737-200

LH 0400 11/12/2005 3322 737-200SF

AA 0017 10/11/2004 4433 737-200

After Executing this code

It generated all return codes 0.

I don't know what a return code 0 means.

I went to SM35 and processed my session in the background.

To my surprise, I didn't find my session in any tabs, Its missing.

Do you have any idea what has happened exactly.

Thanks for your time.

Shiv

Read only

0 Likes
729

Well if you did process this report in background, you will probably find a short dump in ST22 for it, since you are using WS_UPLOAD. WS stands for WorkStation. However, if you are processing in background, you can't upload a file from your local workstation, since the program will be running on application server.

If you want to upload a file in background, you will have to upload it from application server. Put file on application server using transaction cg3z. If record size is too long, find someone from basis to put file on application server, or write a report yourself to do this.

Return code sy-subrc = 0, means that 'everything' is OK.

sy-subrc = 4, normally states that there is an error, however when transporting development objects from A to B, sy-subrc = 4, is still ok, but some warnings.

Every return code > 4, is (mayor) error.

Edited by: Micky Oestreich on Apr 13, 2008 10:12 PM

Read only

0 Likes
729

hi Shiva,

You have check the 'KEEP SESSSION' in your selection screen to keep your session in SM35 after processing else by default deletes the session after processing.

So rerun the transaction with checking the checkbox.

Hope this helps you.

Thanks,

Arun

Read only

0 Likes
729

Thanks Arun,

I am able see my session in Processed Tab. Thanks.

Read only

Former Member
0 Likes
729

Hi Shivaram..

You Can specify field lengths as per the database table..

Hope its Help full...

Regards,

Rahul