on 2006 Nov 06 9:32 AM
Hi,
I need help with my BDC program.
This is for transaction VF01 - automatically create a credit note.
There are only 2 fields that i will use, billing type and document number. As for billing type, i want to make sure its always constant at YG2 and for document number, i will extract from a vbrk-vbeln.
There is no file uploading involved.
I am having touble with both fields.
Can anyone help with the coding?
Thanks in advance.
hi.. yes, the batch is created in SM35.
there is a problem with this part of the code:
PERFORM bdc_field USING 'KOMFK-VBELN' "SD document number
it_display-vbeln.
the value from it_display-vbeln does not update komfk-vbeln. there is a value in it_display-vbeln.
Message was edited by: Charlene Tan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Charlene...is u again..hehe
your coding:
perform bdc_field using 'KOMFK-VBELN(01)'
it_display-vbeln.
I think your internal table values it_display-vbeln is overwriting the values in 'KOMFK-VBELN(01)'. When the coding is 'KOMFK-VBELN(01)', it means KOMFK-VBELN is always pointing on line item no 1. If you wish to pass your value to line item no 2, please use a counter and assign it to KOMFK-VBELN.
Thanks alot for helping me & tolerating with me Eswar!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Charlene,
I think your internal table is without header line.
DATA: BEGIN OF it_display OCCURS 0,
fkart LIKE RV60A-FKART,
vbeln LIKE vbrk-vbeln,
END OF it_display.
when you loop your internal table, put the value into a working area.
for example:
declare your working area like below:
Data: wa_display like it_display.
LOOP at it_display into wa_display.
...
...
...
ENDloop.
Hi..thanks for the help.
The BDC runs through smoothly but the values in the fields RV60A-FKART and KOMFK-VBELN are not being updated, hence, the record is not created.
I am really puzzled at this point.
please help. thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
*----
DATA: BEGIN OF it_display OCCURS 0,
fkart LIKE RV60A-FKART,
vbeln LIKE vbrk-vbeln,
END OF it_display.
*----
*----
IF VBRK-VKORG EQ '9083' AND ( VBRK-KONDA EQ 'Y1' OR VBRK-KONDA EQ 'Y2' ) . "sales org and price group must fit criteria
PERFORM get_data.
PERFORM bdc_posting.
message S003(z000).
ELSE.
message S004(z000).
ENDIF.
*----
*----
FORM bdc_posting.
LOOP AT it_display.
PERFORM bdc_open.
BDCDATA-PROGRAM = 'SAPMV60A'.
BDCDATA-DYNPRO = '0102'.
BDCDATA-DYNBEGIN = 'X'.
BDCDATA-FNAM = 'BDC_CURSOR'.
BDCDATA-FVAL = 'KOMFK-VBELN'.
BDCDATA-FNAM = 'BDC_OKCODE'.
BDCDATA-FVAL = '/00'.
BDCDATA-FNAM = 'RV60A-FKART'. "billing type
BDCDATA-FVAL = 'YG2'.
BDCDATA-FNAM = 'KOMFK-VBELN'. "SD document number
BDCDATA-FVAL = it_display-vbeln.
BDCDATA-PROGRAM = 'SAPMV60A'.
BDCDATA-DYNPRO = '0103'.
BDCDATA-DYNBEGIN = 'X'.
BDCDATA-FNAM = 'BDC_CURSOR'.
BDCDATA-FVAL = '*TVFKT-VTEXT(01)'.
BDCDATA-FNAM = 'BDC_OKCODE'.
BDCDATA-FVAL = '=SICH'.
PERFORM bdc_transaction1 USING 'ZVF01'.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
ENDLOOP.
ENDFORM.
*----
*----
FORM get_data.
MOVE: vbrk-vbeln TO it_display-vbeln.
APPEND it_display.
ENDFORM. "get_data
FORM bdc_open .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = 'M__MATGRLOAD'
user = SY-UNAME
keep = 'X'.
ENDFORM. " bdc_open
FORM bdc_transaction1 USING tcode.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'ZVF01'
TABLES
dynprotab = bdcdata.
ENDFORM. " bdc_transaction1
*----
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Charlene
Please check after making below highlighted changes.
**---------------------------------------------------------------**
DATA: BEGIN OF it_display OCCURS 0,
fkart LIKE RV60A-FKART,
vbeln LIKE vbrk-vbeln,
END OF it_display.
**---------------------------------------------------------------**
**---------------------------------------------------------------**
IF VBRK-VKORG EQ '9083' AND ( VBRK-KONDA EQ 'Y1' OR VBRK-KONDA EQ 'Y2' ) . "sales org and price group must fit criteria
PERFORM get_data.
PERFORM bdc_posting.
message S003(z000).
ELSE.
message S004(z000).
ENDIF.
**---------------------------------------------------------------**
**---------------------------------------------------------------**
FORM bdc_posting.
LOOP AT it_display.
PERFORM bdc_open.
<b>* BDCDATA-PROGRAM = 'SAPMV60A'.
* BDCDATA-DYNPRO = '0102'.
* BDCDATA-DYNBEGIN = 'X'.
* BDCDATA-FNAM = 'BDC_CURSOR'.
* BDCDATA-FVAL = 'KOMFK-VBELN'.
* BDCDATA-FNAM = 'BDC_OKCODE'.
* BDCDATA-FVAL = '/00'.
* BDCDATA-FNAM = 'RV60A-FKART'. "billing type
* BDCDATA-FVAL = 'YG2'.
* BDCDATA-FNAM = 'KOMFK-VBELN'. "SD document number
* BDCDATA-FVAL = it_display-vbeln.
*
* BDCDATA-PROGRAM = 'SAPMV60A'.
* BDCDATA-DYNPRO = '0103'.
* BDCDATA-DYNBEGIN = 'X'.
* BDCDATA-FNAM = 'BDC_CURSOR'.
* BDCDATA-FVAL = '*TVFKT-VTEXT(01)'.
* BDCDATA-FNAM = 'BDC_OKCODE'.
* BDCDATA-FVAL = '=SICH'.
perform bdc_dynpro using 'SAPMV60A' '0102'.
perform bdc_field using 'BDC_CURSOR'
'KOMFK-VBELN(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RV60A-FKART'
'YG2'.
perform bdc_field using 'KOMFK-VBELN(01)'
it_display-vbeln.
perform bdc_dynpro using 'SAPMV60A' '0104'.
perform bdc_field using 'BDC_CURSOR'
'VBRK-FKART'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.</b>
PERFORM bdc_transaction1 USING 'ZVF01'.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
ENDLOOP.
ENDFORM.
**---------------------------------------------------------------**
**---------------------------------------------------------------**
FORM get_data.
MOVE: vbrk-vbeln TO it_display-vbeln.
APPEND it_display.
ENDFORM. "get_data
FORM bdc_open .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = 'M__MATGRLOAD'
user = SY-UNAME
keep = 'X'.
ENDFORM. " bdc_open
FORM bdc_transaction1 USING tcode.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = <b>tcode "'ZVF01'</b>
TABLES
dynprotab = bdcdata.
ENDFORM. " bdc_transaction1
<b>FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> SPACE.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.</b>
Also note that as you are using normal process, you can directly use normal transaction VF01.
Kind Regards
Eswar
Thanks! I managed to get past CALL FUNCTION 'BDC_OPEN_GROUP'.
However im stuck with this now BDC_INSERT now...error:
BDC_INSERT, screen .&. is invalid
What do i do when i hit error with CALL FUNCTION 'BDC_CLOSE_GROUP' as well?
Help much appreciated. Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
pass sy-uname and user name shouls be maintained in
user master table USR01
CALL FUNCTION 'BDC_OPEN_GROUP' " Not needed for Call Transaction
EXPORTING " Used to handle Errors.
GROUP = 'M__MATGRLOAD'
USER = SY-UNAME
KEEP = 'X'.
Regards
amole
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for all the answers.
Okay...i created the BDC as suggested...
when i put in the function 'BDC_OPEN_GROUP' i hit this error
BDC_OPEN_GROUP, user .. is invalid
I cant move past this point.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
perform bdc_dynpro using 'SAPMV60A' '0102'.
perform bdc_field using 'BDC_CURSOR'
'RV60A-FKART'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
<b>perform bdc_field using 'RV60A-FKART'
'YGT'.</b>
perform bdc_dynpro using 'SAPMV60A' '0102'.
perform bdc_field using 'BDC_CURSOR'
'KOMFK-VBELN(01)'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
<b>perform bdc_field using 'RV60A-FKART'
'YGT'.</b>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hAI
use the following code for BDC .
perform bdc_dynpro using 'SAPMV60A' '0102'.
perform bdc_field using 'BDC_CURSOR'
'KOMFK-VBELN(01)'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
perform bdc_field using 'RV60A-FKART'
'YG2'.
perform bdc_field using 'KOMFK-VBELN(01)'
<DOCUMNET NUMBER>'343434343'.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Charlene
As the billing document type doesnt have Paramter-ID, you can try this way:
Create a ZVF01 transaction with the following steps:
1. SE93
2. Transction Name: ZVF01.
3. Select the type as Parameter Transaction
4. In the next screen, give transaction name as VF01.
5. Scroll down to last for default values: give field as "RV60A-FKART" and value as 'YG2'.
6. Save. Now try executing the same to check that YG2 is fixex in your screen.
7. Now in your BDC, call ZVF01 with document number.
The billing type will be YG2 irrespective of online or background execution of ZVF01.
This should help solve your case.
Kind Regards
Eswar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
do recording in shdb on VF01 by inputing
billing type and document no.
for test purpose pick up document no from vbrk field
with billing type = 'YG2' and do recording
Regards
Amole
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
While recording itself ,
do the recording with YG2 value in ur screen .
in the program
just
SAPMV60A 0102 X
BDC_CURSOR RV60A-FKART
BDC_OKCODE /00
RV60A-FKART 'YGT'
maintain this in ur program
regards,
VIjay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
104 | |
10 | |
8 | |
7 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.