Application Development 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: 

BDC : ON t/CODE V_V2

Former Member
0 Kudos

Hi,

I am trying to reshedule the stock trnsport with the TCode:V_V2

(RESHECULING saLES AND STOCK TRANSPORT DOCUMENT.)

but after the commit it does not reflect in the PO. But if I do it MAually while going to the V_V2 Tcode it updates the PO.I have Tried all the BDC OPtions it is not updating.

Can Any Champ Please HElp Me!!!!!

Regards,

Ronie

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You cannot do a call transaction for this one. This is just a plain report program with a selection screen. Simply do a SUBMIT(see the help on this one).

11 REPLIES 11

former_member181962
Active Contributor
0 Kudos

Can YOu Post your code?

0 Kudos

REPORT zresc_03

NO STANDARD PAGE HEADING LINE-SIZE 255.

DATA : temp TYPE mseg-matnr.

TABLES: mkpf,mseg,t100.

DATA: BEGIN OF itab OCCURS 0,

matnr LIKE mseg-matnr,

werks LIKE mseg-werks,

lgort LIKE mseg-lgort,

bwart LIKE mseg-bwart,

END OF itab.

DATA datel TYPE sy-datum .

DATA dateh TYPE sy-datum .

DATA: BEGIN OF bdcdata OCCURS 0.

INCLUDE STRUCTURE bdcdata.

DATA: END OF bdcdata.

DATA: messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.

DATA postdt1 TYPE sy-datum.

DATA: cnt(2) TYPE n, p_data(20) TYPE c.

DATA postdt2 TYPE sy-datum.

dateh = sy-datum.

DATA: BEGIN OF record OCCURS 10,

slow_i_01_001(045),

low_002(018),

low_003(004),

high_004(004),

p_sddocs_005(001),

p_purdoc_006(001),

p_itemlv_007(001),

p_schlv_008(001),

p_maco_c_009(001),

p_simul_010(001),

p_doctyp_011(001),

p_custor_012(001),

p_delpri_013(001),

p_date_014(001),

p_dcreat_015(001),

p_docno_016(001),

p_itemno_017(001),

END OF record.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE a1.

SELECT-OPTIONS: stloc FOR mseg-lgort DEFAULT '10',

movtyp FOR mseg-bwart DEFAULT '501',

site FOR mseg-werks DEFAULT '6000' TO '8999',

postdt FOR mkpf-budat .

PARAMETER: mode1 LIKE ctu_params-dismode DEFAULT 'A'.

SELECTION-SCREEN END OF BLOCK b1.

INITIALIZATION.

postdt-LOW = sy-datum .

*postdt-HIGH = sy-datum .

postdt-OPTION = 'BT'.

postdt-SIGN = 'I'.

APPEND postdt.

START-OF-SELECTION.

*postdt-LOW = ( sy-datum - 1 ).

*postdt-HIGH = SY-DATUM.

*append postdt .

SELECT DISTINCT amatnr FROM mseg AS a INNER JOIN mkpf AS b ON amblnr = b~mblnr INTO CORRESPONDING FIELDS OF TABLE itab

WHERE b~budat IN postdt

AND a~lgort IN stloc

AND a~bwart IN movtyp

AND a~werks IN site.

IF sy-subrc <> 0. EXIT. ENDIF.

PERFORM bdc_dynpro USING 'SDV03V02' '1000'.

PERFORM bdc_field USING 'BDC_CURSOR'

'S_MATNR-LOW'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=%002'.

PERFORM bdc_dynpro USING 'SAPLALDB' '3000'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ACPT'.

PERFORM bdc_field USING 'BDC_CURSOR'

'RSCSEL-SLOW_I(02)'.

cnt = 1.

LOOP AT itab.

IF sy-tabix = 1.

temp = itab-matnr.

ENDIF.

CONCATENATE 'RSCSEL-SLOW_I(' cnt ')' INTO p_data.

PERFORM bdc_field USING p_data

itab-matnr.

cnt = cnt + 1.

ENDLOOP.

  • PERFORM bdc_field USING 'RSCSEL-SLOW_I(01)'

  • record-slow_i_01_001.

PERFORM bdc_dynpro USING 'SDV03V02' '1000'.

PERFORM bdc_field USING 'BDC_CURSOR'

'P_SIMUL'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ONLI'.

PERFORM bdc_field USING 'S_MATNR-LOW'

temp.

PERFORM bdc_field USING 'S_WERKS-LOW'

'6000'.

PERFORM bdc_field USING 'S_WERKS-HIGH'

'8999'.

PERFORM bdc_field USING 'P_SDDOCS'

'X'.

PERFORM bdc_field USING 'P_PURDOC'

'X'.

PERFORM bdc_field USING 'P_ITEMLV'

''.

PERFORM bdc_field USING 'P_SCHLV'

'X'.

PERFORM bdc_field USING 'P_MACO_C'

'X'.

PERFORM bdc_field USING 'P_SIMUL'

''.

PERFORM bdc_field USING 'P_DOCTYP'

'1'.

PERFORM bdc_field USING 'P_CUSTOR'

'X'.

PERFORM bdc_field USING 'P_DELPRI'

'2'.

PERFORM bdc_field USING 'P_DATE'

'3'.

PERFORM bdc_field USING 'P_DCREAT'

