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

Former Member
0 Likes
416

Hi Gurus!

i am writing BDC for Creating sales order.while creating order a small selection list for Stock Partner appears.but while recording in BDC that selection list doesnt appear.

Plz help me out.

Rahul

2 REPLIES 2
Read only

Former Member
0 Likes
355

Why not using a BAPI?

BAPI_SALESORDER_CREATEFROMDAT1

BAPI_SALESORDER_CREATEFROMDAT2

BAPI_SALESORDER_CREATEFROMDATA

Batch input screens do behave differently in background. This is the reason why the extra screen does not pop up.

Read only

0 Likes
355

HI Kris !

Actually i want to create a rfc for creating sales order. i have created it using bdc and it was running ok also . but now its having prob bcoz of selection screen for Stock partner.

i try before it using bapi functions but it is asking so many parameters.

i want to pass this fields

SDTYPE

SDORG

DIST CHANNEL

DIVISION

SALES OFFICE

SOLD TO PARTY

SHIP TO PARTY

PO NO

PO DATE

DELIVERY DATE

PRICE DATE

INCOTERMS

INCOTERMS1

MATNO

UNIT

PLANT

HERE is my RFC code

data: bdcdata like bdcdata occurs 0 with header line.

FUNCTION ZCREATE_ORDER05.

*"----


""Local interface:

*" IMPORTING

*" VALUE(SDTYPE) LIKE VBAK-AUART OPTIONAL

*" VALUE(SDORG) LIKE VBAK-VKORG OPTIONAL

*" VALUE(DISTCHANNEL) LIKE VBAK-VTWEG OPTIONAL

*" VALUE(DIVISION) LIKE VBAK-SPART OPTIONAL

*" VALUE(SALESOFF) LIKE VBAK-VKBUR OPTIONAL

*" VALUE(PO_NO) LIKE VBKD-BSTKD OPTIONAL

*" VALUE(PO_DATE) LIKE VBKD-BSTDK OPTIONAL

*" VALUE(SOLDTOPARTY) LIKE VBAK-KUNNR OPTIONAL

*" VALUE(SHPTOPARTY) LIKE KUWEV-KUNNR OPTIONAL

*" VALUE(PAYTERM) LIKE VBKD-ZTERM OPTIONAL

*" VALUE(INCOTERMS) LIKE VBKD-INCO1 OPTIONAL

*" VALUE(INCOTERMS1) LIKE VBKD-INCO2 OPTIONAL

*" VALUE(DELDATE) LIKE RV45A-KETDAT OPTIONAL

*" VALUE(PRICEDATE) LIKE RV45A-KETDAT OPTIONAL

*" VALUE(PLANT) LIKE VBAP-WERKS OPTIONAL

*" VALUE(SLOC) LIKE VBAP-LGORT OPTIONAL

*" EXPORTING

*" VALUE(ORDERNO) LIKE VBAK-VBELN

*" VALUE(MSG) LIKE BDCMSGCOLL-MSGV1

*" VALUE(ERRORMSG) LIKE BDCMSGCOLL-MSGV1

*" TABLES

*" ITEM STRUCTURE ZITEM OPTIONAL

*"----


DATA : FNAM(20) TYPE C,

I TYPE C.

data : options type CTU_PARAMS.

*****************BDCDATA STRUCTURE**********************

*data: bdcdata like bdcdata occurs 0 with header line.

data : begin of it_item occurs 0.

include structure zitem.

data : end of it_item.

*****************BDCMSGCOLL STRUCTURE***************************

data: it_bdcmsg like bdcmsgcoll occurs 0 with header line.

*****************INTERNAL TABLE FOR ERROR CATCH*****************

data : begin of m_tab1 occurs 10,

  • kunnr like rf02d-kunnr, "CUSTOMER ACC NO

dyname like bdcmsgcoll-dyname, " PROG NAME

dynumb like bdcmsgcoll-dynumb, " SCREEN NO

msgspra like bdcmsgcoll-msgspra, " LANGU

msgid like bdcmsgcoll-msgid, " MESSAGE ID

msgnr like bdcmsgcoll-msgnr, " MESSAGE NO

msgtyp like bdcmsgcoll-msgtyp, " MESSAGE TYPE

msgv1 like bdcmsgcoll-msgv1, " MESSAGE VARIABLE PART

MSGV2 like bdcmsgcoll-msgv2, " MESSAGE VARIABLE PART

w_msgtxt(273) type c, " Formatted message text

end of m_tab1.

data: w_msgtxt(273) type c, "Formatted message text

idx type i value'1'.

LOOP AT ITEM.

MOVE-CORRESPONDING ITEM TO IT_ITEM.

APPEND IT_ITEM.

ENDLOOP.

********************************************

clear OPTIONS.

OPTIONS-DISMODE = 'A'.

OPTIONS-UPDMODE = 'S'.

OPTIONS-CATTMODE = ' '.

OPTIONS-DEFSIZE = ' '.

OPTIONS-RACOMMIT = ' '.

OPTIONS-NOBINPT = 'X'.

OPTIONS-NOBIEND = ' '.

********************************************

perform bdc_dynpro using 'SAPMV45A' '0101'.

perform bdc_field using 'BDC_CURSOR'

