07-06-2006 8:48 PM
Hi all,
Iam using call transaction for t-code MB1A.
Though i commented out the perform statment for storage location even then i see the storage location value in when i execute the program.
This is my code
perform bdc_field using 'RM07M-BWARTWA' "movement type
w_mov_type.
perform bdc_field using 'RM07M-WERKS'
w_werks.
perform bdc_field using 'RM07M-LGORT'
w_lgort.
you can i commented out the storage location even then my i can see avalue for storage location when i execute the program.
Please let me know if iam wrong anywhere
07-06-2006 9:02 PM
Hi,
I changed the code to as suggested
perform bdc_field using 'RM07M-LGORT'
' '. "" w_lgort.
i DON'T SEE ANY STORAGE LOCATION IN MY INTIAL SCREEN.
wHEN I PASSED STORAGE LOCATION IN SECOND SCREEN AND I WANT THE STORAGE LOCATION TO BE DISPLAYED I DON'T SEE ANY STORAGE LOCATION IN MY SECOND SCREEN TOO.Intially it was showing up in both the screens.
Please let me know
07-06-2006 8:50 PM
07-06-2006 8:51 PM
comment out in this way
<b>* perform bdc_field using 'RM07M-LGORT' " w_lgort.</b>
07-06-2006 8:51 PM
Might be coming from parameter id. If this should not come, then you need to again set the parameter id to blank.
Then continue with your BDC.
Regds
Manohar
07-06-2006 9:02 PM
Hi,
I changed the code to as suggested
perform bdc_field using 'RM07M-LGORT'
' '. "" w_lgort.
i DON'T SEE ANY STORAGE LOCATION IN MY INTIAL SCREEN.
wHEN I PASSED STORAGE LOCATION IN SECOND SCREEN AND I WANT THE STORAGE LOCATION TO BE DISPLAYED I DON'T SEE ANY STORAGE LOCATION IN MY SECOND SCREEN TOO.Intially it was showing up in both the screens.
Please let me know
07-06-2006 9:05 PM
How are you passing the storage location on the second screen? If I am not wrong, here you will be entering the line details. So are passing the storage location with its line index?
Also, can you not use BAPI_GOODSMVT_CREATE instead of writing a BDC?
Message was edited by: Srinivas Adavi
07-06-2006 9:06 PM
Right, it was coping from the first, but you said that you didn't want it in the first screen. So that means that it will not copy to second screen. Which means that you BDC code will need to enter it. So if you don't want it on the first screen, but you do on your second screen, the re-record the transaction, and put the lgort on the second screen.
Not really sure what the point it though.
REgards,
Rich Heilman
07-06-2006 9:08 PM
As Srinivas has pointed out, BAPI is a better way to go when doing goods movements. HEre is a sample program.
In this example, it is actually doing a 971 movement type, not sure what movement type you are using.
report zrich_0001.
* Structures for BAPI
data: gm_header type bapi2017_gm_head_01.
data: gm_code type bapi2017_gm_code.
data: gm_headret type bapi2017_gm_head_ret.
data: gm_item type table of
bapi2017_gm_item_create with header line.
data: gm_return type bapiret2 occurs 0 with header line.
data: gm_retmtd type bapi2017_gm_head_ret-mat_doc.
clear: gm_return, gm_retmtd. refresh gm_return.
* Setup BAPI header data.
gm_header-pstng_date = sy-datum.
gm_header-doc_date = sy-datum.
gm_code-gm_code = '06'. " MB11
* Write 971 movement to table
clear gm_item.
move '971' to gm_item-move_type .
move '000000000040000100' to gm_item-material.
move '1' to gm_item-entry_qnt.
move 'EA' to gm_item-entry_uom.
move '0004' to gm_item-plant.
move '4999' to gm_item-stge_loc.
move '0901' to gm_item-move_reas.
append gm_item.
* Call goods movement BAPI
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gm_header
goodsmvt_code = gm_code
importing
goodsmvt_headret = gm_headret
materialdocument = gm_retmtd
tables
goodsmvt_item = gm_item
return = gm_return.
if not gm_retmtd is initial.
commit work and wait.
call function 'DEQUEUE_ALL'.
else.
commit work and wait.
call function 'DEQUEUE_ALL'.
endif.
write:/ gm_retmtd.
loop at gm_return.
write:/ gm_return.
endloop.
Regards,
Rich Heilman
07-06-2006 9:12 PM
07-06-2006 9:16 PM
Hi ,
i have a seperate recording for both i have perform statement called first screen
This my code take a look at it
perform create_first_screen.
loop at itab_update.
clear w_erfmg.
w_erfmg = itab_update-zmenge.
perform bdc_dynpro using 'SAPMM07M' '0421'.
perform bdc_field using 'BDC_OKCODE'
'=NLE'.
perform bdc_field using 'MSEG-MATNR(01)' "Material number
itab_update-matnr.
perform bdc_field using 'MSEG-ERFMG(01)' "Quantity
w_erfmg.
perform bdc_field using 'MSEG-ERFME(01)' "UoM
itab_update-meins.
perform bdc_field using 'MSEG-WERKS' "PLANT
ITAB_UPDATE-WERKS.
perform bdc_field using 'MSEG-LGORT' "STORAGE LOCATION
ITAB_UPDATE-WERKS.
perform bdc_field using 'BDC_SUBSCR' 'SAPMM07M 2400BLOCK1'.
perform bdc_field using 'BDC_SUBSCR' 'SAPLKACB 9000BLOCK'.
if not itab_update-kostl is initial.
perform bdc_field using 'BDC_CURSOR' 'COBL-KOSTL'.
perform bdc_field using 'COBL-KOSTL' itab_update-kostl.
elseif not itab_update-aufnr is initial.
itab_update-kostl.
perform bdc_field using 'BDC_CURSOR' 'COBL-AUFNR'.
perform bdc_field using 'COBL-AUFNR' itab_update-aufnr.
endif.
endloop.
This form for first screen
form create_first_screen.
data: w_date(10),
w_mov_type(3) value '201',
w_txt(19) value '340B Replenishment'.
w_werks = 'abc'.
write sy-datum to w_date mm/dd/yyyy.
perform bdc_dynpro using 'SAPMM07M' '0400'.
perform bdc_field using 'BDC_CURSOR'
'RM07M-XNAPR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MKPF-BLDAT'
w_date.
perform bdc_field using 'MKPF-BUDAT'
w_date.
perform bdc_field using 'MKPF-BKTXT'
w_txt.
perform bdc_field using 'RM07M-BWARTWA' "movement type
w_mov_type.
perform bdc_field using 'RM07M-WERKS'
w_werks.
perform bdc_field using 'RM07M-LGORT'
' '.
perform bdc_field using 'XFULL'
' '.
perform bdc_field using 'RM07M-XNAPR' ' X'. "print flag
perform bdc_field using 'RM07M-WVERS3'
'X'.
endform. " create_first_screen
pls let me know if iam wrong anywhere
07-06-2006 9:19 PM
07-06-2006 9:20 PM
It should be
perform bdc_field using 'MSEG-LGORT<b>(01)</b>' "STORAGE LOCATION
ITAB_UPDATE-<b>LGORT</b>.
07-06-2006 9:21 PM
07-06-2006 9:43 PM
Hi all,
I got that solved .
All i needed was have to change the MSEG-WERKS also to MSEG-WERKS(01),as srinivas suggested.
I would like to thank all for there efforts and time especially Srinivas and Rich,and all others.
Thanks
07-06-2006 9:45 PM
07-06-2006 9:50 PM
Glad to be of help. What you enter in the initial screen will be copied automatically to all the items in the subsequent screen. But if you want to change individual line's plant and/or storage location value or even the movement type, you have to use the index of that particular line. That is the theory behind it.