Hi
I am required to add batch splitting logic in below code.
Any one tell me how to do this
PERFORM get_invoice_data. PERFORM filter_invoice_data. FORM get_invoice_data. SELECT k~vkorg k~vbeln k~fkart k~vtweg k~fkdat "CHOYT CHG#1589121 k~waerk k~bzirk k~regio k~BSTNK_VF "Mod-010++ p~posnr p~vkgrp p~vkbur p~mvgr5 p~matnr p~arktx p~fkimg p~vrkme p~netwr p~mwsbp p~aubel p~vgbel p~vgtyp p~charg p~werks k~fkart k~xblnr INTO CORRESPONDING FIELDS OF TABLE t_vbrp FROM vbrk AS k INNER JOIN vbrp AS p ON k~vbeln = p~vbeln WHERE k~vkorg IN s_vkorg "<< MOD CHOYT CHG#1589121 AND k~fkdat IN s_fkdat AND k~vtweg IN s_vtweg AND k~rfbsk = 'C' " Accounting document has been created AND vkgrp IN s_vkgrp AND vkbur IN s_vkbur. ENDFORM. " get_invoice_data FORM filter_invoice_data. DATA lt_vbpa LIKE t_vbpa OCCURS 0 WITH HEADER LINE. If not t_vbrp[] is initial. "Mod-004++ REFRESH lt_vbpa. SELECT vbeln parvw kunnr FROM vbpa INTO CORRESPONDING FIELDS OF TABLE lt_vbpa FOR ALL ENTRIES IN t_vbrp WHERE vbeln = t_vbrp-vbeln AND posnr = '000000'. " Header partner SELECT vbeln parvw kunnr FROM vbpa APPENDING CORRESPONDING FIELDS OF TABLE lt_vbpa FOR ALL ENTRIES IN t_vbrp WHERE vbeln = t_vbrp-vbeln AND parvw = 'WE'. " Header partner Endif. "Mod-004++ SORT lt_vbpa BY vbeln. t_vbpa[] = lt_vbpa[]. LOOP AT lt_vbpa WHERE vbeln = t_vbrp-vbeln AND parvw IN s_parvw AND kunnr IN s_kunnr. EXIT. ENDLOOP. IF sy-subrc <> 0. DELETE t_vbrp. ENDIF. ENDLOOP. IF c_prf = 'X'. "KA01 SORT t_vbrp DESCENDING BY posnr vbeln fkart. "KA01 SORT t_vbrp DESCENDING BY vgbel fkart. LOOP AT t_vbrp WHERE rfbsk NE 'C'. t_vbrp_c = t_vbrp. APPEND t_vbrp_c. DELETE t_vbrp. ENDLOOP. SORT t_vbrp_c DESCENDING BY vgbel vgpos vbeln. DELETE ADJACENT DUPLICATES FROM t_vbrp_c COMPARING vgbel vgpos fkart. LOOP AT t_vbrp_c. t_vbrp = t_vbrp_c. APPEND t_vbrp. ENDLOOP. SORT t_vbrp. ENDIF. "KA01 ENDFORM. " filter_invoice_data
Hi Kumar,,
I think batch splitting means.. issuing a material having different batches...
To use batch spiltting logic, use 'At new' command or 'On change of' command to display the differnt batches of the same material...
Regards...
Navaneeth.
Hi Kumar,
You should format your code before posting... I have done it and put it just below :
PERFORM get_invoice_data. PERFORM filter_invoice_data. FORM get_invoice_data. SELECT k~vkorg k~vbeln k~fkart k~vtweg k~fkdat "CHOYT CHG#1589121 k~waerk k~bzirk k~regio k~BSTNK_VF "Mod-010++ p~posnr p~vkgrp p~vkbur p~mvgr5 p~matnr p~arktx p~fkimg p~vrkme p~netwr p~mwsbp p~aubel p~vgbel p~vgtyp p~charg p~werks k~fkart k~xblnr INTO CORRESPONDING FIELDS OF TABLE t_vbrp FROM vbrk AS k INNER JOIN vbrp AS p ON k~vbeln = p~vbeln WHERE k~vkorg IN s_vkorg "<< MOD CHOYT CHG#1589121 AND k~fkdat IN s_fkdat AND k~vtweg IN s_vtweg AND k~rfbsk = 'C' " Accounting document has been created AND vkgrp IN s_vkgrp AND vkbur IN s_vkbur. ENDFORM. " get_invoice_data FORM filter_invoice_data. DATA lt_vbpa LIKE t_vbpa OCCURS 0 WITH HEADER LINE. IF NOT t_vbrp[] IS INITIAL. "Mod-004++ REFRESH lt_vbpa. SELECT vbeln parvw kunnr FROM vbpa INTO CORRESPONDING FIELDS OF TABLE lt_vbpa FOR ALL ENTRIES IN t_vbrp WHERE vbeln = t_vbrp-vbeln AND posnr = '000000'. " Header partner SELECT vbeln parvw kunnr FROM vbpa APPENDING CORRESPONDING FIELDS OF TABLE lt_vbpa FOR ALL ENTRIES IN t_vbrp WHERE vbeln = t_vbrp-vbeln AND parvw = 'WE'. " Header partner ENDIF. "Mod-004++ SORT lt_vbpa BY vbeln. t_vbpa[] = lt_vbpa[]. " I believe that you have forget the following line, isn't it? LOOP AT t_vbrp. " ^^^^^^^^^^^^^^ LOOP AT lt_vbpa WHERE vbeln = t_vbrp-vbeln AND parvw IN s_parvw AND kunnr IN s_kunnr. EXIT. ENDLOOP. IF sy-subrc 0. DELETE t_vbrp. ENDIF. ENDLOOP. IF c_prf = 'X'. "KA01 " Are you sure you want to sort your internal table twice ??? SORT t_vbrp DESCENDING BY posnr vbeln fkart. "KA01 SORT t_vbrp DESCENDING BY vgbel fkart. " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " I don't understand why you delete some lines in T_VBRP " that you after insert again in T_VBRP " (a sort change nothing to the content)??? LOOP AT t_vbrp WHERE rfbsk NE 'C'. ... " here I have skipped some lines ENDLOOP. " ^^^^^^^^^^^^^^^^^^^ SORT t_vbrp. ENDIF. "KA01 ENDFORM. " filter_invoice_data
I have insert some remarks about your code : some lines seems strange! But for your question, what do you mean by batch splitting logic? Could you explicit? Thanks!
Samuel
Add a comment