'VBAK-VKGRP'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'VBAK-AUART'

SDTYPE. " 'ZFDS'.

perform bdc_field using 'VBAK-VKORG'

SDORG. " 'fr00'.

perform bdc_field using 'VBAK-VTWEG'

DISTCHANNEL. " 'de'.

perform bdc_field using 'VBAK-SPART'

DIVISION. " 'cd'.

perform bdc_field using 'VBAK-VKBUR'

SALESOFF. " 'PU01'.

perform bdc_dynpro using 'SAPMV45A' '4001'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'VBKD-BSTKD'

PO_NO. " '32211'.

perform bdc_field using 'VBKD-BSTDK'

PO_DATE. " '15.01.2007'.

perform bdc_field using 'KUAGV-KUNNR'

SOLDTOPARTY. " '700209'.

perform bdc_field using 'KUWEV-KUNNR'

SHPTOPARTY. " '702037'.

perform bdc_field using 'RV45A-KETDAT'

DELDATE. " '15.01.2008'.

*perform bdc_field using 'RV45A-KPRGBZ'

  • 'D'.

perform bdc_field using 'VBKD-PRSDT'

PRICEDATE. " '15.01.2008'.

perform bdc_field using 'VBKD-ZTERM'

PAYTERM. " 'X009'.

perform bdc_field using 'VBKD-INCO1'

INCOTERMS. " 'FOL'.

perform bdc_field using 'VBKD-INCO2'

INCOTERMS1. " 'ASURLE PORLE'.

move 1 to I.

loop at it_item.

CONCATENATE 'RV45A-MABNR(' I ')' INTO FNAM.

perform bdc_field using FNAM

it_item-MATERIAL.

CONCATENATE 'RV45A-KWMENG(' I ')' INTO FNAM.

perform bdc_field using FNAM

it_item-QTY.

CONCATENATE 'VBAP-VRKME(' I ')' INTO FNAM.

perform bdc_field using FNAM

it_item-UNIT.

I = I + 1.

ENDLOOP.

perform bdc_dynpro using 'SAPMV45A' '4001'.

perform bdc_field using 'BDC_OKCODE'

'=PDE2'.

perform bdc_field using 'BDC_CURSOR'

'VBAP-POSNR(01)'.

perform bdc_field using 'RV45A-VBAP_SELKZ(01)'

'X'.

perform bdc_dynpro using 'SAPMV45A' '4003'.

perform bdc_field using 'BDC_OKCODE'

'=SICH'.

perform bdc_field using 'BDC_CURSOR'

'VBAP-LGORT'.

perform bdc_field using 'VBAP-WERKS'

PLANT. " 'DFTP'.

perform bdc_field using 'VBAP-LGORT'

SLOC. " 'npgd'.

perform bdc_dynpro using 'SAPLSPO2' '0101'.

perform bdc_field using 'BDC_OKCODE'

'=OPT1'.

perform bdc_dynpro using 'SAPLRHRD' '0100'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'SPOP-TEXTLINE1'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

*********************************************

call transaction 'VA01' using bdcdata options from OPTIONS

messages into it_bdcmsg.

*call transaction 'VA01' using bdcdata mode 'N'

  • update 'A'

  • messages into it_bdcmsg.

*if sy-subrc ne 0 .

******************ERROR WRITE**********************

loop at it_bdcmsg.

  • move itab-kunnr to m_tab1-kunnr.

move it_bdcmsg-dyname to m_tab1-dyname.

move it_bdcmsg-dynumb to m_tab1-dynumb.

move it_bdcmsg-msgspra to m_tab1-msgspra.

move it_bdcmsg-msgid to m_tab1-msgid.

move it_bdcmsg-msgnr to m_tab1-msgnr.

move it_bdcmsg-msgtyp to m_tab1-msgtyp.

move it_bdcmsg-msgv1 to m_tab1-msgv1.

move it_bdcmsg-msgv2 to m_tab1-msgv2.

append m_tab1.

clear m_tab1.

endloop.

clear it_bdcmsg.

refresh it_bdcmsg.

refresh bdcdata.

loop at m_tab1.

if ( m_tab1-MSGID = 'V1' and m_tab1-msgnr = 311 ).

orderno = m_tab1-msgv2.

endif.

endloop.

loop at m_tab1.

call function 'MESSAGE_PREPARE'

exporting

language = sy-langu

msg_id = m_tab1-msgid

msg_no = m_tab1-msgnr

importing

msg_text = w_msgtxt

exceptions

function_not_completed = 1

message_not_found = 2

others = 3.

move w_msgtxt to m_tab1-w_msgtxt.

if ( m_tab1-msgtyp = 'E' ).

move w_msgtxt to errormsg.

endif.

if m_tab1-msgnr = 164.

move w_msgtxt to MSG.

endif.

modify m_tab1.

endloop.

ENDFUNCTION.

----


  • Start new screen *

----


form bdc_dynpro using program dynpro.

clear bdcdata.

bdcdata-program = program.

bdcdata-dynpro = dynpro.

bdcdata-dynbegin = 'X'.

append bdcdata.

endform.

----


  • Insert field *

----


form bdc_field using fnam fval.

if fval <> space.

clear bdcdata.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

append bdcdata.

endif.

endform.