2010 Jan 18 10:58 AM
Hi all,
I have written a BDC program for a ztcode in that i am enetring values on screen fields and on click of save button it will save data to ztable.
Following is my recording:
PERFORM BDC_DYNPRO USING 'ZCUST_MPOOL_BDC' '0100'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=SAVE'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'ZCUSTOMER-ZAGE'.
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZCUSTID'
WA_CUST-ZCUSTID.
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZFNAME'
WA_CUST-ZFNAME.
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZLNAME'
WA_CUST-ZLNAME.
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZADDR'
WA_CUST-ZADDR.
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZMOBILE'
WA_CUST-ZMOBILE.
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZSEX'
WA_CUST-ZSEX.
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZAGE'
WA_CUST-ZAGE.
the session is created sucessfully but i run session through SM35,i wont take all values from my text file.
It will not take ZCUSTID (Primary key of type INT1)and ZAGE(type INT1) and in the log it will dispaly the following error:
Field ZCUSTOMER-ZCUSTID. input value is longer than screen field
Field ZCUSTOMER-ZAGE. input value is longer than screen field
and record is saved in ztable with these two fiedls as blanks.
Thanks and Regards,
Arpita
2010 Jan 18 11:14 AM
Hi Arpita,
the value might be moving to extreme right as fval is char132,
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZCUSTID'
WA_CUST-ZCUSTID. check it in debugging mode the value for fval at 132 position the value is displayed .
delete the leading spaces, just as done below.
so if you are writing perform in ur report change the form
as
FORM bdc_field USING fnam fval.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = fnam.
wa_bdcdata-fval = fval.
SHIFT wa_bdcdata-fval LEFT DELETING LEADING space. " this statement will do the rest.
APPEND wa_bdcdata TO bdcdata.
ENDFORM. "BDC_FIELD
Regards,
Aby
2010 Jan 18 11:04 AM
Hi,
Check the domain, and screen field lenths.
there might be miss match in display lenth and actual(visible) lenth.
2010 Jan 18 11:06 AM
Hi Arpita,
Use WRITE .. TO Statement instead of = while moving the data for BDC..
This should solve your issue..
Nag
2010 Jan 18 11:08 AM
Hi,
Check weather the workarea WA_CUST is of type ZCUSTOMER. That error comes when the incoming field and the structure field are different.
ZCUSTOMER-ZCUSTID & WA_CUST-ZCUSTID
ZCUSTOMER-ZAGE & WA_CUST-ZAGE
Should have same datatype.
Regards
Bala Krishna
2010 Jan 18 11:14 AM
Hi Arpita,
the value might be moving to extreme right as fval is char132,
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZCUSTID'
WA_CUST-ZCUSTID. check it in debugging mode the value for fval at 132 position the value is displayed .
delete the leading spaces, just as done below.
so if you are writing perform in ur report change the form
as
FORM bdc_field USING fnam fval.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = fnam.
wa_bdcdata-fval = fval.
SHIFT wa_bdcdata-fval LEFT DELETING LEADING space. " this statement will do the rest.
APPEND wa_bdcdata TO bdcdata.
ENDFORM. "BDC_FIELD
Regards,
Aby
2010 Jan 18 11:32 AM
Hi Abhi,
Thanks for replay.
My issue is solved. it is taking values properly now.
But the problem now is there are 5 records in my text file but it wont take all record one by one.
It will ask me "Do you still want to keep the batch input data?" and after pressing no it will take next record.
I wnat that all record should be taken one by one.
Thanks and Regards,
Arpita
2015 Apr 13 1:51 PM
Hi Arpita,
One thing i would like to tell always use the string variable when you passed the data to BDC fields and Condense the string variable.
Thanks
Nishant
2021 Jan 17 9:37 AM
Hi Arpita,
Need help your help if you find answer for below, could you please share here how you proceed ?
"But the problem now is there are 5 records in my text file but it wont take all record one by one.
It will ask me "Do you still want to keep the batch input data?" and after pressing no it will take next record.
I wnat that all record should be taken one by one"
As I also want to perform same thing in my requirement .
Thank you in advance!
BR,Swati
2010 Jan 18 11:30 AM
Hi,
Try this...
First Declare two variable of type CHAR with the same length of ur field which showing blank.
Now assign Values to this Variable
like w1 = wa- ,
w2 = wa- ,
and then pass theses variable in BDC Field .
like instead of passing wa-
pass w1 in bdc field
I am sure it will work.
2010 Jan 18 11:33 AM
Hi,
Try this.
PERFORM BDC_DYNPRO USING 'ZCUST_MPOOL_BDC' '0100'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=SAVE'.
condense ZCUSTOMER-ZAGE.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'ZCUSTOMER-ZAGE'.
condense WA_CUST-ZCUSTID.
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZCUSTID'
WA_CUST-ZCUSTID.
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZFNAME'
WA_CUST-ZFNAME.
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZLNAME'
WA_CUST-ZLNAME.
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZADDR'
WA_CUST-ZADDR.
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZMOBILE'
WA_CUST-ZMOBILE.
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZSEX'
WA_CUST-ZSEX.
PERFORM BDC_FIELD USING 'ZCUSTOMER-ZAGE'
WA_CUST-ZAGE.
if it doesnt work then let me know data elemnt of zagw & ZCUSTID.
Rgds
Siva
2015 Apr 13 12:27 PM
Hi everybody,
Try this one.You will get succeed.
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR wa_BDCDATA.
wa_BDCDATA-PROGRAM = PROGRAM.
wa_BDCDATA-DYNPRO = DYNPRO.
wa_BDCDATA-DYNBEGIN = 'X'.
APPEND wa_BDCDATA to it_bdcdata.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
* IF FVAL <> NODATA.
CLEAR wa_BDCDATA.
wa_BDCDATA-FNAM = FNAM.
wa_BDCDATA-FVAL = FVAL.
SHIFT wa_bdcdata-fval LEFT DELETING LEADING space.
APPEND wa_BDCDATA to it_bdcdata.
* ENDIF.
ENDFORM.