'X'.

PERFORM bdc_field USING 'P_DOCNO'

'4'.

PERFORM bdc_field USING 'P_ITEMNO'

'5'.

PERFORM bdc_dynpro USING 'SAPLSPO1' '0100'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=YES'.

PERFORM bdc_transaction USING 'V_V2'.

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.

CLEAR bdcdata.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

APPEND bdcdata.

ENDFORM.

FORM bdc_transaction USING tcode.

CALL TRANSACTION tcode USING bdcdata

MODE 'E'

UPDATE 'S'

MESSAGES INTO messtab.

refresh bdcdata.

ENDFORM. " bdc_transaction

0 Kudos

Hi Ronie,

Did you try to display what is there in messages table?

See if it tell you why the transaction is getting failed?

Run it in No screen mode and see the messages using FORMAT_MESSAGE function module.

REgards,

Ravi

0 Kudos

hI,

thanks for reply

i have modified the program and i am getting the

this messegae as result

"S PT Stock Transport 5500000153 changed"

Code i have changed is the last part.

FORM bdc_transaction USING tcode.

DATA: L_MSTRING(480).

DATA: L_SUBRC LIKE SY-SUBRC.

CALL TRANSACTION tcode USING bdcdata

MODE 'N'

UPDATE 'S'

MESSAGES INTO messtab.

L_SUBRC = SY-SUBRC.

LOOP AT MESSTAB.

SELECT SINGLE * FROM T100 WHERE SPRSL = MESSTAB-MSGSPRA

AND ARBGB = MESSTAB-MSGID

AND MSGNR = MESSTAB-MSGNR.

IF SY-SUBRC = 0.

L_MSTRING = T100-TEXT.

IF L_MSTRING CS '&1'.

REPLACE '&1' WITH MESSTAB-MSGV1 INTO L_MSTRING.

REPLACE '&2' WITH MESSTAB-MSGV2 INTO L_MSTRING.

REPLACE '&3' WITH MESSTAB-MSGV3 INTO L_MSTRING.

REPLACE '&4' WITH MESSTAB-MSGV4 INTO L_MSTRING.

ELSE.

REPLACE '&' WITH MESSTAB-MSGV1 INTO L_MSTRING.

REPLACE '&' WITH MESSTAB-MSGV2 INTO L_MSTRING.

REPLACE '&' WITH MESSTAB-MSGV3 INTO L_MSTRING.

REPLACE '&' WITH MESSTAB-MSGV4 INTO L_MSTRING.

ENDIF.

CONDENSE L_MSTRING.

WRITE: / MESSTAB-MSGTYP, L_MSTRING(250).

ELSE.

WRITE: / MESSTAB.

ENDIF.

ENDLOOP.

refresh bdcdata.

ENDFORM. " bdc_transaction

0 Kudos

What does the table t100 contain??

Are you sure of this method of displaying messages?

Generally what I do is:

LOOP AT i_return.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = i_return-id

LANG = sy-langu

NO = i_return-number

V1 = i_return-MESSAGE_V1

V2 = i_return-MESSAGE_V2

V3 = i_return-MESSAGE_V3

V4 = i_return-MESSAGE_V4

IMPORTING

MSG = l_message

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2

.

check sy-subrc = 0.

write: / l_message.

ENDLOOP.

If you are sure about your code, then what is the problem?

The Stock transport order has been changed right??

Is it not expected??

REgards,

Ravi

ferry_lianto
Active Contributor
0 Kudos

Hi Ronie,

Why don't you use SUBMIT - selscreen_options statement instead of using BDC?


...

SUBMIT SDV03V02 WITH S_MATNR IN I_MATNR
                ...
                AND RETURN.

...

Hope this will help.

Regards,

Ferry Lianto

Former Member
0 Kudos

You cannot do a call transaction for this one. This is just a plain report program with a selection screen. Simply do a SUBMIT(see the help on this one).

0 Kudos

Yes it worked Thanks Alot you all for your help.

I really appreciate for posting your comments.

THANKS

Message was edited by: Ronie James

0 Kudos

Glad it helped. Please close the thread by selecting 'Solved Problem' next to the responses.

0 Kudos

Hi,

Issue is that i tested with one article(material no) only. but how should i passed diffent material no,not the range like S_matnr-low to S_matnr-high.

i am getting material no from the

query:

SELECT DISTINCT amatnr FROM mseg AS a INNER JOIN mkpf AS b ON amblnr = b~mblnr INTO CORRESPONDING FIELDS OF TABLE itab

WHERE b~budat IN postdt

AND a~lgort IN stloc

AND a~bwart IN movtyp

AND a~werks IN site.

and i want to get the matnr from here and subit to the transaction.

UBMIT SDV03V02 USING SELECTION-SCREEN '1000'

WITH s_matnr IN M_MATNR

WITH S_WERKS IN SITE.

how should i insert the different article into the m_matnr . i tried with declaring the Rangae type internal table and passing it but it does not work.

0 Kudos
loop at itab.
  m_matnr-low    = itab-matnr.
  m_matnr-option = 'EQ'.
  m_matnr-sign   = 'I'.
  append m_matnr.
endloop.

SUBMIT SDV03V02 WITH s_matnr IN M_MATNR
                WITH S_WERKS IN SITE.